mercurial/revset.py
changeset 33336 4672db164c98
parent 33080 a53bfc2845f2
child 33377 5d63e5f40bea
equal deleted inserted replaced
33335:72f051f9a7d8 33336:4672db164c98
  1999     If order=followorder, a matcher takes the ordering specified by the input
  1999     If order=followorder, a matcher takes the ordering specified by the input
  2000     set.
  2000     set.
  2001     """
  2001     """
  2002     return matchany(ui, [spec], repo=repo, order=order)
  2002     return matchany(ui, [spec], repo=repo, order=order)
  2003 
  2003 
  2004 def matchany(ui, specs, repo=None, order=defineorder):
  2004 def matchany(ui, specs, repo=None, order=defineorder, localalias=None):
  2005     """Create a matcher that will include any revisions matching one of the
  2005     """Create a matcher that will include any revisions matching one of the
  2006     given specs
  2006     given specs
  2007 
  2007 
  2008     If order=followorder, a matcher takes the ordering specified by the input
  2008     If order=followorder, a matcher takes the ordering specified by the input
  2009     set.
  2009     set.
       
  2010 
       
  2011     If localalias is not None, it is a dict {name: definitionstring}. It takes
       
  2012     precedence over [revsetalias] config section.
  2010     """
  2013     """
  2011     if not specs:
  2014     if not specs:
  2012         def mfunc(repo, subset=None):
  2015         def mfunc(repo, subset=None):
  2013             return baseset()
  2016             return baseset()
  2014         return mfunc
  2017         return mfunc
  2021         tree = revsetlang.parse(specs[0], lookup)
  2024         tree = revsetlang.parse(specs[0], lookup)
  2022     else:
  2025     else:
  2023         tree = ('or',
  2026         tree = ('or',
  2024                 ('list',) + tuple(revsetlang.parse(s, lookup) for s in specs))
  2027                 ('list',) + tuple(revsetlang.parse(s, lookup) for s in specs))
  2025 
  2028 
       
  2029     aliases = []
       
  2030     warn = None
  2026     if ui:
  2031     if ui:
  2027         tree = revsetlang.expandaliases(ui, tree)
  2032         aliases.extend(ui.configitems('revsetalias'))
       
  2033         warn = ui.warn
       
  2034     if localalias:
       
  2035         aliases.extend(localalias.items())
       
  2036     if aliases:
       
  2037         tree = revsetlang.expandaliases(tree, aliases, warn=warn)
  2028     tree = revsetlang.foldconcat(tree)
  2038     tree = revsetlang.foldconcat(tree)
  2029     tree = revsetlang.analyze(tree, order)
  2039     tree = revsetlang.analyze(tree, order)
  2030     tree = revsetlang.optimize(tree)
  2040     tree = revsetlang.optimize(tree)
  2031     posttreebuilthook(tree, repo)
  2041     posttreebuilthook(tree, repo)
  2032     return makematcher(tree)
  2042     return makematcher(tree)