D1676: revset: take out logic generating matcher for empty spec in it's own fn

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Wed Dec 13 01:55:04 UTC 2017


pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This will help us in calling the functions from another modules and is done so
  that we can get the tree object parsed at revset.matchany() and update
  visibility exceptions based on that.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1676

AFFECTED FILES
  mercurial/revset.py

CHANGE DETAILS

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2152,17 +2152,19 @@
     """Create a matcher for a single revision spec"""
     return matchany(ui, [spec], repo=repo)
 
+def emptymatcher(repo, subset=None):
+    """ Matcher for empty specs """
+    return baseset()
+
 def matchany(ui, specs, repo=None, localalias=None):
     """Create a matcher that will include any revisions matching one of the
     given specs
 
     If localalias is not None, it is a dict {name: definitionstring}. It takes
     precedence over [revsetalias] config section.
     """
     if not specs:
-        def mfunc(repo, subset=None):
-            return baseset()
-        return mfunc
+        return emptymatcher
     if not all(specs):
         raise error.ParseError(_("empty query"))
     lookup = None



To: pulkit, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list