--- a/mercurial/revsetlang.py Sun Jun 18 11:39:03 2017 +0900
+++ b/mercurial/revsetlang.py Sun Jun 18 11:57:28 2017 +0900
@@ -240,6 +240,11 @@
"""Check if given tree matches named function"""
return x and x[0] == 'func' and getsymbol(x[1]) == funcname
+def _isposargs(x, n):
+ """Check if given tree is n-length list of positional arguments"""
+ l = getlist(x)
+ return len(l) == n and all(y and y[0] != 'keyvalue' for y in l)
+
def _matchnamedfunc(x, funcname):
"""Return args tree if given tree matches named function; otherwise None
@@ -302,7 +307,7 @@
"""
ta = _matchnamedfunc(revs, 'ancestors')
tb = bases and bases[0] == 'not' and _matchnamedfunc(bases[1], 'ancestors')
- if ta and tb:
+ if _isposargs(ta, 1) and _isposargs(tb, 1):
return ('list', ta, tb)
def _fixops(x):