##// 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 98 # This record was release in 3.7 and usage was removed in 5.6
99 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 106 class MergeAction(object):
103 107 """represent an "action" merge need to take for a given file
@@ -111,18 +115,29 b' class MergeAction(object):'
111 115 narrow_safe:
112 116 True if the action can be safely used for a file outside of the narrow
113 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 130 ALL_ACTIONS = weakref.WeakSet()
117 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 134 self._short = short
121 135 self.ALL_ACTIONS.add(self)
122 136 self.no_op = no_op
123 137 if self.no_op:
124 138 self.NO_OP_ACTIONS.add(self)
125 139 self.narrow_safe = narrow_safe
140 self.changes = changes
126 141
127 142 def __hash__(self):
128 143 return hash(self._short)
@@ -143,14 +158,16 b' class MergeAction(object):'
143 158 return self._short < other._short
144 159
145 160
146 ACTION_FORGET = MergeAction(b'f', narrow_safe=True)
147 ACTION_REMOVE = MergeAction(b'r', narrow_safe=True)
148 ACTION_ADD = MergeAction(b'a', narrow_safe=True)
149 ACTION_GET = MergeAction(b'g', narrow_safe=True)
161 ACTION_FORGET = MergeAction(b'f', narrow_safe=True, changes=CHANGE_REMOVED)
162 ACTION_REMOVE = MergeAction(b'r', narrow_safe=True, changes=CHANGE_REMOVED)
163 ACTION_ADD = MergeAction(b'a', narrow_safe=True, changes=CHANGE_ADDED)
164 ACTION_GET = MergeAction(b'g', narrow_safe=True, changes=CHANGE_MODIFIED)
150 165 ACTION_PATH_CONFLICT = MergeAction(b'p')
151 166 ACTION_PATH_CONFLICT_RESOLVE = MergeAction('pr')
152 ACTION_ADD_MODIFIED = MergeAction(b'am', narrow_safe=True)
153 ACTION_CREATED = MergeAction(b'c', narrow_safe=True)
167 ACTION_ADD_MODIFIED = MergeAction(
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 171 ACTION_DELETED_CHANGED = MergeAction(b'dc')
155 172 ACTION_CHANGED_DELETED = MergeAction(b'cd')
156 173 ACTION_MERGE = MergeAction(b'm')
@@ -164,8 +181,10 b" ACTION_KEEP_ABSENT = MergeAction(b'ka', "
164 181 # the file is absent on the ancestor and remote side of the merge
165 182 # hence this file is new and we should keep it
166 183 ACTION_KEEP_NEW = MergeAction(b'kn', no_op=True)
167 ACTION_EXEC = MergeAction(b'e', narrow_safe=True)
168 ACTION_CREATED_MERGE = MergeAction(b'cm', narrow_safe=True)
184 ACTION_EXEC = MergeAction(b'e', narrow_safe=True, changes=CHANGE_MODIFIED)
185 ACTION_CREATED_MERGE = MergeAction(
186 b'cm', narrow_safe=True, changes=CHANGE_ADDED
187 )
169 188
170 189
171 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