diff mercurial/revset.py @ 37350:e32dfff71529

revset: use revsymbol() for checking if a symbol is valid Differential Revision: https://phab.mercurial-scm.org/D3078
author Martin von Zweigbergk <martinvonz@google.com>
date Sun, 01 Apr 2018 22:48:32 -0700
parents 0194dac77c93
children bef863a09acd
line wrap: on
line diff
--- a/mercurial/revset.py	Tue Apr 03 15:08:14 2018 -0700
+++ b/mercurial/revset.py	Sun Apr 01 22:48:32 2018 -0700
@@ -2170,6 +2170,9 @@
     # hook for extensions to execute code on the optimized tree
     pass
 
+def lookupfn(repo):
+    return lambda symbol: scmutil.isrevsymbol(repo, symbol)
+
 def match(ui, spec, repo=None):
     """Create a matcher for a single revision spec"""
     return matchany(ui, [spec], repo=repo)
@@ -2189,7 +2192,7 @@
         raise error.ParseError(_("empty query"))
     lookup = None
     if repo:
-        lookup = repo.__contains__
+        lookup = lookupfn(repo)
     if len(specs) == 1:
         tree = revsetlang.parse(specs[0], lookup)
     else: