diff 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
line wrap: on
line diff
--- a/mercurial/revset.py	Tue May 05 12:33:26 2015 -0500
+++ b/mercurial/revset.py	Sun May 03 12:28:15 2015 -0400
@@ -334,11 +334,6 @@
         return baseset([x])
     return baseset()
 
-def symbolset(repo, subset, x):
-    if x in symbols:
-        raise error.ParseError(_("can't use %s here") % x)
-    return stringset(repo, subset, x)
-
 def rangeset(repo, subset, x, y):
     m = getset(repo, fullreposet(repo), x)
     n = getset(repo, fullreposet(repo), y)
@@ -2088,7 +2083,7 @@
     "range": rangeset,
     "dagrange": dagrange,
     "string": stringset,
-    "symbol": symbolset,
+    "symbol": stringset,
     "and": andset,
     "or": orset,
     "not": notset,