Patchwork [1,of,9,V2] largefiles: split the creation of a normal matcher out of its install method

login
register
mail settings
Submitter Matt Harbison
Date Nov. 30, 2014, 5:52 a.m.
Message ID <36938964dbce5fc575dc.1417326749@Envy>
Download mbox | patch
Permalink /patch/6896/
State Accepted
Commit b5e3f3d25395ded693930b2c9a09b4c1c21b6d5e
Headers show

Comments

Matt Harbison - Nov. 30, 2014, 5:52 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1416626685 18000
#      Fri Nov 21 22:24:45 2014 -0500
# Node ID 36938964dbce5fc575dce8d6c07d4aec4d3d8af3
# Parent  b5e2128ce9e6cc0b6a2b20cc2763f9e6c351625b
largefiles: split the creation of a normal matcher out of its install method

Refactoring addremove to support subrepos will need the ability to keep passing
the same matcher and narrowing it, instead of monkey patching scmutil's matcher.

Patch

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -22,20 +22,23 @@ 
 
 # -- Utility functions: commonly/repeatedly needed functionality ---------------
 
+def composenormalfilematcher(match, manifest):
+    m = copy.copy(match)
+    notlfile = lambda f: not (lfutil.isstandin(f) or lfutil.standin(f) in
+            manifest)
+    m._files = filter(notlfile, m._files)
+    m._fmap = set(m._files)
+    m._always = False
+    origmatchfn = m.matchfn
+    m.matchfn = lambda f: notlfile(f) and origmatchfn(f)
+    return m
+
 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)
-        m = copy.copy(match)
-        notlfile = lambda f: not (lfutil.isstandin(f) or lfutil.standin(f) in
-                manifest)
-        m._files = filter(notlfile, m._files)
-        m._fmap = set(m._files)
-        m._always = False
-        origmatchfn = m.matchfn
-        m.matchfn = lambda f: notlfile(f) and origmatchfn(f)
-        return m
+        return composenormalfilematcher(match, manifest)
     oldmatch = installmatchfn(overridematch)
 
 def installmatchfn(f):