Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revset.py @ 34036:de286200f722
revset: move order argument to run-time match function
We no longer need the order flag to build a parsed tree.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 30 Aug 2017 22:41:36 +0900 |
parents | 62cc1f17c571 |
children | 205c47e30a93 |
line wrap: on
line diff
--- a/mercurial/revset.py Wed Aug 30 23:53:30 2017 +0900 +++ b/mercurial/revset.py Wed Aug 30 22:41:36 2017 +0900 @@ -76,8 +76,8 @@ # equivalent to 'follow' for them, and the resulting order is based on the # 'subset' parameter passed down to them: # -# m = revset.match(..., order=defineorder) -# m(repo, subset) +# m = revset.match(...) +# m(repo, subset, order=defineorder) # ^^^^^^ # For most revsets, 'define' means using the order this subset provides # @@ -2120,21 +2120,14 @@ # hook for extensions to execute code on the optimized tree pass -def match(ui, spec, repo=None, order=defineorder): - """Create a matcher for a single revision spec +def match(ui, spec, repo=None): + """Create a matcher for a single revision spec""" + return matchany(ui, [spec], repo=repo) - 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, localalias=None): +def matchany(ui, specs, repo=None, localalias=None): """Create a matcher that will include any revisions matching one of the given specs - If order=followorder, a matcher takes the ordering specified by the input - set. - If localalias is not None, it is a dict {name: definitionstring}. It takes precedence over [revsetalias] config section. """ @@ -2166,11 +2159,11 @@ tree = revsetlang.analyze(tree) tree = revsetlang.optimize(tree) posttreebuilthook(tree, repo) - return makematcher(tree, order) + return makematcher(tree) -def makematcher(tree, order=defineorder): +def makematcher(tree): """Create a matcher from an evaluatable tree""" - def mfunc(repo, subset=None): + def mfunc(repo, subset=None, order=defineorder): if subset is None: subset = fullreposet(repo) return getset(repo, subset, tree, order)