mercurial/scmutil.py
changeset 34619 18309380fb88
parent 34543 6fad8059a970
child 34620 b799f11644d8
--- a/mercurial/scmutil.py	Wed Oct 11 05:23:45 2017 +0200
+++ b/mercurial/scmutil.py	Sun Oct 01 09:52:44 2017 +0200
@@ -1203,15 +1203,16 @@
 def registersummarycallback(repo, otr, txnname=''):
     """register a callback to issue a summary after the transaction is closed
     """
-    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
+    def txmatch(sources):
+        return any(txnname.startswith(source) for source in sources)
+
+    if txmatch(_reportobsoletedsource):
+        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)