diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -161,7 +161,6 @@ from . import ( phases, pushkey, pycompat, - scmutil, tags, url, util, @@ -1814,7 +1813,6 @@ def handleobsmarker(op, inpart): if new: op.repo.ui.status(_('%i new obsolescence markers\n') % new) op.records.add('obsmarkers', {'new': new}) - scmutil.registersummarycallback(op.repo, tr) if op.reply is not None: rpart = op.reply.newpart('reply:obsmarkers') rpart.addparam('in-reply-to', str(inpart.id), mandatory=False) diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1099,6 +1099,7 @@ class localrepository(object): raise error.ProgrammingError('transaction requires locking') tr = self.currenttransaction() if tr is not None: + scmutil.registersummarycallback(self, tr, desc) return tr.nest() # abort here if the journal already exists @@ -1255,6 +1256,7 @@ class localrepository(object): # to stored data if transaction has no error. tr.addpostclose('refresh-filecachestats', self._refreshfilecachestats) self._transref = weakref.ref(tr) + scmutil.registersummarycallback(self, tr, desc) return tr def _journalfiles(self): diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -1080,14 +1080,25 @@ class simplekeyvaluefile(object): with self.vfs(self.path, mode='wb', atomictemp=True) as fp: fp.write(''.join(lines)) -def registersummarycallback(repo, otr): +_reportobsoletedsource = [ + 'pull', + 'push', + 'serve', + 'unbundle', +] + +def registersummarycallback(repo, otr, txnname=''): """register a callback to issue a summary after the transaction is closed """ - reporef = weakref.ref(repo) - def reportsummary(tr): - """the actual callback reporting the summary""" - repo = reporef() - obsoleted = obsutil.getobsoleted(repo, tr) - if obsoleted: - repo.ui.status(_('obsoleted %i changesets\n') % len(obsoleted)) - otr.addpostclose('00-txnreport', reportsummary) + for source in _reportobsoletedsource: + if txnname.startswith(source): + reporef = weakref.ref(repo) + def reportsummary(tr): + """the actual callback reporting the summary""" + repo = reporef() + obsoleted = obsutil.getobsoleted(repo, tr) + if obsoleted: + repo.ui.status(_('obsoleted %i changesets\n') + % len(obsoleted)) + otr.addpostclose('00-txnreport', reportsummary) + break