Patchwork D2301: rebase: sort roots by revision

login
register
mail settings
Submitter phabricator
Date Feb. 18, 2018, 5:36 a.m.
Message ID <differential-rev-PHID-DREV-qfnta2d6yqndsf7qprms-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/28041/
State Superseded
Headers show

Comments

phabricator - Feb. 18, 2018, 5:36 a.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Previously we were sorting them by whatever implicit sort order we got
  between changectx instances. Sorting by rev at least makes some sense,
  so I chose that.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2301

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1650,7 +1650,9 @@ 
     roots = list(repo.set('roots(%ld)', sortedsrc[0]))
     if not roots:
         raise error.Abort(_('no matching revisions'))
-    roots.sort()
+    def revof(r):
+        return r.rev()
+    roots = sorted(roots, key=revof)
     state = dict.fromkeys(rebaseset, revtodo)
     emptyrebase = (len(sortedsrc) == 1)
     for root in roots: