##// 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 161 phases,
162 162 pushkey,
163 163 pycompat,
164 scmutil,
165 164 tags,
166 165 url,
167 166 util,
@@ -1814,7 +1813,6 b' def handleobsmarker(op, inpart):'
1814 1813 if new:
1815 1814 op.repo.ui.status(_('%i new obsolescence markers\n') % new)
1816 1815 op.records.add('obsmarkers', {'new': new})
1817 scmutil.registersummarycallback(op.repo, tr)
1818 1816 if op.reply is not None:
1819 1817 rpart = op.reply.newpart('reply:obsmarkers')
1820 1818 rpart.addparam('in-reply-to', str(inpart.id), mandatory=False)
@@ -1099,6 +1099,7 b' class localrepository(object):'
1099 1099 raise error.ProgrammingError('transaction requires locking')
1100 1100 tr = self.currenttransaction()
1101 1101 if tr is not None:
1102 scmutil.registersummarycallback(self, tr, desc)
1102 1103 return tr.nest()
1103 1104
1104 1105 # abort here if the journal already exists
@@ -1255,6 +1256,7 b' class localrepository(object):'
1255 1256 # to stored data if transaction has no error.
1256 1257 tr.addpostclose('refresh-filecachestats', self._refreshfilecachestats)
1257 1258 self._transref = weakref.ref(tr)
1259 scmutil.registersummarycallback(self, tr, desc)
1258 1260 return tr
1259 1261
1260 1262 def _journalfiles(self):
@@ -1080,14 +1080,25 b' class simplekeyvaluefile(object):'
1080 1080 with self.vfs(self.path, mode='wb', atomictemp=True) as fp:
1081 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 1091 """register a callback to issue a summary after the transaction is closed
1085 1092 """
1093 for source in _reportobsoletedsource:
1094 if txnname.startswith(source):
1086 1095 reporef = weakref.ref(repo)
1087 1096 def reportsummary(tr):
1088 1097 """the actual callback reporting the summary"""
1089 1098 repo = reporef()
1090 1099 obsoleted = obsutil.getobsoleted(repo, tr)
1091 1100 if obsoleted:
1092 repo.ui.status(_('obsoleted %i changesets\n') % len(obsoleted))
1101 repo.ui.status(_('obsoleted %i changesets\n')
1102 % len(obsoleted))
1093 1103 otr.addpostclose('00-txnreport', reportsummary)
1104 break
General Comments 0
You need to be logged in to leave comments. Login now