##// END OF EJS Templates
merge-actions: add some information about the "changes" the action do...
marmoute -
r49564:7d073df4 default
parent child Browse files
Show More
@@ -98,6 +98,10 b" LEGACY_MERGE_DRIVER_STATE = b'm'"
98 # This record was release in 3.7 and usage was removed in 5.6
98 # This record was release in 3.7 and usage was removed in 5.6
99 LEGACY_MERGE_DRIVER_MERGE = b'D'
99 LEGACY_MERGE_DRIVER_MERGE = b'D'
100
100
101 CHANGE_ADDED = b'added'
102 CHANGE_REMOVED = b'removed'
103 CHANGE_MODIFIED = b'modified'
104
101
105
102 class MergeAction(object):
106 class MergeAction(object):
103 """represent an "action" merge need to take for a given file
107 """represent an "action" merge need to take for a given file
@@ -111,18 +115,29 b' class MergeAction(object):'
111 narrow_safe:
115 narrow_safe:
112 True if the action can be safely used for a file outside of the narrow
116 True if the action can be safely used for a file outside of the narrow
113 set
117 set
118
119 changes:
120 The types of changes that this actions involves. This is a work in
121 progress and not all actions have one yet. In addition, some requires
122 user changes and cannot be fully decided. The value currently available
123 are:
124
125 - ADDED: the files is new in both parents
126 - REMOVED: the files existed in one parent and is getting removed
127 - MODIFIED: the files existed in at least one parent and is getting changed
114 """
128 """
115
129
116 ALL_ACTIONS = weakref.WeakSet()
130 ALL_ACTIONS = weakref.WeakSet()
117 NO_OP_ACTIONS = weakref.WeakSet()
131 NO_OP_ACTIONS = weakref.WeakSet()
118
132
119 def __init__(self, short, no_op=False, narrow_safe=False):
133 def __init__(self, short, no_op=False, narrow_safe=False, changes=None):
120 self._short = short
134 self._short = short
121 self.ALL_ACTIONS.add(self)
135 self.ALL_ACTIONS.add(self)
122 self.no_op = no_op
136 self.no_op = no_op
123 if self.no_op:
137 if self.no_op:
124 self.NO_OP_ACTIONS.add(self)
138 self.NO_OP_ACTIONS.add(self)
125 self.narrow_safe = narrow_safe
139 self.narrow_safe = narrow_safe
140 self.changes = changes
126
141
127 def __hash__(self):
142 def __hash__(self):
128 return hash(self._short)
143 return hash(self._short)
@@ -143,14 +158,16 b' class MergeAction(object):'
143 return self._short < other._short
158 return self._short < other._short
144
159
145
160
146 ACTION_FORGET = MergeAction(b'f', narrow_safe=True)
161 ACTION_FORGET = MergeAction(b'f', narrow_safe=True, changes=CHANGE_REMOVED)
147 ACTION_REMOVE = MergeAction(b'r', narrow_safe=True)
162 ACTION_REMOVE = MergeAction(b'r', narrow_safe=True, changes=CHANGE_REMOVED)
148 ACTION_ADD = MergeAction(b'a', narrow_safe=True)
163 ACTION_ADD = MergeAction(b'a', narrow_safe=True, changes=CHANGE_ADDED)
149 ACTION_GET = MergeAction(b'g', narrow_safe=True)
164 ACTION_GET = MergeAction(b'g', narrow_safe=True, changes=CHANGE_MODIFIED)
150 ACTION_PATH_CONFLICT = MergeAction(b'p')
165 ACTION_PATH_CONFLICT = MergeAction(b'p')
151 ACTION_PATH_CONFLICT_RESOLVE = MergeAction('pr')
166 ACTION_PATH_CONFLICT_RESOLVE = MergeAction('pr')
152 ACTION_ADD_MODIFIED = MergeAction(b'am', narrow_safe=True)
167 ACTION_ADD_MODIFIED = MergeAction(
153 ACTION_CREATED = MergeAction(b'c', narrow_safe=True)
168 b'am', narrow_safe=True, changes=CHANGE_ADDED
169 ) # not 100% about the changes value here
170 ACTION_CREATED = MergeAction(b'c', narrow_safe=True, changes=CHANGE_ADDED)
154 ACTION_DELETED_CHANGED = MergeAction(b'dc')
171 ACTION_DELETED_CHANGED = MergeAction(b'dc')
155 ACTION_CHANGED_DELETED = MergeAction(b'cd')
172 ACTION_CHANGED_DELETED = MergeAction(b'cd')
156 ACTION_MERGE = MergeAction(b'm')
173 ACTION_MERGE = MergeAction(b'm')
@@ -164,8 +181,10 b" ACTION_KEEP_ABSENT = MergeAction(b'ka', "
164 # the file is absent on the ancestor and remote side of the merge
181 # the file is absent on the ancestor and remote side of the merge
165 # hence this file is new and we should keep it
182 # hence this file is new and we should keep it
166 ACTION_KEEP_NEW = MergeAction(b'kn', no_op=True)
183 ACTION_KEEP_NEW = MergeAction(b'kn', no_op=True)
167 ACTION_EXEC = MergeAction(b'e', narrow_safe=True)
184 ACTION_EXEC = MergeAction(b'e', narrow_safe=True, changes=CHANGE_MODIFIED)
168 ACTION_CREATED_MERGE = MergeAction(b'cm', narrow_safe=True)
185 ACTION_CREATED_MERGE = MergeAction(
186 b'cm', narrow_safe=True, changes=CHANGE_ADDED
187 )
169
188
170
189
171 # Used by concert to detect situation it does not like, not sure what the exact
190 # Used by concert to detect situation it does not like, not sure what the exact
General Comments 0
You need to be logged in to leave comments. Login now