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

login
register
mail settings
Submitter phabricator
Date Dec. 13, 2017, 1:55 a.m.
Message ID <differential-rev-PHID-DREV-sby7wxdflf4bl773ajva-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/26258/
State Superseded
Headers show

Comments

phabricator - Dec. 13, 2017, 1:55 a.m.
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




To: pulkit, #hg-reviewers
Cc: mercurial-devel
phabricator - Dec. 19, 2017, 12:17 p.m.
pulkit abandoned this revision.
pulkit added a comment.


  Not required anymore.

REPOSITORY
  rHG Mercurial

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

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

Patch

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