changeset 16861:76bcd3eac67e

revset: implement dagrange directly This is much faster than the older implementation (~8x).
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 01 Jun 2012 15:50:22 -0700
parents e1aa1ed30030
children b6efeb27e733
files mercurial/revset.py
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Fri Jun 01 15:50:22 2012 -0700
+++ b/mercurial/revset.py	Fri Jun 01 15:50:22 2012 -0700
@@ -192,9 +192,15 @@
     return [x for x in r if x in s]
 
 def dagrange(repo, subset, x, y):
-    return andset(repo, subset,
-                  ('func', ('symbol', 'descendants'), x),
-                  ('func', ('symbol', 'ancestors'), y))
+    if subset:
+        r = range(len(repo))
+        m = getset(repo, r, x)
+        n = getset(repo, r, y)
+        cl = repo.changelog
+        xs = map(cl.rev, cl.nodesbetween(map(cl.node, m), map(cl.node, n))[0])
+        s = set(subset)
+        return [r for r in xs if r in s]
+    return []
 
 def andset(repo, subset, x, y):
     return getset(repo, getset(repo, subset, x), y)