comparison mercurial/mergestate.py @ 48712:773ad0f5152d

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
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 28 Jan 2022 19:46:37 +0100
parents 9bc86adf32f6
children 5dfaca4464d1
comparison
equal deleted inserted replaced
48711:9bc86adf32f6 48712:773ad0f5152d
2 2
3 import collections 3 import collections
4 import errno 4 import errno
5 import shutil 5 import shutil
6 import struct 6 import struct
7 import weakref
7 8
8 from .i18n import _ 9 from .i18n import _
9 from .node import ( 10 from .node import (
10 bin, 11 bin,
11 hex, 12 hex,
104 Attributes: 105 Attributes:
105 106
106 _short: internal representation used to identify each action 107 _short: internal representation used to identify each action
107 """ 108 """
108 109
110 ALL_ACTIONS = weakref.WeakSet()
111
109 def __init__(self, short): 112 def __init__(self, short):
110 self._short = short 113 self._short = short
114 self.ALL_ACTIONS.add(self)
111 115
112 def __hash__(self): 116 def __hash__(self):
113 return hash(self._short) 117 return hash(self._short)
114 118
115 def __repr__(self): 119 def __repr__(self):