comparison hgext/largefiles/overrides.py @ 21095:ec309395aa45

largefiles: revert override, install matchfn outside the try/except restoring it
author Mads Kiilerich <madski@unity3d.com>
date Sun, 13 Apr 2014 18:45:43 +0200
parents 4643bfec2485
children a45ed365904a
comparison
equal deleted inserted replaced
21094:4643bfec2485 21095:ec309395aa45
596 if (os.path.exists(repo.wjoin(lfutil.standin(lfile)))): 596 if (os.path.exists(repo.wjoin(lfutil.standin(lfile)))):
597 os.unlink(repo.wjoin(lfutil.standin(lfile))) 597 os.unlink(repo.wjoin(lfutil.standin(lfile)))
598 598
599 oldstandins = lfutil.getstandinsstate(repo) 599 oldstandins = lfutil.getstandinsstate(repo)
600 600
601 def overridematch(ctx, pats=[], opts={}, globbed=False,
602 default='relpath'):
603 match = oldmatch(ctx, pats, opts, globbed, default)
604 m = copy.copy(match)
605 def tostandin(f):
606 if lfutil.standin(f) in ctx:
607 return lfutil.standin(f)
608 elif lfutil.standin(f) in repo[None]:
609 return None
610 return f
611 m._files = [tostandin(f) for f in m._files]
612 m._files = [f for f in m._files if f is not None]
613 m._fmap = set(m._files)
614 m._always = False
615 origmatchfn = m.matchfn
616 def matchfn(f):
617 if lfutil.isstandin(f):
618 return (origmatchfn(lfutil.splitstandin(f)) and
619 (f in repo[None] or f in ctx))
620 return origmatchfn(f)
621 m.matchfn = matchfn
622 return m
623 oldmatch = installmatchfn(overridematch)
601 try: 624 try:
602 def overridematch(ctx, pats=[], opts={}, globbed=False,
603 default='relpath'):
604 match = oldmatch(ctx, pats, opts, globbed, default)
605 m = copy.copy(match)
606 def tostandin(f):
607 if lfutil.standin(f) in ctx:
608 return lfutil.standin(f)
609 elif lfutil.standin(f) in repo[None]:
610 return None
611 return f
612 m._files = [tostandin(f) for f in m._files]
613 m._files = [f for f in m._files if f is not None]
614 m._fmap = set(m._files)
615 m._always = False
616 origmatchfn = m.matchfn
617 def matchfn(f):
618 if lfutil.isstandin(f):
619 return (origmatchfn(lfutil.splitstandin(f)) and
620 (f in repo[None] or f in ctx))
621 return origmatchfn(f)
622 m.matchfn = matchfn
623 return m
624 oldmatch = installmatchfn(overridematch)
625 overridematch(repo[None], pats, opts)
626 orig(ui, repo, *pats, **opts) 625 orig(ui, repo, *pats, **opts)
627 finally: 626 finally:
628 restorematchfn() 627 restorematchfn()
629 628
630 newstandins = lfutil.getstandinsstate(repo) 629 newstandins = lfutil.getstandinsstate(repo)