mercurial/scmutil.py
branchstable
changeset 35035 96dcc78468e3
parent 35009 99ab7bc944d2
child 35177 9700cb9df140
equal deleted inserted replaced
35034:02845f7441af 35035:96dcc78468e3
  1231 
  1231 
  1232     categories = []
  1232     categories = []
  1233 
  1233 
  1234     def reportsummary(func):
  1234     def reportsummary(func):
  1235         """decorator for report callbacks."""
  1235         """decorator for report callbacks."""
  1236         reporef = weakref.ref(repo)
  1236         # The repoview life cycle is shorter than the one of the actual
       
  1237         # underlying repository. So the filtered object can die before the
       
  1238         # weakref is used leading to troubles. We keep a reference to the
       
  1239         # unfiltered object and restore the filtering when retrieving the
       
  1240         # repository through the weakref.
       
  1241         filtername = repo.filtername
       
  1242         reporef = weakref.ref(repo.unfiltered())
  1237         def wrapped(tr):
  1243         def wrapped(tr):
  1238             repo = reporef()
  1244             repo = reporef()
       
  1245             if filtername:
       
  1246                 repo = repo.filtered(filtername)
  1239             func(repo, tr)
  1247             func(repo, tr)
  1240         newcat = '%2i-txnreport' % len(categories)
  1248         newcat = '%2i-txnreport' % len(categories)
  1241         otr.addpostclose(newcat, wrapped)
  1249         otr.addpostclose(newcat, wrapped)
  1242         categories.append(newcat)
  1250         categories.append(newcat)
  1243         return wrapped
  1251         return wrapped