comparison mercurial/cmdutil.py @ 25272:6c76c42a5893

walkchangerevs: avoid match.files() in conditions See 9789b4a7c595 (match: introduce boolean prefix() method, 2014-10-28) for reasons to avoid match.files() in conditions.
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 19 May 2015 11:34:50 -0700
parents 1b1eaf1885df
children 8e0e334bad42
comparison
equal deleted inserted replaced
25271:1b1eaf1885df 25272:6c76c42a5893
1753 follow = opts.get('follow') or opts.get('follow_first') 1753 follow = opts.get('follow') or opts.get('follow_first')
1754 revs = _logrevs(repo, opts) 1754 revs = _logrevs(repo, opts)
1755 if not revs: 1755 if not revs:
1756 return [] 1756 return []
1757 wanted = set() 1757 wanted = set()
1758 slowpath = match.anypats() or (match.files() and opts.get('removed')) 1758 slowpath = match.anypats() or ((match.isexact() or match.prefix()) and
1759 opts.get('removed'))
1759 fncache = {} 1760 fncache = {}
1760 change = repo.changectx 1761 change = repo.changectx
1761 1762
1762 # First step is to fill wanted, the set of revisions that we want to yield. 1763 # First step is to fill wanted, the set of revisions that we want to yield.
1763 # When it does not induce extra cost, we also fill fncache for revisions in 1764 # When it does not induce extra cost, we also fill fncache for revisions in
1833 wanted = wanted - [x] 1834 wanted = wanted - [x]
1834 1835
1835 # Now that wanted is correctly initialized, we can iterate over the 1836 # Now that wanted is correctly initialized, we can iterate over the
1836 # revision range, yielding only revisions in wanted. 1837 # revision range, yielding only revisions in wanted.
1837 def iterate(): 1838 def iterate():
1838 if follow and not match.files(): 1839 if follow and match.always():
1839 ff = _followfilter(repo, onlyfirst=opts.get('follow_first')) 1840 ff = _followfilter(repo, onlyfirst=opts.get('follow_first'))
1840 def want(rev): 1841 def want(rev):
1841 return ff.match(rev) and rev in wanted 1842 return ff.match(rev) and rev in wanted
1842 else: 1843 else:
1843 def want(rev): 1844 def want(rev):