Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 45648:3a024d7cd08e
cmdutil: make walkchangerevs() call prepare with matcher instead of filenames
Prepares for migrating walkchangerevs() to logcmdutil's logic, which provides
matcher-based interface.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 10 Sep 2020 16:14:48 +0900 |
parents | c1d0f83d62c4 |
children | bba730d7a6f4 |
comparison
equal
deleted
inserted
replaced
45647:9fead7d97069 | 45648:3a024d7cd08e |
---|---|
3604 b'cannot search in censored file: %(filename)s:%(revnum)s\n' | 3604 b'cannot search in censored file: %(filename)s:%(revnum)s\n' |
3605 ) | 3605 ) |
3606 % {b'filename': fn, b'revnum': pycompat.bytestr(rev),} | 3606 % {b'filename': fn, b'revnum': pycompat.bytestr(rev),} |
3607 ) | 3607 ) |
3608 | 3608 |
3609 def prep(ctx, fns): | 3609 def prep(ctx, fmatch): |
3610 rev = ctx.rev() | 3610 rev = ctx.rev() |
3611 pctx = ctx.p1() | 3611 pctx = ctx.p1() |
3612 matches.setdefault(rev, {}) | 3612 matches.setdefault(rev, {}) |
3613 if diff: | 3613 if diff: |
3614 parent = pctx.rev() | 3614 parent = pctx.rev() |
3619 # pathauditor checks without this in mozilla-central | 3619 # pathauditor checks without this in mozilla-central |
3620 contextmanager = repo.wvfs.audit.cached | 3620 contextmanager = repo.wvfs.audit.cached |
3621 else: | 3621 else: |
3622 contextmanager = util.nullcontextmanager | 3622 contextmanager = util.nullcontextmanager |
3623 with contextmanager(): | 3623 with contextmanager(): |
3624 for fn in fns: | 3624 assert fmatch.isexact() |
3625 for fn in fmatch.files(): | |
3625 # fn might not exist in the revision (could be a file removed by | 3626 # fn might not exist in the revision (could be a file removed by |
3626 # the revision). We could check `fn not in ctx` even when rev is | 3627 # the revision). We could check `fn not in ctx` even when rev is |
3627 # None, but it's less racy to protect againt that in readfile. | 3628 # None, but it's less racy to protect againt that in readfile. |
3628 if rev is not None and fn not in ctx: | 3629 if rev is not None and fn not in ctx: |
3629 continue | 3630 continue |