graphlog: move comment and flag denoting revs might be unsorted
authorYuya Nishihara <yuya@tcha.org>
Thu, 05 Feb 2015 23:49:18 +0900
changeset 24060 eb1c9700d19d
parent 24059 8d295ce6e488
child 24061 4fa72a09c73d
graphlog: move comment and flag denoting revs might be unsorted This prepares for extracting common part from getgraphlogrevs() and getlogrevs(). "possiblyunsorted" exists only in getgraphlogrevs().
mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Thu Feb 05 23:14:44 2015 +0900
+++ b/mercurial/cmdutil.py	Thu Feb 05 23:49:18 2015 +0900
@@ -1834,12 +1834,8 @@
     # 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 _makelogrevset might depend on the
-        # order of revs
-        possiblyunsorted = True
     else:
         if follow and len(repo) > 0:
             revs = repo.revs('reverse(:.)')
@@ -1849,7 +1845,9 @@
     if not revs:
         return revset.baseset(), None, None
     expr, filematcher = _makelogrevset(repo, pats, opts, revs)
-    if possiblyunsorted:
+    if opts.get('rev'):
+        # User-specified revs might be unsorted, but don't sort before
+        # _makelogrevset because it might depend on the order of revs
         revs.sort(reverse=True)
     if expr:
         # Revset matchers often operate faster on revisions in changelog