Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 32382:c87db79b9507
cleanup: reuse existing wctx variables instead of calling repo[None]
Incidentally, this apparently means we load .hgsub one time less as
well, which affects a test case.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Sat, 20 May 2017 22:27:52 -0700 |
parents | 04baab18d60a |
children | 1f4be037f558 |
comparison
equal
deleted
inserted
replaced
32381:b9942bc6b292 | 32382:c87db79b9507 |
---|---|
713 srcs = [] | 713 srcs = [] |
714 if after: | 714 if after: |
715 badstates = '?' | 715 badstates = '?' |
716 else: | 716 else: |
717 badstates = '?r' | 717 badstates = '?r' |
718 m = scmutil.match(repo[None], [pat], opts, globbed=True) | 718 m = scmutil.match(wctx, [pat], opts, globbed=True) |
719 for abs in repo[None].walk(m): | 719 for abs in wctx.walk(m): |
720 state = repo.dirstate[abs] | 720 state = repo.dirstate[abs] |
721 rel = m.rel(abs) | 721 rel = m.rel(abs) |
722 exact = m.exact(abs) | 722 exact = m.exact(abs) |
723 if state in badstates: | 723 if state in badstates: |
724 if exact and state == '?': | 724 if exact and state == '?': |
3047 # we'll need this later | 3047 # we'll need this later |
3048 targetsubs = sorted(s for s in wctx.substate if m(s)) | 3048 targetsubs = sorted(s for s in wctx.substate if m(s)) |
3049 | 3049 |
3050 if not m.always(): | 3050 if not m.always(): |
3051 matcher = matchmod.badmatch(m, lambda x, y: False) | 3051 matcher = matchmod.badmatch(m, lambda x, y: False) |
3052 for abs in repo[None].walk(matcher): | 3052 for abs in wctx.walk(matcher): |
3053 names[abs] = m.rel(abs), m.exact(abs) | 3053 names[abs] = m.rel(abs), m.exact(abs) |
3054 | 3054 |
3055 # walk target manifest to fill `names` | 3055 # walk target manifest to fill `names` |
3056 | 3056 |
3057 def badfn(path, msg): | 3057 def badfn(path, msg): |