changeset 29418:bcefb25acf52

revset: implement match() in terms of matchany() match() is the special case of a single element list being passed to matchany() with the additional error checking that the revset spec is defined. Change the implementation to remove the redundant code and have match() call matchany().
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 25 Jun 2016 19:10:46 -0700
parents 526b027b0130
children 01c0324acfec
files mercurial/revset.py
diffstat 1 files changed, 2 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Sat Jun 25 19:12:20 2016 -0700
+++ b/mercurial/revset.py	Sat Jun 25 19:10:46 2016 -0700
@@ -2528,13 +2528,10 @@
     pass
 
 def match(ui, spec, repo=None):
+    """Create a matcher for a single revision spec."""
     if not spec:
         raise error.ParseError(_("empty query"))
-    lookup = None
-    if repo:
-        lookup = repo.__contains__
-    tree = parse(spec, lookup)
-    return _makematcher(ui, tree, repo)
+    return matchany(ui, [spec], repo=repo)
 
 def matchany(ui, specs, repo=None):
     """Create a matcher that will include any revisions matching one of the