comparison hgext/largefiles/overrides.py @ 23617:f1e6b86da4c0 stable

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.
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 21 Dec 2014 14:42:46 -0500
parents 96d335e4eacb
children 9dd5dfeaab4c
comparison
equal deleted inserted replaced
23601:444603a7ebeb 23617:f1e6b86da4c0
20 import lfutil 20 import lfutil
21 import lfcommands 21 import lfcommands
22 import basestore 22 import basestore
23 23
24 # -- Utility functions: commonly/repeatedly needed functionality --------------- 24 # -- Utility functions: commonly/repeatedly needed functionality ---------------
25
26 def composelargefilematcher(match, manifest):
27 '''create a matcher that matches only the largefiles in the original
28 matcher'''
29 m = copy.copy(match)
30 lfile = lambda f: lfutil.standin(f) in manifest
31 m._files = filter(lfile, m._files)
32 m._fmap = set(m._files)
33 m._always = False
34 origmatchfn = m.matchfn
35 m.matchfn = lambda f: lfile(f) and origmatchfn(f)
36 return m
25 37
26 def installnormalfilesmatchfn(manifest): 38 def installnormalfilesmatchfn(manifest):
27 '''installmatchfn with a matchfn that ignores all largefiles''' 39 '''installmatchfn with a matchfn that ignores all largefiles'''
28 def overridematch(ctx, pats=[], opts={}, globbed=False, 40 def overridematch(ctx, pats=[], opts={}, globbed=False,
29 default='relpath'): 41 default='relpath'):