hgext/largefiles/overrides.py
changeset 18341 ed23d6100dd3
parent 18154 93c697d9c158
child 18364 6252b4f1c4b4
equal deleted inserted replaced
18340:8802277c40ee 18341:ed23d6100dd3
   238         return orig(repo, ignoreupdate)
   238         return orig(repo, ignoreupdate)
   239     finally:
   239     finally:
   240         repo._repo.lfstatus = False
   240         repo._repo.lfstatus = False
   241 
   241 
   242 def overridelog(orig, ui, repo, *pats, **opts):
   242 def overridelog(orig, ui, repo, *pats, **opts):
       
   243     def overridematch(ctx, pats=[], opts={}, globbed=False,
       
   244             default='relpath'):
       
   245         """Matcher that merges root directory with .hglf, suitable for log.
       
   246         It is still possible to match .hglf directly.
       
   247         For any listed files run log on the standin too.
       
   248         matchfn tries both the given filename and with .hglf stripped.
       
   249         """
       
   250         match = oldmatch(ctx, pats, opts, globbed, default)
       
   251         m = copy.copy(match)
       
   252         standins = [lfutil.standin(f) for f in m._files]
       
   253         m._files.extend(standins)
       
   254         m._fmap = set(m._files)
       
   255         origmatchfn = m.matchfn
       
   256         def lfmatchfn(f):
       
   257             lf = lfutil.splitstandin(f)
       
   258             if lf is not None and origmatchfn(lf):
       
   259                 return True
       
   260             r = origmatchfn(f)
       
   261             return r
       
   262         m.matchfn = lfmatchfn
       
   263         return m
       
   264     oldmatch = installmatchfn(overridematch)
   243     try:
   265     try:
   244         repo.lfstatus = True
   266         repo.lfstatus = True
   245         return orig(ui, repo, *pats, **opts)
   267         return orig(ui, repo, *pats, **opts)
   246     finally:
   268     finally:
   247         repo.lfstatus = False
   269         repo.lfstatus = False
       
   270         restorematchfn()
   248 
   271 
   249 def overrideverify(orig, ui, repo, *pats, **opts):
   272 def overrideverify(orig, ui, repo, *pats, **opts):
   250     large = opts.pop('large', False)
   273     large = opts.pop('large', False)
   251     all = opts.pop('lfa', False)
   274     all = opts.pop('lfa', False)
   252     contents = opts.pop('lfc', False)
   275     contents = opts.pop('lfc', False)