Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revset.py @ 37674:f83cb91b052e
revset: pass in lookup function instead of repo (API)
And document that it's only for legacy lookup. If we have a repo, we're
likely to do more things where that shouldn't be done.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 14 Apr 2018 12:57:32 +0900 |
parents | 0c6b1ec75b73 |
children | edb28a6d95b7 37e7ae332e90 |
line wrap: on
line diff
--- a/mercurial/revset.py Sat Apr 14 12:44:40 2018 +0900 +++ b/mercurial/revset.py Sat Apr 14 12:57:32 2018 +0900 @@ -2169,14 +2169,17 @@ def lookupfn(repo): return lambda symbol: scmutil.isrevsymbol(repo, symbol) -def match(ui, spec, repo=None): +def match(ui, spec, lookup=None): """Create a matcher for a single revision spec""" - return matchany(ui, [spec], repo=repo) + return matchany(ui, [spec], lookup=None) -def matchany(ui, specs, repo=None, localalias=None): +def matchany(ui, specs, lookup=None, localalias=None): """Create a matcher that will include any revisions matching one of the given specs + If lookup function is not None, the parser will first attempt to handle + old-style ranges, which may contain operator characters. + If localalias is not None, it is a dict {name: definitionstring}. It takes precedence over [revsetalias] config section. """ @@ -2186,9 +2189,6 @@ return mfunc if not all(specs): raise error.ParseError(_("empty query")) - lookup = None - if repo: - lookup = lookupfn(repo) if len(specs) == 1: tree = revsetlang.parse(specs[0], lookup) else: