diff mercurial/revset.py @ 28015:a036e1ae1fbe

merge with stable
author Matt Mackall <mpm@selenic.com>
date Sun, 07 Feb 2016 00:49:31 -0600
parents 86c4cbdaffee b19d8d5d6b51
children 5476a7a039c0
line wrap: on
line diff
--- a/mercurial/revset.py	Tue Jan 19 18:20:13 2016 +0000
+++ b/mercurial/revset.py	Sun Feb 07 00:49:31 2016 -0600
@@ -319,7 +319,7 @@
     if not x:
         return []
     if x[0] == 'list':
-        return getlist(x[1]) + [x[2]]
+        return list(x[1:])
     return [x]
 
 def getargs(x, min, max, err):
@@ -448,7 +448,7 @@
 def notset(repo, subset, x):
     return subset - getset(repo, subset, x)
 
-def listset(repo, subset, a, b):
+def listset(repo, subset, *xs):
     raise error.ParseError(_("can't use a list in this context"),
                            hint=_('see hg help "revsets.x or y"'))
 
@@ -2253,7 +2253,7 @@
         return o[0], (op, o[1])
     elif op == 'group':
         return optimize(x[1], small)
-    elif op in 'dagrange range list parent ancestorspec':
+    elif op in 'dagrange range parent ancestorspec':
         if op == 'parent':
             # x^:y means (x^) : y, not x ^ (:y)
             post = ('parentpost', x[1])
@@ -2265,6 +2265,9 @@
         wa, ta = optimize(x[1], small)
         wb, tb = optimize(x[2], small)
         return wa + wb, (op, ta, tb)
+    elif op == 'list':
+        ws, ts = zip(*(optimize(y, small) for y in x[1:]))
+        return sum(ws), (op,) + ts
     elif op == 'func':
         f = getstring(x[1], _("not a symbol"))
         wa, ta = optimize(x[2], small)
@@ -2366,6 +2369,7 @@
         tree, pos = p.parse(_tokenizealias(decl))
         if (pos != len(decl)):
             raise error.ParseError(_('invalid token'), pos)
+        tree = parser.simplifyinfixops(tree, ('list',))
 
         if isvalidsymbol(tree):
             # "name = ...." style
@@ -2456,7 +2460,7 @@
     tree, pos = p.parse(tokenizedefn(defn))
     if pos != len(defn):
         raise error.ParseError(_('invalid token'), pos)
-    return parser.simplifyinfixops(tree, ('or',))
+    return parser.simplifyinfixops(tree, ('list', 'or'))
 
 class revsetalias(object):
     # whether own `error` information is already shown or not.
@@ -2587,7 +2591,7 @@
     tree, pos = p.parse(tokenize(spec, lookup=lookup))
     if pos != len(spec):
         raise error.ParseError(_("invalid token"), pos)
-    return parser.simplifyinfixops(tree, ('or',))
+    return parser.simplifyinfixops(tree, ('list', 'or'))
 
 def posttreebuilthook(tree, repo):
     # hook for extensions to execute code on the optimized tree