Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 35458:5bec509dc1ff
log: make "slowpath" condition slightly more readable
Before 8e0e334bad42 and 6c76c42a5893, the condition was "anypats() or
(files() and --removed)". This can be read as "<match is actually slow>
or <walk files including removed revs>". So "not always()" (i.e. walk
file revs) seems more appropriate here.
The logic should be unchanged:
not anypats() => always() or isexact() or prefix()
isexact() => not always()
prefix() => not always()
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Tue, 19 Dec 2017 21:41:39 +0900 |
parents | 786289423e97 |
children | 32c278eb876f |
comparison
equal
deleted
inserted
replaced
35457:2c47986505ff | 35458:5bec509dc1ff |
---|---|
2191 follow = opts.get('follow') or opts.get('follow_first') | 2191 follow = opts.get('follow') or opts.get('follow_first') |
2192 revs = _logrevs(repo, opts) | 2192 revs = _logrevs(repo, opts) |
2193 if not revs: | 2193 if not revs: |
2194 return [] | 2194 return [] |
2195 wanted = set() | 2195 wanted = set() |
2196 slowpath = match.anypats() or ((match.isexact() or match.prefix()) and | 2196 slowpath = match.anypats() or (not match.always() and opts.get('removed')) |
2197 opts.get('removed')) | |
2198 fncache = {} | 2197 fncache = {} |
2199 change = repo.changectx | 2198 change = repo.changectx |
2200 | 2199 |
2201 # First step is to fill wanted, the set of revisions that we want to yield. | 2200 # First step is to fill wanted, the set of revisions that we want to yield. |
2202 # When it does not induce extra cost, we also fill fncache for revisions in | 2201 # When it does not induce extra cost, we also fill fncache for revisions in |
2388 # _matchfiles() revset but walkchangerevs() builds its matcher with | 2387 # _matchfiles() revset but walkchangerevs() builds its matcher with |
2389 # scmutil.match(). The difference is input pats are globbed on | 2388 # scmutil.match(). The difference is input pats are globbed on |
2390 # platforms without shell expansion (windows). | 2389 # platforms without shell expansion (windows). |
2391 wctx = repo[None] | 2390 wctx = repo[None] |
2392 match, pats = scmutil.matchandpats(wctx, pats, opts) | 2391 match, pats = scmutil.matchandpats(wctx, pats, opts) |
2393 slowpath = match.anypats() or ((match.isexact() or match.prefix()) and | 2392 slowpath = match.anypats() or (not match.always() and opts.get('removed')) |
2394 opts.get('removed')) | |
2395 if not slowpath: | 2393 if not slowpath: |
2396 for f in match.files(): | 2394 for f in match.files(): |
2397 if follow and f not in wctx: | 2395 if follow and f not in wctx: |
2398 # If the file exists, it may be a directory, so let it | 2396 # If the file exists, it may be a directory, so let it |
2399 # take the slow path. | 2397 # take the slow path. |