[PATCH 10 of 13] scmutil: speed up new-style range extension

Bryan O'Sullivan bos at serpentine.com
Fri Jun 1 17:52:08 CDT 2012


# HG changeset patch
# User Bryan O'Sullivan <bryano at fb.com>
# Date 1338591022 25200
# Node ID e071b98374034061df27dd2fbbea42f0ab8a1757
# Parent  935f0d6a2bb00cbc9fd4ebdb9a9f791fa2df6969
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
@@ -586,10 +586,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, revset.revsubset(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