changeset 29955:1b5931604a5a

revset: add option to make matcher takes the ordering of the input set This allows us to evaluate match(subset) as if 'subset & expr', which will be the complete fix for the issue5100.
author Yuya Nishihara <yuya@tcha.org>
date Tue, 03 May 2016 14:18:28 +0900
parents 769aee32fae0
children fa5e4f58dfbc
files mercurial/revset.py
diffstat 1 files changed, 15 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Mon Sep 19 09:14:35 2016 -0700
+++ b/mercurial/revset.py	Tue May 03 14:18:28 2016 +0900
@@ -2694,13 +2694,21 @@
     # hook for extensions to execute code on the optimized tree
     pass
 
-def match(ui, spec, repo=None):
-    """Create a matcher for a single revision spec."""
-    return matchany(ui, [spec], repo=repo)
-
-def matchany(ui, specs, repo=None):
+def match(ui, spec, repo=None, order=defineorder):
+    """Create a matcher for a single revision spec
+
+    If order=followorder, a matcher takes the ordering specified by the input
+    set.
+    """
+    return matchany(ui, [spec], repo=repo, order=order)
+
+def matchany(ui, specs, repo=None, order=defineorder):
     """Create a matcher that will include any revisions matching one of the
-    given specs"""
+    given specs
+
+    If order=followorder, a matcher takes the ordering specified by the input
+    set.
+    """
     if not specs:
         def mfunc(repo, subset=None):
             return baseset()
@@ -2718,7 +2726,7 @@
     if ui:
         tree = expandaliases(ui, tree)
     tree = foldconcat(tree)
-    tree = analyze(tree)
+    tree = analyze(tree, order)
     tree = optimize(tree)
     posttreebuilthook(tree, repo)
     return makematcher(tree)