Patchwork [2,of,3,V4] revset: use and explicit loop to resolve each spec

login
register
mail settings
Submitter Boris Feld
Date April 14, 2018, 1:07 p.m.
Message ID <304b6671aa1be37fc410.1523711225@FB>
Download mbox | patch
Permalink /patch/31030/
State Superseded
Headers show

Comments

Boris Feld - April 14, 2018, 1:07 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1523367822 -7200
#      Tue Apr 10 15:43:42 2018 +0200
# Node ID 304b6671aa1be37fc410edb38f2f2f3040ce6708
# Parent  5c1a0d784a26d4e8659dcec80503c8764432a303
# EXP-Topic noname
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 304b6671aa1b
revset: use and explicit loop to resolve each spec

This is useful to clarify the next changeset.

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2190,14 +2190,17 @@  def matchany(ui, specs, repo=None, local
         return mfunc
     if not all(specs):
         raise error.ParseError(_("empty query"))
+
     lookup = None
     if repo:
         lookup = lookupfn(repo)
-    if len(specs) == 1:
-        tree = revsetlang.parse(specs[0], lookup)
+    parsedspecs = []
+    for s in specs:
+        parsedspecs.append(revsetlang.parse(s, lookup))
+    if len(parsedspecs) == 1:
+        tree = parsedspecs[0]
     else:
-        tree = ('or',
-                ('list',) + tuple(revsetlang.parse(s, lookup) for s in specs))
+        tree = ('or', ('list',) + tuple(parsedspecs))
 
     aliases = []
     warn = None