# HG changeset patch # User Pierre-Yves David # Date 1618164046 -7200 # Node ID efc6f6a794bd4b3529cec4a29c4cd7cb997e094d # Parent 50b79f8b802d67d02e42f8b82e6a896666d2ede1 outgoing: merge the code handling --graph with the main one The --graph code had its own copy of the logic. With the previous reorganisation of the code, we can now merge it with the main code, reducing fragile complication. As a side effect, `hg out --graph` now use the right return code when they are nothing outgoing. This explain the change to output in `tests/test-largefiles-misc.t`. Differential Revision: https://phab.mercurial-scm.org/D10383 diff -r 50b79f8b802d -r efc6f6a794bd mercurial/commands.py --- a/mercurial/commands.py Tue Apr 13 15:13:20 2021 +0200 +++ b/mercurial/commands.py Sun Apr 11 20:00:46 2021 +0200 @@ -4972,22 +4972,6 @@ ) opts = pycompat.byteskwargs(opts) - if opts.get(b'graph'): - logcmdutil.checkunsupportedgraphflags([], opts) - o, other = hg._outgoing(ui, repo, dest, opts) - if not o: - cmdutil.outgoinghooks(ui, repo, other, opts, o) - return - - revdag = logcmdutil.graphrevs(repo, o, opts) - ui.pager(b'outgoing') - displayer = logcmdutil.changesetdisplayer(ui, repo, opts, buffered=True) - logcmdutil.displaygraph( - ui, repo, revdag, displayer, graphmod.asciiedges - ) - cmdutil.outgoinghooks(ui, repo, other, opts, o) - return 0 - if opts.get(b'bookmarks'): dest = path.pushloc or path.loc other = hg.peer(repo, opts, dest) diff -r 50b79f8b802d -r efc6f6a794bd mercurial/hg.py --- a/mercurial/hg.py Tue Apr 13 15:13:20 2021 +0200 +++ b/mercurial/hg.py Sun Apr 11 20:00:46 2021 +0200 @@ -32,6 +32,7 @@ error, exchange, extensions, + graphmod, httppeer, localrepo, lock, @@ -1382,18 +1383,29 @@ def outgoing(ui, repo, dest, opts): - + if opts.get(b'graph'): + logcmdutil.checkunsupportedgraphflags([], opts) o, other = _outgoing(ui, repo, dest, opts) ret = 1 try: if o: ret = 0 - ui.pager(b'outgoing') - displayer = logcmdutil.changesetdisplayer(ui, repo, opts) - for n in _outgoing_filter(repo, o, opts): - displayer.show(repo[n]) - displayer.close() + if opts.get(b'graph'): + revdag = logcmdutil.graphrevs(repo, o, opts) + ui.pager(b'outgoing') + displayer = logcmdutil.changesetdisplayer( + ui, repo, opts, buffered=True + ) + logcmdutil.displaygraph( + ui, repo, revdag, displayer, graphmod.asciiedges + ) + else: + ui.pager(b'outgoing') + displayer = logcmdutil.changesetdisplayer(ui, repo, opts) + for n in _outgoing_filter(repo, o, opts): + displayer.show(repo[n]) + displayer.close() cmdutil.outgoinghooks(ui, repo, other, opts, o) ret = min(ret, _outgoing_recurse(ui, repo, dest, opts)) return ret # exit code is zero since we found outgoing changes diff -r 50b79f8b802d -r efc6f6a794bd tests/test-largefiles-misc.t --- a/tests/test-largefiles-misc.t Tue Apr 13 15:13:20 2021 +0200 +++ b/tests/test-largefiles-misc.t Sun Apr 11 20:00:46 2021 +0200 @@ -675,6 +675,7 @@ searching for changes no changes found largefiles: no files to upload + [1] check messages when there are files to upload: