diff hgext/largefiles/overrides.py @ 25467:f64dbe06f3d0

scmutil: add an optional parameter to matcher factories for a bad() override Even though scmutil.matchandpats() is documented to warn about bad files, several callers silence the warning.
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 05 Jun 2015 19:24:32 -0400
parents 1a95c57959f6
children 3ec8351fa6ed
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Fri Jun 05 19:07:54 2015 -0400
+++ b/hgext/largefiles/overrides.py	Fri Jun 05 19:24:32 2015 -0400
@@ -51,8 +51,8 @@
 def installnormalfilesmatchfn(manifest):
     '''installmatchfn with a matchfn that ignores all largefiles'''
     def overridematch(ctx, pats=[], opts={}, globbed=False,
-            default='relpath'):
-        match = oldmatch(ctx, pats, opts, globbed, default)
+            default='relpath', badfn=None):
+        match = oldmatch(ctx, pats, opts, globbed, default, badfn=badfn)
         return composenormalfilematcher(match, manifest)
     oldmatch = installmatchfn(overridematch)
 
@@ -288,13 +288,14 @@
 
 def overridelog(orig, ui, repo, *pats, **opts):
     def overridematchandpats(ctx, pats=[], opts={}, globbed=False,
-            default='relpath'):
+            default='relpath', badfn=None):
         """Matcher that merges root directory with .hglf, suitable for log.
         It is still possible to match .hglf directly.
         For any listed files run log on the standin too.
         matchfn tries both the given filename and with .hglf stripped.
         """
-        matchandpats = oldmatchandpats(ctx, pats, opts, globbed, default)
+        matchandpats = oldmatchandpats(ctx, pats, opts, globbed, default,
+                                       badfn=badfn)
         m, p = copy.copy(matchandpats)
 
         if m.always():
@@ -377,9 +378,9 @@
     # (2) to determine what files to print out diffs for.
     # The magic matchandpats override should be used for case (1) but not for
     # case (2).
-    def overridemakelogfilematcher(repo, pats, opts):
+    def overridemakelogfilematcher(repo, pats, opts, badfn=None):
         wctx = repo[None]
-        match, pats = oldmatchandpats(wctx, pats, opts)
+        match, pats = oldmatchandpats(wctx, pats, opts, badfn=badfn)
         return lambda rev: match
 
     oldmatchandpats = installmatchandpatsfn(overridematchandpats)
@@ -613,7 +614,7 @@
 
         manifest = repo[None].manifest()
         def overridematch(ctx, pats=[], opts={}, globbed=False,
-                default='relpath'):
+                default='relpath', badfn=None):
             newpats = []
             # The patterns were previously mangled to add the standin
             # directory; we need to remove that now
@@ -622,7 +623,7 @@
                     newpats.append(pat.replace(lfutil.shortname, ''))
                 else:
                     newpats.append(pat)
-            match = oldmatch(ctx, newpats, opts, globbed, default)
+            match = oldmatch(ctx, newpats, opts, globbed, default, badfn=badfn)
             m = copy.copy(match)
             lfile = lambda f: lfutil.standin(f) in manifest
             m._files = [lfutil.standin(f) for f in m._files if lfile(f)]
@@ -722,8 +723,8 @@
         oldstandins = lfutil.getstandinsstate(repo)
 
         def overridematch(mctx, pats=[], opts={}, globbed=False,
-                default='relpath'):
-            match = oldmatch(mctx, pats, opts, globbed, default)
+                default='relpath', badfn=None):
+            match = oldmatch(mctx, pats, opts, globbed, default, badfn=badfn)
             m = copy.copy(match)
 
             # revert supports recursing into subrepos, and though largefiles