[PATCH 8 of 8] largefiles: replace match.bad() monkey patching with match.badmatch()

Matt Harbison mharbison72 at gmail.com
Thu Jun 4 23:00:53 CDT 2015


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1433470278 14400
#      Thu Jun 04 22:11:18 2015 -0400
# Node ID 89c9da9f2121dcba36002cf10a23df677026ee59
# Parent  91db1c0b272e90c500f1fe5416150a65c2c6579f
largefiles: 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.

The monkey patching in cat is harmless, because it is created locally, and
doesn't pass it anywhere (subrepo cat isn't supported with largefiles).

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -100,10 +100,10 @@
             lfmatcher = match_.match(repo.root, '', list(lfpats))
 
     lfnames = []
-    m = copy.copy(matcher)
-    m.bad = lambda x, y: None
+    m = matcher
+
     wctx = repo[None]
-    for f in repo.walk(m):
+    for f in repo.walk(match_.badmatch(m, lambda x, y: None)):
         exact = m.exact(f)
         lfile = lfutil.standin(f) in wctx
         nfile = f in wctx


More information about the Mercurial-devel mailing list