[PATCH standalone] scmutil: speed up new-style range extension

Bryan O'Sullivan bos at serpentine.com
Fri Jun 22 14:01:31 CDT 2012


# HG changeset patch
# User Bryan O'Sullivan <bryano at fb.com>
# Date 1340391641 25200
# Node ID df67ebdd65bd5ffd7d2f465374e529fb98c58469
# Parent  efd2e14f72353626355dc82465bdf23bf6416aa2
scmutil: speed up new-style range extension

This improves perfrevset performance by 10% for 2222::33333 on a
kernel repo.

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -584,10 +584,9 @@ def revrange(repo, revs):
 
         # fall through to new-style queries if old-style fails
         m = revset.match(repo.ui, spec)
-        for r in m(repo, range(len(repo))):
-            if r not in seen:
-                l.append(r)
-        seen.update(l)
+        dl = [r for r in m(repo, revset.revsubset(repo)) if r not in seen]
+        l.extend(dl)
+        seen.update(dl)
 
     return l
 


More information about the Mercurial-devel mailing list