##// END OF EJS Templates
scmutil: proxy revrange() through repo to break import cycles...
Yuya Nishihara -
r31025:6cf28575 default
parent child Browse files
Show More
@@ -12,6 +12,7 b' from . import ('
12 12 bookmarks,
13 13 error,
14 14 obsolete,
15 scmutil,
15 16 )
16 17
17 18 def _destupdateobs(repo, clean):
@@ -342,9 +343,6 b" histeditdefaultrevset = 'reverse(only(.)"
342 343
343 344 def desthistedit(ui, repo):
344 345 """Default base revision to edit for `hg histedit`."""
345 # Avoid cycle: scmutil -> revset -> destutil
346 from . import scmutil
347
348 346 default = ui.config('histedit', 'defaultrev', histeditdefaultrevset)
349 347 if default:
350 348 revs = scmutil.revrange(repo, [default])
@@ -577,7 +577,8 b' class localrepository(object):'
577 577 %-formatting to escape certain types. See ``revsetlang.formatspec``.
578 578
579 579 Revset aliases from the configuration are not expanded. To expand
580 user aliases, consider calling ``scmutil.revrange()``.
580 user aliases, consider calling ``scmutil.revrange()`` or
581 ``repo.anyrevs([expr], user=True)``.
581 582
582 583 Returns a revset.abstractsmartset, which is a list-like interface
583 584 that contains integer revisions.
@@ -598,6 +599,18 b' class localrepository(object):'
598 599 for r in self.revs(expr, *args):
599 600 yield self[r]
600 601
602 def anyrevs(self, specs, user=False):
603 '''Find revisions matching one of the given revsets.
604
605 Revset aliases from the configuration are not expanded by default. To
606 expand user aliases, specify ``user=True``.
607 '''
608 if user:
609 m = revset.matchany(self.ui, specs, repo=self)
610 else:
611 m = revset.matchany(None, specs)
612 return m(self)
613
601 614 def url(self):
602 615 return 'file:' + self.root
603 616
@@ -29,7 +29,6 b' from . import ('
29 29 pathutil,
30 30 phases,
31 31 pycompat,
32 revset,
33 32 revsetlang,
34 33 similar,
35 34 util,
@@ -950,8 +949,7 b' def revrange(repo, specs):'
950 949 if isinstance(spec, int):
951 950 spec = revsetlang.formatspec('rev(%d)', spec)
952 951 allspecs.append(spec)
953 m = revset.matchany(repo.ui, allspecs, repo)
954 return m(repo)
952 return repo.anyrevs(allspecs, user=True)
955 953
956 954 def meaningfulparents(repo, ctx):
957 955 """Return list of meaningful (or all if debug) parentrevs for rev.
@@ -24,6 +24,7 b' from .node import ('
24 24 from . import (
25 25 encoding,
26 26 error,
27 scmutil,
27 28 util,
28 29 )
29 30
@@ -277,8 +278,6 b' def _readtagcache(ui, repo):'
277 278 If the cache is not up to date, the caller is responsible for reading tag
278 279 info from each returned head. (See findglobaltags().)
279 280 '''
280 from . import scmutil # avoid cycle
281
282 281 try:
283 282 cachefile = repo.vfs(_filename(repo), 'r')
284 283 # force reading the file for static-http
General Comments 0
You need to be logged in to leave comments. Login now