graphlog: pass changesets to revset.match() in changelog order
authorPatrick Mezard <patrick@mezard.eu>
Wed, 11 Apr 2012 11:14:07 +0200
changeset 16406 4aa4f50c52b9
parent 16405 17deb6bbfbab
child 16407 49ef1c382965
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.
hgext/graphlog.py
--- 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,