Mercurial > public > mercurial-scm > hg
diff mercurial/localrepo.py @ 33336:4672db164c98
revset: make repo.anyrevs accept customized alias override (API)
Previously repo.anyrevs only expand aliases in [revsetalias] config. This
patch makes it more flexible to accept a customized dict defining aliases
without having to couple with ui.
revsetlang.expandaliases now has the signature (tree, aliases, warn=None)
which is more consistent with templater.expandaliases. revsetlang.py is now
free from "ui", which seems to be a good thing.
author | Jun Wu <quark@fb.com> |
---|---|
date | Sat, 24 Jun 2017 15:29:42 -0700 |
parents | 36a415b5a4b2 |
children | fb320398a21c |
line wrap: on
line diff
--- a/mercurial/localrepo.py Fri Jul 07 01:05:20 2017 -0400 +++ b/mercurial/localrepo.py Sat Jun 24 15:29:42 2017 -0700 @@ -648,16 +648,19 @@ for r in self.revs(expr, *args): yield self[r] - def anyrevs(self, specs, user=False): + def anyrevs(self, specs, user=False, localalias=None): '''Find revisions matching one of the given revsets. Revset aliases from the configuration are not expanded by default. To - expand user aliases, specify ``user=True``. + expand user aliases, specify ``user=True``. To provide some local + definitions overriding user aliases, set ``localalias`` to + ``{name: definitionstring}``. ''' if user: - m = revset.matchany(self.ui, specs, repo=self) + m = revset.matchany(self.ui, specs, repo=self, + localalias=localalias) else: - m = revset.matchany(None, specs) + m = revset.matchany(None, specs, localalias=localalias) return m(self) def url(self):