##// END OF EJS Templates
transaction-summary: display the summary for all transactions...
Boris Feld -
r33541:b47fef6d default
parent child Browse files
Show More
@@ -161,7 +161,6 b' from . import ('
161 phases,
161 phases,
162 pushkey,
162 pushkey,
163 pycompat,
163 pycompat,
164 scmutil,
165 tags,
164 tags,
166 url,
165 url,
167 util,
166 util,
@@ -1814,7 +1813,6 b' def handleobsmarker(op, inpart):'
1814 if new:
1813 if new:
1815 op.repo.ui.status(_('%i new obsolescence markers\n') % new)
1814 op.repo.ui.status(_('%i new obsolescence markers\n') % new)
1816 op.records.add('obsmarkers', {'new': new})
1815 op.records.add('obsmarkers', {'new': new})
1817 scmutil.registersummarycallback(op.repo, tr)
1818 if op.reply is not None:
1816 if op.reply is not None:
1819 rpart = op.reply.newpart('reply:obsmarkers')
1817 rpart = op.reply.newpart('reply:obsmarkers')
1820 rpart.addparam('in-reply-to', str(inpart.id), mandatory=False)
1818 rpart.addparam('in-reply-to', str(inpart.id), mandatory=False)
@@ -1099,6 +1099,7 b' class localrepository(object):'
1099 raise error.ProgrammingError('transaction requires locking')
1099 raise error.ProgrammingError('transaction requires locking')
1100 tr = self.currenttransaction()
1100 tr = self.currenttransaction()
1101 if tr is not None:
1101 if tr is not None:
1102 scmutil.registersummarycallback(self, tr, desc)
1102 return tr.nest()
1103 return tr.nest()
1103
1104
1104 # abort here if the journal already exists
1105 # abort here if the journal already exists
@@ -1255,6 +1256,7 b' class localrepository(object):'
1255 # to stored data if transaction has no error.
1256 # to stored data if transaction has no error.
1256 tr.addpostclose('refresh-filecachestats', self._refreshfilecachestats)
1257 tr.addpostclose('refresh-filecachestats', self._refreshfilecachestats)
1257 self._transref = weakref.ref(tr)
1258 self._transref = weakref.ref(tr)
1259 scmutil.registersummarycallback(self, tr, desc)
1258 return tr
1260 return tr
1259
1261
1260 def _journalfiles(self):
1262 def _journalfiles(self):
@@ -1080,14 +1080,25 b' class simplekeyvaluefile(object):'
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
General Comments 0
You need to be logged in to leave comments. Login now