##// END OF EJS Templates
mergestate: define NO_OP_ACTION in module scope instead of inside mergeresult...
Pulkit Goyal -
r46096:590a840f default
parent child Browse files
Show More
@@ -526,7 +526,7 b' def _filternarrowactions(narrowmatch, br'
526 pass
526 pass
527 elif not branchmerge:
527 elif not branchmerge:
528 mresult.removefile(f) # just updating, ignore changes outside clone
528 mresult.removefile(f) # just updating, ignore changes outside clone
529 elif action[0] in mergeresult.NO_OP_ACTIONS:
529 elif action[0] in mergestatemod.NO_OP_ACTIONS:
530 mresult.removefile(f) # merge does not affect file
530 mresult.removefile(f) # merge does not affect file
531 elif action[0] in nonconflicttypes:
531 elif action[0] in nonconflicttypes:
532 raise error.Abort(
532 raise error.Abort(
@@ -549,12 +549,6 b' class mergeresult(object):'
549 It has information about what actions need to be performed on dirstate
549 It has information about what actions need to be performed on dirstate
550 mapping of divergent renames and other such cases. '''
550 mapping of divergent renames and other such cases. '''
551
551
552 NO_OP_ACTIONS = (
553 mergestatemod.ACTION_KEEP,
554 mergestatemod.ACTION_KEEP_ABSENT,
555 mergestatemod.ACTION_KEEP_NEW,
556 )
557
558 def __init__(self):
552 def __init__(self):
559 """
553 """
560 filemapping: dict of filename as keys and action related info as values
554 filemapping: dict of filename as keys and action related info as values
@@ -707,7 +701,7 b' class mergeresult(object):'
707 mergestatemod.ACTION_PATH_CONFLICT_RESOLVE,
701 mergestatemod.ACTION_PATH_CONFLICT_RESOLVE,
708 )
702 )
709 and self._actionmapping[a]
703 and self._actionmapping[a]
710 and a not in self.NO_OP_ACTIONS
704 and a not in mergestatemod.NO_OP_ACTIONS
711 ):
705 ):
712 return True
706 return True
713
707
@@ -1398,7 +1392,7 b' def applyupdates('
1398 # mergestate so that it can be reused on commit
1392 # mergestate so that it can be reused on commit
1399 ms.addcommitinfo(f, op)
1393 ms.addcommitinfo(f, op)
1400
1394
1401 numupdates = mresult.len() - mresult.len(mergeresult.NO_OP_ACTIONS)
1395 numupdates = mresult.len() - mresult.len(mergestatemod.NO_OP_ACTIONS)
1402 progress = repo.ui.makeprogress(
1396 progress = repo.ui.makeprogress(
1403 _(b'updating'), unit=_(b'files'), total=numupdates
1397 _(b'updating'), unit=_(b'files'), total=numupdates
1404 )
1398 )
@@ -1502,7 +1496,7 b' def applyupdates('
1502 progress.increment(item=f)
1496 progress.increment(item=f)
1503
1497
1504 # keep (noop, just log it)
1498 # keep (noop, just log it)
1505 for a in mergeresult.NO_OP_ACTIONS:
1499 for a in mergestatemod.NO_OP_ACTIONS:
1506 for f, args, msg in mresult.getactions((a,), sort=True):
1500 for f, args, msg in mresult.getactions((a,), sort=True):
1507 repo.ui.debug(b" %s: %s -> %s\n" % (f, msg, a))
1501 repo.ui.debug(b" %s: %s -> %s\n" % (f, msg, a))
1508 # no progress
1502 # no progress
@@ -123,6 +123,13 b" ACTION_KEEP_NEW = b'kn'"
123 ACTION_EXEC = b'e'
123 ACTION_EXEC = b'e'
124 ACTION_CREATED_MERGE = b'cm'
124 ACTION_CREATED_MERGE = b'cm'
125
125
126 # actions which are no op
127 NO_OP_ACTIONS = (
128 ACTION_KEEP,
129 ACTION_KEEP_ABSENT,
130 ACTION_KEEP_NEW,
131 )
132
126
133
127 class _mergestate_base(object):
134 class _mergestate_base(object):
128 '''track 3-way merge state of individual files
135 '''track 3-way merge state of individual files
@@ -399,7 +399,7 b' def filterupdatesactions(repo, wctx, mct'
399 temporaryfiles.append(file)
399 temporaryfiles.append(file)
400 prunedactions[file] = action
400 prunedactions[file] = action
401 elif branchmerge:
401 elif branchmerge:
402 if type not in mergemod.mergeresult.NO_OP_ACTIONS:
402 if type not in mergestatemod.NO_OP_ACTIONS:
403 temporaryfiles.append(file)
403 temporaryfiles.append(file)
404 prunedactions[file] = action
404 prunedactions[file] = action
405 elif type == mergestatemod.ACTION_FORGET:
405 elif type == mergestatemod.ACTION_FORGET:
General Comments 0
You need to be logged in to leave comments. Login now