[PATCH 4 of 4] revset: make match function follow given subset if specified (API)

Yuya Nishihara yuya at tcha.org
Wed Aug 30 11:43:02 EDT 2017


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1504101088 -32400
#      Wed Aug 30 22:51:28 2017 +0900
# Node ID 7f2e682e3c4c305d1b0840cb1631074660e519fa
# Parent  d0c9c6ba9c005021dabb90f06194a5729f5ad561
revset: make match function follow given subset if specified (API)

This should be sensible default since mfunc(subset) is roughly equivalent
to 'subset & mfunc'. The order argument is still there so we can specify
'anyorder' if the order doesn't really matter.

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2559,7 +2559,7 @@ def getgraphlogrevs(repo, pats, opts):
             revs.sort(reverse=True)
     if expr:
         matcher = revset.match(repo.ui, expr)
-        revs = matcher(repo, revs, order=revset.followorder)
+        revs = matcher(repo, revs)
     if limit is not None:
         limitedrevs = []
         for idx, rev in enumerate(revs):
@@ -2585,7 +2585,7 @@ def getlogrevs(repo, pats, opts):
     expr, filematcher = _makelogrevset(repo, pats, opts, revs)
     if expr:
         matcher = revset.match(repo.ui, expr)
-        revs = matcher(repo, revs, order=revset.followorder)
+        revs = matcher(repo, revs)
     if limit is not None:
         limitedrevs = []
         for idx, r in enumerate(revs):
diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2163,7 +2163,12 @@ def matchany(ui, specs, repo=None, local
 
 def makematcher(tree):
     """Create a matcher from an evaluatable tree"""
-    def mfunc(repo, subset=None, order=defineorder):
+    def mfunc(repo, subset=None, order=None):
+        if order is None:
+            if subset is None:
+                order = defineorder  # 'x'
+            else:
+                order = followorder  # 'subset & x'
         if subset is None:
             subset = fullreposet(repo)
         return getset(repo, subset, tree, order)


More information about the Mercurial-devel mailing list