[PATCH 2 of 6] graphlog: move comment and flag denoting revs might be unsorted

Yuya Nishihara yuya at tcha.org
Fri Feb 6 08:40:58 CST 2015


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1423147758 -32400
#      Thu Feb 05 23:49:18 2015 +0900
# Node ID 423f43b4a5ed798c5d1340e3f35dd44a58e9eed0
# Parent  3935fb2aa125fd7ca09979e0bbd7369a6a19935a
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().

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1834,12 +1834,8 @@ def getgraphlogrevs(repo, pats, opts):
     # 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 @@ def getgraphlogrevs(repo, pats, opts):
     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


More information about the Mercurial-devel mailing list