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