outgoing: move sorting in the display function stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 25 Oct 2024 01:23:24 +0200
branchstable
changeset 52084 75123bc60b66
parent 52083 c53b6498ed1a
child 52085 653b7a19f1de
outgoing: move sorting in the display function This make the core code simpler.
mercurial/hg.py
--- a/mercurial/hg.py	Fri Oct 25 01:04:38 2024 +0200
+++ b/mercurial/hg.py	Fri Oct 25 01:23:24 2024 +0200
@@ -1454,6 +1454,9 @@
 
 
 def display_outgoing_revs(ui, repo, o, opts):
+    # make sure this is ordered by revision number
+    cl = repo.changelog
+    o.sort(key=cl.rev)
     if opts.get(b'graph'):
         revdag = logcmdutil.graphrevs(repo, o, opts)
         ui.pager(b'outgoing')
@@ -1524,11 +1527,7 @@
         except:  # re-raises
             other.close()
             raise
-    # make sure this is ordered by revision number
-    outgoing_revs = list(out)
-    cl = repo.changelog
-    outgoing_revs.sort(key=cl.rev)
-    return outgoing_revs, others
+    return list(out), others
 
 
 def verify(repo, level=None):