Patchwork [2,of,3] revrange: evaluate all revset specs at once

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 5, 2015, 2:44 p.m.
Message ID <2c44502472ba2b8420a9.1438785862@mimosa>
Download mbox | patch
Permalink /patch/10106/
State Superseded
Commit 4ee4f7415095dead5f25ee0167da11355100d69c
Headers show

Comments

Yuya Nishihara - Aug. 5, 2015, 2:44 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1436067342 -32400
#      Sun Jul 05 12:35:42 2015 +0900
# Node ID 2c44502472ba2b8420a9d0f9339a0c5f96bdc692
# Parent  983e70e0f872ff4b273e485526670ccfc8c6738a
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)".

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -720,14 +720,13 @@  def revpair(repo, revs):
 
 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.match(repo.ui, allspecs, repo)
+    return m(repo)
 
 def expandpats(pats):
     '''Expand bare globs when running on windows.