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

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 30, 2017, 3:43 p.m.
Message ID <7f2e682e3c4c305d1b08.1504107782@mimosa>
Download mbox | patch
Permalink /patch/23512/
State Accepted
Headers show

Comments

Yuya Nishihara - Aug. 30, 2017, 3:43 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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.
Augie Fackler - Aug. 30, 2017, 6:21 p.m.
On Thu, Aug 31, 2017 at 12:43:02AM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@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)

queued, thanks

Patch

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)