Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 24932:022282152632
revset: don't error out if tokens parse as existing symbols
It makes perfect sense for tokens to parse as existing revset symbols
(revset functions), and doesn't break anything, since parsing symbols
as functions works correctly in the presence of parens. For example,
if "only" is a bookmark, this used to error out,
hg log -r "only(only, @)"
which shouldn't, as the inner "only" is unambiguously not a function.
So we just remove the symbolset function and replace its calling site
with the stringset function.
For the tests, we confirm that "date" and "only" are both parsed as
revision names both inside revset expressions (e.g. an expression
containing ::) and inside old-style revision expressions (e.g. those
containing the name of the revision alone).
author | Jordi Guti?rrez Hermoso <jordigh@octave.org> |
---|---|
date | Sun, 03 May 2015 12:28:15 -0400 |
parents | e5f166961123 |
children | 2aa94b6fe51c |
comparison
equal
deleted
inserted
replaced
24931:c5d4f9cc8da7 | 24932:022282152632 |
---|---|
332 x = repo[x].rev() | 332 x = repo[x].rev() |
333 if x in subset: | 333 if x in subset: |
334 return baseset([x]) | 334 return baseset([x]) |
335 return baseset() | 335 return baseset() |
336 | 336 |
337 def symbolset(repo, subset, x): | |
338 if x in symbols: | |
339 raise error.ParseError(_("can't use %s here") % x) | |
340 return stringset(repo, subset, x) | |
341 | |
342 def rangeset(repo, subset, x, y): | 337 def rangeset(repo, subset, x, y): |
343 m = getset(repo, fullreposet(repo), x) | 338 m = getset(repo, fullreposet(repo), x) |
344 n = getset(repo, fullreposet(repo), y) | 339 n = getset(repo, fullreposet(repo), y) |
345 | 340 |
346 if not m or not n: | 341 if not m or not n: |
2086 | 2081 |
2087 methods = { | 2082 methods = { |
2088 "range": rangeset, | 2083 "range": rangeset, |
2089 "dagrange": dagrange, | 2084 "dagrange": dagrange, |
2090 "string": stringset, | 2085 "string": stringset, |
2091 "symbol": symbolset, | 2086 "symbol": stringset, |
2092 "and": andset, | 2087 "and": andset, |
2093 "or": orset, | 2088 "or": orset, |
2094 "not": notset, | 2089 "not": notset, |
2095 "list": listset, | 2090 "list": listset, |
2096 "func": func, | 2091 "func": func, |