largefiles: use the optional badfn argument when building a matcher
authorMatt Harbison <matt_harbison@yahoo.com>
Fri, 05 Jun 2015 22:53:15 -0400
changeset 25470 378a8e700e02
parent 25469 cc3d94e5994e
child 25472 4d2b9b304ad0
largefiles: use the optional badfn argument when building a matcher The monkey patching in cat() can't be fixed, because it still delegates to the original bad(). Overriding commands.cat() should go away in favor overriding cmdutil.cat() anyway, and that matcher can be wrapped with matchmod.badmatch().
hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py	Fri Jun 05 19:35:32 2015 -0400
+++ b/hgext/largefiles/lfutil.py	Fri Jun 05 22:53:15 2015 -0400
@@ -241,16 +241,18 @@
 def getstandinmatcher(repo, rmatcher=None):
     '''Return a match object that applies rmatcher to the standin directory'''
     standindir = repo.wjoin(shortname)
+
+    # no warnings about missing files or directories
+    badfn = lambda f, msg: None
+
     if rmatcher and not rmatcher.always():
         pats = [os.path.join(standindir, pat) for pat in rmatcher.files()]
-        match = scmutil.match(repo[None], pats)
+        match = scmutil.match(repo[None], pats, badfn=badfn)
         # if pats is empty, it would incorrectly always match, so clear _always
         match._always = False
     else:
         # no patterns: relative to repo root
-        match = scmutil.match(repo[None], [standindir])
-    # no warnings about missing files or directories
-    match.bad = lambda f, msg: None
+        match = scmutil.match(repo[None], [standindir], badfn=badfn)
     return match
 
 def composestandinmatcher(repo, rmatcher):