Mercurial > hg
comparison mercurial/revset.py @ 29906:41491cf936f2
revset: add public function to create matcher from evaluatable tree
"hg debugrevspec" will use it to evaluate unoptimized tree.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 21 Aug 2016 11:37:00 +0900 |
parents | 371c2a39eead |
children | ae933e3e2226 |
comparison
equal
deleted
inserted
replaced
29905:371c2a39eead | 29906:41491cf936f2 |
---|---|
2613 lookup = repo.__contains__ | 2613 lookup = repo.__contains__ |
2614 if len(specs) == 1: | 2614 if len(specs) == 1: |
2615 tree = parse(specs[0], lookup) | 2615 tree = parse(specs[0], lookup) |
2616 else: | 2616 else: |
2617 tree = ('or',) + tuple(parse(s, lookup) for s in specs) | 2617 tree = ('or',) + tuple(parse(s, lookup) for s in specs) |
2618 return _makematcher(ui, tree, repo) | 2618 |
2619 | |
2620 def _makematcher(ui, tree, repo): | |
2621 if ui: | 2619 if ui: |
2622 tree = expandaliases(ui, tree, showwarning=ui.warn) | 2620 tree = expandaliases(ui, tree, showwarning=ui.warn) |
2623 tree = foldconcat(tree) | 2621 tree = foldconcat(tree) |
2624 tree = analyze(tree) | 2622 tree = analyze(tree) |
2625 tree = optimize(tree) | 2623 tree = optimize(tree) |
2626 posttreebuilthook(tree, repo) | 2624 posttreebuilthook(tree, repo) |
2625 return makematcher(tree) | |
2626 | |
2627 def makematcher(tree): | |
2628 """Create a matcher from an evaluatable tree""" | |
2627 def mfunc(repo, subset=None): | 2629 def mfunc(repo, subset=None): |
2628 if subset is None: | 2630 if subset is None: |
2629 subset = fullreposet(repo) | 2631 subset = fullreposet(repo) |
2630 if util.safehasattr(subset, 'isascending'): | 2632 if util.safehasattr(subset, 'isascending'): |
2631 result = getset(repo, subset, tree) | 2633 result = getset(repo, subset, tree) |