comparison hgext/largefiles/overrides.py @ 23144:55325a327754

largefiles: drop unnecessary setting of matcher._always In two very similar segments of code, an existing matcher is modified by changing its _files attribute through a map and a filter operation. Neither operation can cause an empty list to become non-empty, so a matcher that always matches can not stop always matching. Drop the setting of the attribute, so we don't unnecessarily prevent the fast paths to be taken where these matchers end up being used.
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 30 Oct 2014 22:32:39 -0700
parents e53f6b72a0e4
children 97b6e762f218
comparison
equal deleted inserted replaced
23143:cd0c51c07e5f 23144:55325a327754
574 match = oldmatch(ctx, newpats, opts, globbed, default) 574 match = oldmatch(ctx, newpats, opts, globbed, default)
575 m = copy.copy(match) 575 m = copy.copy(match)
576 lfile = lambda f: lfutil.standin(f) in manifest 576 lfile = lambda f: lfutil.standin(f) in manifest
577 m._files = [lfutil.standin(f) for f in m._files if lfile(f)] 577 m._files = [lfutil.standin(f) for f in m._files if lfile(f)]
578 m._fmap = set(m._files) 578 m._fmap = set(m._files)
579 m._always = False
580 origmatchfn = m.matchfn 579 origmatchfn = m.matchfn
581 m.matchfn = lambda f: (lfutil.isstandin(f) and 580 m.matchfn = lambda f: (lfutil.isstandin(f) and
582 (f in manifest) and 581 (f in manifest) and
583 origmatchfn(lfutil.splitstandin(f)) or 582 origmatchfn(lfutil.splitstandin(f)) or
584 None) 583 None)
682 return None 681 return None
683 return f 682 return f
684 m._files = [tostandin(f) for f in m._files] 683 m._files = [tostandin(f) for f in m._files]
685 m._files = [f for f in m._files if f is not None] 684 m._files = [f for f in m._files if f is not None]
686 m._fmap = set(m._files) 685 m._fmap = set(m._files)
687 m._always = False
688 origmatchfn = m.matchfn 686 origmatchfn = m.matchfn
689 def matchfn(f): 687 def matchfn(f):
690 if lfutil.isstandin(f): 688 if lfutil.isstandin(f):
691 return (origmatchfn(lfutil.splitstandin(f)) and 689 return (origmatchfn(lfutil.splitstandin(f)) and
692 (f in repo[None] or f in ctx)) 690 (f in repo[None] or f in ctx))