changeset 25434:5984dd42e140

addremove: 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:25:07 -0400
parents 419ac63fe29c
children a592a6a6f4fe
files mercurial/scmutil.py
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Thu Jun 04 21:19:22 2015 -0400
+++ b/mercurial/scmutil.py	Thu Jun 04 21:25:07 2015 -0400
@@ -850,15 +850,14 @@
                                  % join(subpath))
 
     rejected = []
-    origbad = m.bad
     def badfn(f, msg):
         if f in m.files():
-            origbad(f, msg)
+            m.bad(f, msg)
         rejected.append(f)
 
-    m.bad = badfn
-    added, unknown, deleted, removed, forgotten = _interestingfiles(repo, m)
-    m.bad = origbad
+    badmatch = matchmod.badmatch(m, badfn)
+    added, unknown, deleted, removed, forgotten = _interestingfiles(repo,
+                                                                    badmatch)
 
     unknownset = set(unknown + forgotten)
     toprint = unknownset.copy()