From patchwork Wed Aug 5 14:44:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2,of,3] revrange: evaluate all revset specs at once From: Yuya Nishihara X-Patchwork-Id: 10106 Message-Id: <2c44502472ba2b8420a9.1438785862@mimosa> To: mercurial-devel@selenic.com Date: Wed, 05 Aug 2015 23:44:22 +0900 # HG changeset patch # User Yuya Nishihara # 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)". 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.