merge-actions: gather all created action into a set
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 28 Jan 2022 19:46:37 +0100
changeset 48712 773ad0f5152d
parent 48711 9bc86adf32f6
child 48713 5dfaca4464d1
merge-actions: gather all created action into a set This is mostly to demonstrate we can do this before we start adding more specialized set. Differential Revision: https://phab.mercurial-scm.org/D12115
mercurial/mergestate.py
--- a/mercurial/mergestate.py	Fri Jan 28 17:08:30 2022 +0100
+++ b/mercurial/mergestate.py	Fri Jan 28 19:46:37 2022 +0100
@@ -4,6 +4,7 @@
 import errno
 import shutil
 import struct
+import weakref
 
 from .i18n import _
 from .node import (
@@ -106,8 +107,11 @@
     _short: internal representation used to identify each action
     """
 
+    ALL_ACTIONS = weakref.WeakSet()
+
     def __init__(self, short):
         self._short = short
+        self.ALL_ACTIONS.add(self)
 
     def __hash__(self):
         return hash(self._short)