Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/cmdutil.py @ 25436:9724cbe2d546
add: replace match.bad() monkey patching with match.badmatch()
The previous code didn't restore the original method, but it looks like the
worst that would happen is junk added to a list that had already been processed
by previous subrepo invocation(s).
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 04 Jun 2015 21:49:50 -0400 |
parents | 69609f43c752 |
children | 9c1bcd95b3ff |
comparison
equal
deleted
inserted
replaced
25435:a592a6a6f4fe | 25436:9724cbe2d546 |
---|---|
2211 return graphmod.nodes(repo, nodes) | 2211 return graphmod.nodes(repo, nodes) |
2212 | 2212 |
2213 def add(ui, repo, match, prefix, explicitonly, **opts): | 2213 def add(ui, repo, match, prefix, explicitonly, **opts): |
2214 join = lambda f: os.path.join(prefix, f) | 2214 join = lambda f: os.path.join(prefix, f) |
2215 bad = [] | 2215 bad = [] |
2216 oldbad = match.bad | 2216 |
2217 match.bad = lambda x, y: bad.append(x) or oldbad(x, y) | 2217 badfn = lambda x, y: bad.append(x) or match.bad(x, y) |
2218 names = [] | 2218 names = [] |
2219 wctx = repo[None] | 2219 wctx = repo[None] |
2220 cca = None | 2220 cca = None |
2221 abort, warn = scmutil.checkportabilityalert(ui) | 2221 abort, warn = scmutil.checkportabilityalert(ui) |
2222 if abort or warn: | 2222 if abort or warn: |
2223 cca = scmutil.casecollisionauditor(ui, abort, repo.dirstate) | 2223 cca = scmutil.casecollisionauditor(ui, abort, repo.dirstate) |
2224 for f in wctx.walk(match): | 2224 |
2225 for f in wctx.walk(matchmod.badmatch(match, badfn)): | |
2225 exact = match.exact(f) | 2226 exact = match.exact(f) |
2226 if exact or not explicitonly and f not in wctx and repo.wvfs.lexists(f): | 2227 if exact or not explicitonly and f not in wctx and repo.wvfs.lexists(f): |
2227 if cca: | 2228 if cca: |
2228 cca(f) | 2229 cca(f) |
2229 names.append(f) | 2230 names.append(f) |