Patchwork D12115: merge-actions: gather all created action into a set

login
register
mail settings
Submitter phabricator
Date Jan. 29, 2022, 2:15 p.m.
Message ID <differential-rev-PHID-DREV-6wtaaexmq27mtv37hjhy-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50440/
State New
Headers show

Comments

phabricator - Jan. 29, 2022, 2:15 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is mostly to demonstrate we can do this before we start adding more
  specialized set.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/mergestate.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py
--- a/mercurial/mergestate.py
+++ b/mercurial/mergestate.py
@@ -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)