##// 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 Raise an exception if the merge cannot be completed because the repo is
509 Raise an exception if the merge cannot be completed because the repo is
510 narrowed.
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 # We mutate the items in the dict during iteration, so iterate
512 # We mutate the items in the dict during iteration, so iterate
524 # over a copy.
513 # over a copy.
525 for f, action in mresult.filemap():
514 for f, action in mresult.filemap():
@@ -529,7 +518,7 b' def _filternarrowactions(narrowmatch, br'
529 mresult.removefile(f) # just updating, ignore changes outside clone
518 mresult.removefile(f) # just updating, ignore changes outside clone
530 elif action[0].no_op:
519 elif action[0].no_op:
531 mresult.removefile(f) # merge does not affect file
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 msg = _(
522 msg = _(
534 b'merge affects file \'%s\' outside narrow, '
523 b'merge affects file \'%s\' outside narrow, '
535 b'which is not yet supported'
524 b'which is not yet supported'
@@ -107,17 +107,22 b' class MergeAction(object):'
107 _short: internal representation used to identify each action
107 _short: internal representation used to identify each action
108
108
109 no_op: True if the action does affect the file content or tracking status
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 ALL_ACTIONS = weakref.WeakSet()
116 ALL_ACTIONS = weakref.WeakSet()
113 NO_OP_ACTIONS = weakref.WeakSet()
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 self._short = short
120 self._short = short
117 self.ALL_ACTIONS.add(self)
121 self.ALL_ACTIONS.add(self)
118 self.no_op = no_op
122 self.no_op = no_op
119 if self.no_op:
123 if self.no_op:
120 self.NO_OP_ACTIONS.add(self)
124 self.NO_OP_ACTIONS.add(self)
125 self.narrow_safe = narrow_safe
121
126
122 def __hash__(self):
127 def __hash__(self):
123 return hash(self._short)
128 return hash(self._short)
@@ -138,14 +143,14 b' class MergeAction(object):'
138 return self._short < other._short
143 return self._short < other._short
139
144
140
145
141 ACTION_FORGET = MergeAction(b'f')
146 ACTION_FORGET = MergeAction(b'f', narrow_safe=True)
142 ACTION_REMOVE = MergeAction(b'r')
147 ACTION_REMOVE = MergeAction(b'r', narrow_safe=True)
143 ACTION_ADD = MergeAction(b'a')
148 ACTION_ADD = MergeAction(b'a', narrow_safe=True)
144 ACTION_GET = MergeAction(b'g')
149 ACTION_GET = MergeAction(b'g', narrow_safe=True)
145 ACTION_PATH_CONFLICT = MergeAction(b'p')
150 ACTION_PATH_CONFLICT = MergeAction(b'p')
146 ACTION_PATH_CONFLICT_RESOLVE = MergeAction('pr')
151 ACTION_PATH_CONFLICT_RESOLVE = MergeAction('pr')
147 ACTION_ADD_MODIFIED = MergeAction(b'am')
152 ACTION_ADD_MODIFIED = MergeAction(b'am', narrow_safe=True)
148 ACTION_CREATED = MergeAction(b'c')
153 ACTION_CREATED = MergeAction(b'c', narrow_safe=True)
149 ACTION_DELETED_CHANGED = MergeAction(b'dc')
154 ACTION_DELETED_CHANGED = MergeAction(b'dc')
150 ACTION_CHANGED_DELETED = MergeAction(b'cd')
155 ACTION_CHANGED_DELETED = MergeAction(b'cd')
151 ACTION_MERGE = MergeAction(b'm')
156 ACTION_MERGE = MergeAction(b'm')
@@ -159,8 +164,8 b" ACTION_KEEP_ABSENT = MergeAction(b'ka', "
159 # the file is absent on the ancestor and remote side of the merge
164 # the file is absent on the ancestor and remote side of the merge
160 # hence this file is new and we should keep it
165 # hence this file is new and we should keep it
161 ACTION_KEEP_NEW = MergeAction(b'kn', no_op=True)
166 ACTION_KEEP_NEW = MergeAction(b'kn', no_op=True)
162 ACTION_EXEC = MergeAction(b'e')
167 ACTION_EXEC = MergeAction(b'e', narrow_safe=True)
163 ACTION_CREATED_MERGE = MergeAction(b'cm')
168 ACTION_CREATED_MERGE = MergeAction(b'cm', narrow_safe=True)
164
169
165
170
166 # Used by concert to detect situation it does not like, not sure what the exact
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