mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 16:31:02 +03:00
cat: replace match.bad() monkey patching with match.badmatch()
No known issues with the previous code since it restored the original method, but this is cleaner.
This commit is contained in:
parent
6cb27fae52
commit
e439cb0dce
@ -2437,22 +2437,16 @@ def cat(ui, repo, ctx, matcher, prefix, **opts):
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
# Don't warn about "missing" files that are really in subrepos
|
# Don't warn about "missing" files that are really in subrepos
|
||||||
bad = matcher.bad
|
|
||||||
|
|
||||||
def badfn(path, msg):
|
def badfn(path, msg):
|
||||||
for subpath in ctx.substate:
|
for subpath in ctx.substate:
|
||||||
if path.startswith(subpath):
|
if path.startswith(subpath):
|
||||||
return
|
return
|
||||||
bad(path, msg)
|
matcher.bad(path, msg)
|
||||||
|
|
||||||
matcher.bad = badfn
|
for abs in ctx.walk(matchmod.badmatch(matcher, badfn)):
|
||||||
|
|
||||||
for abs in ctx.walk(matcher):
|
|
||||||
write(abs)
|
write(abs)
|
||||||
err = 0
|
err = 0
|
||||||
|
|
||||||
matcher.bad = bad
|
|
||||||
|
|
||||||
for subpath in sorted(ctx.substate):
|
for subpath in sorted(ctx.substate):
|
||||||
sub = ctx.sub(subpath)
|
sub = ctx.sub(subpath)
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user