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

login
register
mail settings
Submitter Yuya Nishihara
Date Feb. 6, 2015, 2:40 p.m.
Message ID <423f43b4a5ed798c5d13.1423233658@mimosa>
Download mbox | patch
Permalink /patch/7710/
State Accepted
Commit eb1c9700d19d7391af033d4c7f30ebbacfaa55a6
Headers show

Comments

Yuya Nishihara - Feb. 6, 2015, 2:40 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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().

Patch

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