[PATCH 2 of 3 V5] revset: use and explicit loop to resolve each spec

Boris Feld boris.feld at octobus.net
Mon Apr 16 02:58:30 EDT 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1523367822 -7200
#      Tue Apr 10 15:43:42 2018 +0200
# Node ID f363552ced37ae028bbcf2cba1f02ac623385f54
# Parent  99b314c5fe199b821705712324647971e79e8cbc
# EXP-Topic noname
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r f363552ced37
revset: use and explicit loop to resolve each spec

This is useful to clarify the next changeset.

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2189,11 +2189,13 @@ def matchany(ui, specs, lookup=None, loc
         return mfunc
     if not all(specs):
         raise error.ParseError(_("empty query"))
-    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


More information about the Mercurial-devel mailing list