mercurial/scmutil.py
changeset 33541 b47fef6d2365
parent 33511 9689239d7c2b
child 33542 b11e8c67fb0f
--- a/mercurial/scmutil.py	Sun Jul 16 02:38:14 2017 +0200
+++ b/mercurial/scmutil.py	Sun Jul 16 02:20:06 2017 +0200
@@ -1080,14 +1080,25 @@
         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