mercurial/revset.py
changeset 29418 bcefb25acf52
parent 29408 785cadec2091
child 29425 4f5531f8ac38
equal deleted inserted replaced
29417:526b027b0130 29418:bcefb25acf52
  2526 def posttreebuilthook(tree, repo):
  2526 def posttreebuilthook(tree, repo):
  2527     # hook for extensions to execute code on the optimized tree
  2527     # hook for extensions to execute code on the optimized tree
  2528     pass
  2528     pass
  2529 
  2529 
  2530 def match(ui, spec, repo=None):
  2530 def match(ui, spec, repo=None):
       
  2531     """Create a matcher for a single revision spec."""
  2531     if not spec:
  2532     if not spec:
  2532         raise error.ParseError(_("empty query"))
  2533         raise error.ParseError(_("empty query"))
  2533     lookup = None
  2534     return matchany(ui, [spec], repo=repo)
  2534     if repo:
       
  2535         lookup = repo.__contains__
       
  2536     tree = parse(spec, lookup)
       
  2537     return _makematcher(ui, tree, repo)
       
  2538 
  2535 
  2539 def matchany(ui, specs, repo=None):
  2536 def matchany(ui, specs, repo=None):
  2540     """Create a matcher that will include any revisions matching one of the
  2537     """Create a matcher that will include any revisions matching one of the
  2541     given specs"""
  2538     given specs"""
  2542     if not specs:
  2539     if not specs: