comparison 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
comparison
equal deleted inserted replaced
33335:72f051f9a7d8 33336:4672db164c98
646 user aliases, consider calling ``scmutil.revrange()``. 646 user aliases, consider calling ``scmutil.revrange()``.
647 ''' 647 '''
648 for r in self.revs(expr, *args): 648 for r in self.revs(expr, *args):
649 yield self[r] 649 yield self[r]
650 650
651 def anyrevs(self, specs, user=False): 651 def anyrevs(self, specs, user=False, localalias=None):
652 '''Find revisions matching one of the given revsets. 652 '''Find revisions matching one of the given revsets.
653 653
654 Revset aliases from the configuration are not expanded by default. To 654 Revset aliases from the configuration are not expanded by default. To
655 expand user aliases, specify ``user=True``. 655 expand user aliases, specify ``user=True``. To provide some local
656 definitions overriding user aliases, set ``localalias`` to
657 ``{name: definitionstring}``.
656 ''' 658 '''
657 if user: 659 if user:
658 m = revset.matchany(self.ui, specs, repo=self) 660 m = revset.matchany(self.ui, specs, repo=self,
661 localalias=localalias)
659 else: 662 else:
660 m = revset.matchany(None, specs) 663 m = revset.matchany(None, specs, localalias=localalias)
661 return m(self) 664 return m(self)
662 665
663 def url(self): 666 def url(self):
664 return 'file:' + self.root 667 return 'file:' + self.root
665 668