revrange: evaluate all revset specs at once
authorYuya Nishihara <yuya@tcha.org>
Sun, 05 Jul 2015 12:35:42 +0900
changeset 25928 4ee4f7415095
parent 25927 44da63623fca
child 25929 289149111d46
revrange: evaluate all revset specs at once This provides an opportunity for revset to optimize given expressions. For example, "-r0 -r1 -r2" can be optimized to "_list(0 1 2)".
mercurial/scmutil.py
--- a/mercurial/scmutil.py	Fri Aug 07 21:39:38 2015 +0900
+++ b/mercurial/scmutil.py	Sun Jul 05 12:35:42 2015 +0900
@@ -720,14 +720,13 @@
 
 def revrange(repo, revs):
     """Yield revision as strings from a list of revision specifications."""
-    subsets = []
+    allspecs = []
     for spec in revs:
         if isinstance(spec, int):
             spec = revset.formatspec('rev(%d)', spec)
-        m = revset.match(repo.ui, spec, repo)
-        subsets.append(m(repo))
-
-    return revset._combinesets(subsets)
+        allspecs.append(spec)
+    m = revset.matchany(repo.ui, allspecs, repo)
+    return m(repo)
 
 def expandpats(pats):
     '''Expand bare globs when running on windows.