##// END OF EJS Templates
merge-actions: have an attribute for narrow safetiness...
marmoute -
r49563:c5f05c0d default
parent child Browse files
Show More
@@ -509,17 +509,6 b' def _filternarrowactions(narrowmatch, br'
509 509 Raise an exception if the merge cannot be completed because the repo is
510 510 narrowed.
511 511 """
512 # TODO: handle with nonconflicttypes
513 nonconflicttypes = {
514 mergestatemod.ACTION_ADD,
515 mergestatemod.ACTION_ADD_MODIFIED,
516 mergestatemod.ACTION_CREATED,
517 mergestatemod.ACTION_CREATED_MERGE,
518 mergestatemod.ACTION_FORGET,
519 mergestatemod.ACTION_GET,
520 mergestatemod.ACTION_REMOVE,
521 mergestatemod.ACTION_EXEC,
522 }
523 512 # We mutate the items in the dict during iteration, so iterate
524 513 # over a copy.
525 514 for f, action in mresult.filemap():
@@ -529,7 +518,7 b' def _filternarrowactions(narrowmatch, br'
529 518 mresult.removefile(f) # just updating, ignore changes outside clone
530 519 elif action[0].no_op:
531 520 mresult.removefile(f) # merge does not affect file
532 elif action[0] in nonconflicttypes:
521 elif action[0].narrow_safe: # TODO: handle these cases
533 522 msg = _(
534 523 b'merge affects file \'%s\' outside narrow, '
535 524 b'which is not yet supported'
@@ -107,17 +107,22 b' class MergeAction(object):'
107 107 _short: internal representation used to identify each action
108 108
109 109 no_op: True if the action does affect the file content or tracking status
110
111 narrow_safe:
112 True if the action can be safely used for a file outside of the narrow
113 set
110 114 """
111 115
112 116 ALL_ACTIONS = weakref.WeakSet()
113 117 NO_OP_ACTIONS = weakref.WeakSet()
114 118
115 def __init__(self, short, no_op=False):
119 def __init__(self, short, no_op=False, narrow_safe=False):
116 120 self._short = short
117 121 self.ALL_ACTIONS.add(self)
118 122 self.no_op = no_op
119 123 if self.no_op:
120 124 self.NO_OP_ACTIONS.add(self)
125 self.narrow_safe = narrow_safe
121 126
122 127 def __hash__(self):
123 128 return hash(self._short)
@@ -138,14 +143,14 b' class MergeAction(object):'
138 143 return self._short < other._short
139 144
140 145
141 ACTION_FORGET = MergeAction(b'f')
142 ACTION_REMOVE = MergeAction(b'r')
143 ACTION_ADD = MergeAction(b'a')
144 ACTION_GET = MergeAction(b'g')
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)
145 150 ACTION_PATH_CONFLICT = MergeAction(b'p')
146 151 ACTION_PATH_CONFLICT_RESOLVE = MergeAction('pr')
147 ACTION_ADD_MODIFIED = MergeAction(b'am')
148 ACTION_CREATED = MergeAction(b'c')
152 ACTION_ADD_MODIFIED = MergeAction(b'am', narrow_safe=True)
153 ACTION_CREATED = MergeAction(b'c', narrow_safe=True)
149 154 ACTION_DELETED_CHANGED = MergeAction(b'dc')
150 155 ACTION_CHANGED_DELETED = MergeAction(b'cd')
151 156 ACTION_MERGE = MergeAction(b'm')
@@ -159,8 +164,8 b" ACTION_KEEP_ABSENT = MergeAction(b'ka', "
159 164 # the file is absent on the ancestor and remote side of the merge
160 165 # hence this file is new and we should keep it
161 166 ACTION_KEEP_NEW = MergeAction(b'kn', no_op=True)
162 ACTION_EXEC = MergeAction(b'e')
163 ACTION_CREATED_MERGE = MergeAction(b'cm')
167 ACTION_EXEC = MergeAction(b'e', narrow_safe=True)
168 ACTION_CREATED_MERGE = MergeAction(b'cm', narrow_safe=True)
164 169
165 170
166 171 # 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