comparison mercurial/merge.py @ 48727:5dfaca4464d1

merge-actions: add an explicite "no_op" attribute This make the MergeAction smarter and able to describe themself. This is useful to help introducing more MergeAction object that better the complexity of the situation. Differential Revision: https://phab.mercurial-scm.org/D12116
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 28 Jan 2022 15:19:58 +0100
parents 9bc86adf32f6
children c5f05c0d1c8c
comparison
equal deleted inserted replaced
48726:773ad0f5152d 48727:5dfaca4464d1
525 for f, action in mresult.filemap(): 525 for f, action in mresult.filemap():
526 if narrowmatch(f): 526 if narrowmatch(f):
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 = _(
534 b'merge affects file \'%s\' outside narrow, ' 534 b'merge affects file \'%s\' outside narrow, '
535 b'which is not yet supported' 535 b'which is not yet supported'
697 mergestatemod.ACTION_EXEC, 697 mergestatemod.ACTION_EXEC,
698 mergestatemod.ACTION_REMOVE, 698 mergestatemod.ACTION_REMOVE,
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
706 return False 706 return False
707 707
1518 for f, op in pycompat.iteritems(mresult.commitinfo): 1518 for f, op in pycompat.iteritems(mresult.commitinfo):
1519 # the other side of filenode was choosen while merging, store this in 1519 # the other side of filenode was choosen while merging, store this in
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 )
1527 1528
1528 if b'.hgsubstate' in mresult._actionmapping[mergestatemod.ACTION_REMOVE]: 1529 if b'.hgsubstate' in mresult._actionmapping[mergestatemod.ACTION_REMOVE]:
1622 ): 1623 ):
1623 repo.ui.debug(b" %s: %s -> am\n" % (f, msg)) 1624 repo.ui.debug(b" %s: %s -> am\n" % (f, msg))
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
1631 1632
1632 # directory rename, move local 1633 # directory rename, move local