comparison mercurial/merge.py @ 48716:f1eb77dceb36

narrow: allow merging non-conflicting change outside of the narrow spec We use the mergestate to carry information about these merge action and reprocess them at commit time to apply the necessary update. The dirstate itself is never affected and remains "pure", with content only in the narrow-spec. This file involved in such merge are therefor not listed in `hg status`. The current testing is based on a modification of the previous testing, that refused to do such merges. As a result it is a bit simple and more extensive code and testing testing will have to be introduced later. I am planning to do this extra testing, soon. In addition, this only works for flat manifest. Support for tree manifest will need more work. I am not currently planning to do this work. Differential Revision: https://phab.mercurial-scm.org/D12119
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 03 Feb 2022 18:14:11 +0100
parents c5f05c0d1c8c
children 18e69f224e4b
comparison
equal deleted inserted replaced
48715:7d073df49a54 48716:f1eb77dceb36
516 pass 516 pass
517 elif not branchmerge: 517 elif not branchmerge:
518 mresult.removefile(f) # just updating, ignore changes outside clone 518 mresult.removefile(f) # just updating, ignore changes outside clone
519 elif action[0].no_op: 519 elif action[0].no_op:
520 mresult.removefile(f) # merge does not affect file 520 mresult.removefile(f) # merge does not affect file
521 elif action[0].narrow_safe: # TODO: handle these cases 521 elif action[0].narrow_safe:
522 msg = _( 522 if (
523 b'merge affects file \'%s\' outside narrow, ' 523 not f.endswith(b'/')
524 b'which is not yet supported' 524 and action[0].changes == mergestatemod.CHANGE_MODIFIED
525 ) 525 ):
526 hint = _(b'merging in the other direction may work') 526 mresult.removefile(f) # merge won't affect on-disk files
527 raise error.Abort(msg % f, hint=hint) 527
528 mresult.addcommitinfo(
529 f, b'outside-narrow-merge-action', action[0].changes
530 )
531 else: # TODO: handle the tree case
532 msg = _(
533 b'merge affects file \'%s\' outside narrow, '
534 b'which is not yet supported'
535 )
536 hint = _(b'merging in the other direction may work')
537 raise error.Abort(msg % f, hint=hint)
528 else: 538 else:
529 msg = _(b'conflict in file \'%s\' is outside narrow clone') 539 msg = _(b'conflict in file \'%s\' is outside narrow clone')
530 raise error.StateError(msg % f) 540 raise error.StateError(msg % f)
531 541
532 542