From patchwork Fri Jun 5 04:00:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [6, of, 8] cat: replace match.bad() monkey patching with match.badmatch() From: Matt Harbison X-Patchwork-Id: 9506 Message-Id: <6316bb0636ce6669559c.1433476851@Envy> To: mercurial-devel@selenic.com Cc: matt_harbison@yahoo.com Date: Fri, 05 Jun 2015 00:00:51 -0400 # HG changeset patch # User Matt Harbison # Date 1433469356 14400 # Thu Jun 04 21:55:56 2015 -0400 # Node ID 6316bb0636ce6669559c16f466d1065177ca637f # Parent 96d56f524bd1e549344d7329421dbb4d887a8b95 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. diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2437,22 +2437,16 @@ return 0 # Don't warn about "missing" files that are really in subrepos - bad = matcher.bad - def badfn(path, msg): for subpath in ctx.substate: if path.startswith(subpath): return - bad(path, msg) - - matcher.bad = badfn - - for abs in ctx.walk(matcher): + matcher.bad(path, msg) + + for abs in ctx.walk(matchmod.badmatch(matcher, badfn)): write(abs) err = 0 - matcher.bad = bad - for subpath in sorted(ctx.substate): sub = ctx.sub(subpath) try: