changeset 52083:c53b6498ed1a stable

outgoing: extract changeset display in its own function This will clarify future patches.
author Felipe Resende <felipe@fcresende.dev.br>
date Fri, 25 Oct 2024 01:04:38 +0200
parents 42863c4ff80f
children 75123bc60b66
files mercurial/hg.py
diffstat 1 files changed, 17 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hg.py	Tue Jun 11 14:35:52 2024 +0200
+++ b/mercurial/hg.py	Fri Oct 25 01:04:38 2024 +0200
@@ -1453,6 +1453,22 @@
     return ret
 
 
+def display_outgoing_revs(ui, repo, o, opts):
+    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()
+
+
 def outgoing(ui, repo, dests, opts, subpath=None):
     if opts.get(b'graph'):
         logcmdutil.checkunsupportedgraphflags([], opts)
@@ -1461,22 +1477,7 @@
     try:
         if o:
             ret = 0
-
-            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()
+            display_outgoing_revs(ui, repo, o, opts)
         for oth in others:
             cmdutil.outgoinghooks(ui, repo, oth, opts, o)
             ret = min(ret, _outgoing_recurse(ui, repo, dests, opts))