forget: replace match.bad() monkey patching with match.badmatch()
authorMatt Harbison <matt_harbison@yahoo.com>
Thu, 04 Jun 2015 21:53:16 -0400
changeset 25437 9c1bcd95b3ff
parent 25436 9724cbe2d546
child 25438 7ce5a3230441
forget: 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).
mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Thu Jun 04 21:49:50 2015 -0400
+++ b/mercurial/cmdutil.py	Thu Jun 04 21:53:16 2015 -0400
@@ -2251,11 +2251,11 @@
 def forget(ui, repo, match, prefix, explicitonly):
     join = lambda f: os.path.join(prefix, f)
     bad = []
-    oldbad = match.bad
-    match.bad = lambda x, y: bad.append(x) or oldbad(x, y)
+    badfn = lambda x, y: bad.append(x) or match.bad(x, y)
     wctx = repo[None]
     forgot = []
-    s = repo.status(match=match, clean=True)
+
+    s = repo.status(match=matchmod.badmatch(match, badfn), clean=True)
     forget = sorted(s[0] + s[1] + s[3] + s[6])
     if explicitonly:
         forget = [f for f in forget if match.exact(f)]