mercurial/scmutil.py
changeset 33541 b47fef6d2365
parent 33511 9689239d7c2b
child 33542 b11e8c67fb0f
equal deleted inserted replaced
33540:e07c5740eaaa 33541:b47fef6d2365
  1078                 raise error.ProgrammingError(e)
  1078                 raise error.ProgrammingError(e)
  1079             lines.append("%s=%s\n" % (k, v))
  1079             lines.append("%s=%s\n" % (k, v))
  1080         with self.vfs(self.path, mode='wb', atomictemp=True) as fp:
  1080         with self.vfs(self.path, mode='wb', atomictemp=True) as fp:
  1081             fp.write(''.join(lines))
  1081             fp.write(''.join(lines))
  1082 
  1082 
  1083 def registersummarycallback(repo, otr):
  1083 _reportobsoletedsource = [
       
  1084     'pull',
       
  1085     'push',
       
  1086     'serve',
       
  1087     'unbundle',
       
  1088 ]
       
  1089 
       
  1090 def registersummarycallback(repo, otr, txnname=''):
  1084     """register a callback to issue a summary after the transaction is closed
  1091     """register a callback to issue a summary after the transaction is closed
  1085     """
  1092     """
  1086     reporef = weakref.ref(repo)
  1093     for source in _reportobsoletedsource:
  1087     def reportsummary(tr):
  1094         if txnname.startswith(source):
  1088         """the actual callback reporting the summary"""
  1095             reporef = weakref.ref(repo)
  1089         repo = reporef()
  1096             def reportsummary(tr):
  1090         obsoleted = obsutil.getobsoleted(repo, tr)
  1097                 """the actual callback reporting the summary"""
  1091         if obsoleted:
  1098                 repo = reporef()
  1092             repo.ui.status(_('obsoleted %i changesets\n') % len(obsoleted))
  1099                 obsoleted = obsutil.getobsoleted(repo, tr)
  1093     otr.addpostclose('00-txnreport', reportsummary)
  1100                 if obsoleted:
       
  1101                     repo.ui.status(_('obsoleted %i changesets\n')
       
  1102                                    % len(obsoleted))
       
  1103             otr.addpostclose('00-txnreport', reportsummary)
       
  1104             break