D7833: transaction: allow finalizer to add finalizer

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Thu Jan 16 14:20:21 EST 2020


Closed by commit rHG2f1d6180737f: transaction: allow finalizer to add finalizer (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7833?vs=19153&id=19378

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7833/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7833

AFFECTED FILES
  mercurial/transaction.py

CHANGE DETAILS

diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -506,9 +506,12 @@
             self._validator(self)  # will raise exception if needed
             self._validator = None  # Help prevent cycles.
             self._generatefiles(group=gengroupprefinalize)
-            categories = sorted(self._finalizecallback)
-            for cat in categories:
-                self._finalizecallback[cat](self)
+            while self._finalizecallback:
+                callbacks = self._finalizecallback
+                self._finalizecallback = {}
+                categories = sorted(callbacks)
+                for cat in categories:
+                    callbacks[cat](self)
             # Prevent double usage and help clear cycles.
             self._finalizecallback = None
             self._generatefiles(group=gengrouppostfinalize)



To: marmoute, #hg-reviewers, martinvonz
Cc: martinvonz, mercurial-devel


More information about the Mercurial-devel mailing list