diff mercurial/cmdutil.py @ 18169:ae663cba9a8d

cmdutil: make getgraphlogrevs return revs in descending order
author Siddharth Agarwal <sid0@fb.com>
date Fri, 28 Dec 2012 14:46:58 -0800
parents 54f063acc5ea
children 0dcc77b271b9
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Mon Dec 31 18:11:18 2012 -0600
+++ b/mercurial/cmdutil.py	Fri Dec 28 14:46:58 2012 -0800
@@ -1430,8 +1430,12 @@
     # Default --rev value depends on --follow but --follow behaviour
     # depends on revisions resolved from --rev...
     follow = opts.get('follow') or opts.get('follow_first')
+    possiblyunsorted = False # whether revs might need sorting
     if opts.get('rev'):
         revs = scmutil.revrange(repo, opts['rev'])
+        # Don't sort here because _makegraphlogrevset might depend on the
+        # order of revs
+        possiblyunsorted = True
     else:
         if follow and len(repo) > 0:
             revs = repo.revs('reverse(:.)')
@@ -1441,6 +1445,8 @@
     if not revs:
         return iter([]), None, None
     expr, filematcher = _makegraphlogrevset(repo, pats, opts, revs)
+    if possiblyunsorted:
+        revs.sort(reverse=True)
     if expr:
         matcher = revset.match(repo.ui, expr)
         revs = increasingrevs(repo, revs, matcher)