2667 if repo: |
2667 if repo: |
2668 lookup = repo.__contains__ |
2668 lookup = repo.__contains__ |
2669 tree = parse(spec, lookup) |
2669 tree = parse(spec, lookup) |
2670 return _makematcher(ui, tree, repo) |
2670 return _makematcher(ui, tree, repo) |
2671 |
2671 |
|
2672 def matchany(ui, specs, repo=None): |
|
2673 """Create a matcher that will include any revisions matching one of the |
|
2674 given specs""" |
|
2675 if not specs: |
|
2676 def mfunc(repo, subset=None): |
|
2677 return baseset() |
|
2678 return mfunc |
|
2679 if not all(specs): |
|
2680 raise error.ParseError(_("empty query")) |
|
2681 lookup = None |
|
2682 if repo: |
|
2683 lookup = repo.__contains__ |
|
2684 if len(specs) == 1: |
|
2685 tree = parse(specs[0], lookup) |
|
2686 else: |
|
2687 tree = ('or',) + tuple(parse(s, lookup) for s in specs) |
|
2688 return _makematcher(ui, tree, repo) |
|
2689 |
2672 def _makematcher(ui, tree, repo): |
2690 def _makematcher(ui, tree, repo): |
2673 if ui: |
2691 if ui: |
2674 tree = findaliases(ui, tree, showwarning=ui.warn) |
2692 tree = findaliases(ui, tree, showwarning=ui.warn) |
2675 tree = foldconcat(tree) |
2693 tree = foldconcat(tree) |
2676 weight, tree = optimize(tree, True) |
2694 weight, tree = optimize(tree, True) |