outgoing: extract changeset display in its own function stable
authorFelipe Resende <felipe@fcresende.dev.br>
Fri, 25 Oct 2024 01:04:38 +0200
branchstable
changeset 51701 c53b6498ed1a
parent 51700 42863c4ff80f
child 51702 75123bc60b66
outgoing: extract changeset display in its own function This will clarify future patches.
mercurial/hg.py
--- 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))