Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 25438:7ce5a3230441
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.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 04 Jun 2015 21:55:56 -0400 |
parents | 9c1bcd95b3ff |
children | aaede04c0ba6 |
comparison
equal
deleted
inserted
replaced
25437:9c1bcd95b3ff | 25438:7ce5a3230441 |
---|---|
2435 if mfnode and mf.find(mfnode, file)[0]: | 2435 if mfnode and mf.find(mfnode, file)[0]: |
2436 write(file) | 2436 write(file) |
2437 return 0 | 2437 return 0 |
2438 | 2438 |
2439 # Don't warn about "missing" files that are really in subrepos | 2439 # Don't warn about "missing" files that are really in subrepos |
2440 bad = matcher.bad | |
2441 | |
2442 def badfn(path, msg): | 2440 def badfn(path, msg): |
2443 for subpath in ctx.substate: | 2441 for subpath in ctx.substate: |
2444 if path.startswith(subpath): | 2442 if path.startswith(subpath): |
2445 return | 2443 return |
2446 bad(path, msg) | 2444 matcher.bad(path, msg) |
2447 | 2445 |
2448 matcher.bad = badfn | 2446 for abs in ctx.walk(matchmod.badmatch(matcher, badfn)): |
2449 | |
2450 for abs in ctx.walk(matcher): | |
2451 write(abs) | 2447 write(abs) |
2452 err = 0 | 2448 err = 0 |
2453 | |
2454 matcher.bad = bad | |
2455 | 2449 |
2456 for subpath in sorted(ctx.substate): | 2450 for subpath in sorted(ctx.substate): |
2457 sub = ctx.sub(subpath) | 2451 sub = ctx.sub(subpath) |
2458 try: | 2452 try: |
2459 submatch = matchmod.narrowmatcher(subpath, matcher) | 2453 submatch = matchmod.narrowmatcher(subpath, matcher) |