changeset 16406:4aa4f50c52b9

graphlog: pass changesets to revset.match() in changelog order Running: $ time hg debugrevspec 'user(mpm)' | wc on Mercurial repository takes 1.0s with a regular version and 1.8s if commands.debugrevspec() is patched to pass revisions to revset.match() from tip to 0. Depending on what we expect from the revset API and caller wisdom, we might want to push this change in revset.match() later.
author Patrick Mezard <patrick@mezard.eu>
date Wed, 11 Apr 2012 11:14:07 +0200
parents 17deb6bbfbab
children 49ef1c382965
files hgext/graphlog.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/graphlog.py	Wed Apr 11 11:07:30 2012 +0200
+++ b/hgext/graphlog.py	Wed Apr 11 11:14:07 2012 +0200
@@ -409,7 +409,11 @@
         return [], None, None
     expr, filematcher = _makelogrevset(repo, pats, opts, revs)
     if expr:
-        revs = revsetmod.match(repo.ui, expr)(repo, revs)
+        # Evaluate revisions in changelog order for performance
+        # reasons but preserve the original sequence order in the
+        # filtered result.
+        matched = set(revsetmod.match(repo.ui, expr)(repo, sorted(revs)))
+        revs = [r for r in revs if r in matched]
     return revs, expr, filematcher
 
 def generate(ui, dag, displayer, showparents, edgefn, getrenamed=None,