largefiles: introduce the 'composelargefilematcher()' method stable
authorMatt Harbison <matt_harbison@yahoo.com>
Sun, 21 Dec 2014 14:42:46 -0500
branchstable
changeset 23617 f1e6b86da4c0
parent 23601 444603a7ebeb
child 23618 9dd5dfeaab4c
largefiles: introduce the 'composelargefilematcher()' method This is a copy/paste (with the necessary tweaks) of the composenormalfilematcher method currently on default, which does the inverse- this trims the normal files out of the matcher. It will be used in the next patch.
hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py	Thu Dec 18 14:59:28 2014 -0600
+++ b/hgext/largefiles/overrides.py	Sun Dec 21 14:42:46 2014 -0500
@@ -23,6 +23,18 @@
 
 # -- Utility functions: commonly/repeatedly needed functionality ---------------
 
+def composelargefilematcher(match, manifest):
+    '''create a matcher that matches only the largefiles in the original
+    matcher'''
+    m = copy.copy(match)
+    lfile = lambda f: lfutil.standin(f) in manifest
+    m._files = filter(lfile, m._files)
+    m._fmap = set(m._files)
+    m._always = False
+    origmatchfn = m.matchfn
+    m.matchfn = lambda f: lfile(f) and origmatchfn(f)
+    return m
+
 def installnormalfilesmatchfn(manifest):
     '''installmatchfn with a matchfn that ignores all largefiles'''
     def overridematch(ctx, pats=[], opts={}, globbed=False,