Patchwork D7833: transaction: allow finalizer to add finalizer

login
register
mail settings
Submitter phabricator
Date Jan. 16, 2020, 7:20 p.m.
Message ID <ca69f81ae17e4f6b856919caa4445670@localhost.localdomain>
Download mbox | patch
Permalink /patch/44450/
State Not Applicable
Headers show

Comments

phabricator - Jan. 16, 2020, 7:20 p.m.
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




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

Patch

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)