changeset 34019:205c47e30a93

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.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 30 Aug 2017 22:51:28 +0900
parents de286200f722
children 37b82485097f
files mercurial/cmdutil.py mercurial/revset.py
diffstat 2 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Wed Aug 30 22:41:36 2017 +0900
+++ b/mercurial/cmdutil.py	Wed Aug 30 22:51:28 2017 +0900
@@ -2559,7 +2559,7 @@
             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 @@
     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):
--- a/mercurial/revset.py	Wed Aug 30 22:41:36 2017 +0900
+++ b/mercurial/revset.py	Wed Aug 30 22:51:28 2017 +0900
@@ -2163,7 +2163,12 @@
 
 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)