##// END OF EJS Templates
merge-actions: add an explicite "no_op" attribute...
marmoute -
r49562:5dfaca44 default
parent child Browse files
Show More
@@ -527,7 +527,7 b' def _filternarrowactions(narrowmatch, br'
527 pass
527 pass
528 elif not branchmerge:
528 elif not branchmerge:
529 mresult.removefile(f) # just updating, ignore changes outside clone
529 mresult.removefile(f) # just updating, ignore changes outside clone
530 elif action[0] in mergestatemod.NO_OP_ACTIONS:
530 elif action[0].no_op:
531 mresult.removefile(f) # merge does not affect file
531 mresult.removefile(f) # merge does not affect file
532 elif action[0] in nonconflicttypes:
532 elif action[0] in nonconflicttypes:
533 msg = _(
533 msg = _(
@@ -699,7 +699,7 b' class mergeresult(object):'
699 mergestatemod.ACTION_PATH_CONFLICT_RESOLVE,
699 mergestatemod.ACTION_PATH_CONFLICT_RESOLVE,
700 )
700 )
701 and self._actionmapping[a]
701 and self._actionmapping[a]
702 and a not in mergestatemod.NO_OP_ACTIONS
702 and not a.no_op
703 ):
703 ):
704 return True
704 return True
705
705
@@ -1520,7 +1520,8 b' def applyupdates('
1520 # mergestate so that it can be reused on commit
1520 # mergestate so that it can be reused on commit
1521 ms.addcommitinfo(f, op)
1521 ms.addcommitinfo(f, op)
1522
1522
1523 numupdates = mresult.len() - mresult.len(mergestatemod.NO_OP_ACTIONS)
1523 num_no_op = mresult.len(mergestatemod.MergeAction.NO_OP_ACTIONS)
1524 numupdates = mresult.len() - num_no_op
1524 progress = repo.ui.makeprogress(
1525 progress = repo.ui.makeprogress(
1525 _(b'updating'), unit=_(b'files'), total=numupdates
1526 _(b'updating'), unit=_(b'files'), total=numupdates
1526 )
1527 )
@@ -1624,7 +1625,7 b' def applyupdates('
1624 progress.increment(item=f)
1625 progress.increment(item=f)
1625
1626
1626 # keep (noop, just log it)
1627 # keep (noop, just log it)
1627 for a in mergestatemod.NO_OP_ACTIONS:
1628 for a in mergestatemod.MergeAction.NO_OP_ACTIONS:
1628 for f, args, msg in mresult.getactions((a,), sort=True):
1629 for f, args, msg in mresult.getactions((a,), sort=True):
1629 repo.ui.debug(b" %s: %s -> %s\n" % (f, msg, a.__bytes__()))
1630 repo.ui.debug(b" %s: %s -> %s\n" % (f, msg, a.__bytes__()))
1630 # no progress
1631 # no progress
@@ -105,13 +105,19 b' class MergeAction(object):'
105 Attributes:
105 Attributes:
106
106
107 _short: internal representation used to identify each action
107 _short: internal representation used to identify each action
108
109 no_op: True if the action does affect the file content or tracking status
108 """
110 """
109
111
110 ALL_ACTIONS = weakref.WeakSet()
112 ALL_ACTIONS = weakref.WeakSet()
113 NO_OP_ACTIONS = weakref.WeakSet()
111
114
112 def __init__(self, short):
115 def __init__(self, short, no_op=False):
113 self._short = short
116 self._short = short
114 self.ALL_ACTIONS.add(self)
117 self.ALL_ACTIONS.add(self)
118 self.no_op = no_op
119 if self.no_op:
120 self.NO_OP_ACTIONS.add(self)
115
121
116 def __hash__(self):
122 def __hash__(self):
117 return hash(self._short)
123 return hash(self._short)
@@ -145,23 +151,17 b" ACTION_CHANGED_DELETED = MergeAction(b'c"
145 ACTION_MERGE = MergeAction(b'm')
151 ACTION_MERGE = MergeAction(b'm')
146 ACTION_LOCAL_DIR_RENAME_GET = MergeAction(b'dg')
152 ACTION_LOCAL_DIR_RENAME_GET = MergeAction(b'dg')
147 ACTION_DIR_RENAME_MOVE_LOCAL = MergeAction(b'dm')
153 ACTION_DIR_RENAME_MOVE_LOCAL = MergeAction(b'dm')
148 ACTION_KEEP = MergeAction(b'k')
154 ACTION_KEEP = MergeAction(b'k', no_op=True)
149 # the file was absent on local side before merge and we should
155 # the file was absent on local side before merge and we should
150 # keep it absent (absent means file not present, it can be a result
156 # keep it absent (absent means file not present, it can be a result
151 # of file deletion, rename etc.)
157 # of file deletion, rename etc.)
152 ACTION_KEEP_ABSENT = MergeAction(b'ka')
158 ACTION_KEEP_ABSENT = MergeAction(b'ka', no_op=True)
153 # the file is absent on the ancestor and remote side of the merge
159 # the file is absent on the ancestor and remote side of the merge
154 # hence this file is new and we should keep it
160 # hence this file is new and we should keep it
155 ACTION_KEEP_NEW = MergeAction(b'kn')
161 ACTION_KEEP_NEW = MergeAction(b'kn', no_op=True)
156 ACTION_EXEC = MergeAction(b'e')
162 ACTION_EXEC = MergeAction(b'e')
157 ACTION_CREATED_MERGE = MergeAction(b'cm')
163 ACTION_CREATED_MERGE = MergeAction(b'cm')
158
164
159 # actions which are no op
160 NO_OP_ACTIONS = (
161 ACTION_KEEP,
162 ACTION_KEEP_ABSENT,
163 ACTION_KEEP_NEW,
164 )
165
165
166 # Used by concert to detect situation it does not like, not sure what the exact
166 # Used by concert to detect situation it does not like, not sure what the exact
167 # criteria is
167 # criteria is
@@ -396,7 +396,7 b' def filterupdatesactions(repo, wctx, mct'
396 temporaryfiles.append(file)
396 temporaryfiles.append(file)
397 prunedactions[file] = action
397 prunedactions[file] = action
398 elif branchmerge:
398 elif branchmerge:
399 if type not in mergestatemod.NO_OP_ACTIONS:
399 if not type.no_op:
400 temporaryfiles.append(file)
400 temporaryfiles.append(file)
401 prunedactions[file] = action
401 prunedactions[file] = action
402 elif type == mergestatemod.ACTION_FORGET:
402 elif type == mergestatemod.ACTION_FORGET:
General Comments 0
You need to be logged in to leave comments. Login now