Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/merge.py @ 48728:c5f05c0d1c8c
merge-actions: have an attribute for narrow safetiness
This allow the core doing narrow filtering to process action without
explicitely listing all possible actions. This is important to make the actions
system more flexible in the future.
Differential Revision: https://phab.mercurial-scm.org/D12117
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 29 Jan 2022 06:21:32 +0100 |
parents | 5dfaca4464d1 |
children | f1eb77dceb36 |
comparison
equal
deleted
inserted
replaced
48727:5dfaca4464d1 | 48728:c5f05c0d1c8c |
---|---|
507 Filters out actions that can ignored because the repo is narrowed. | 507 Filters out actions that can ignored because the repo is narrowed. |
508 | 508 |
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(): |
526 if narrowmatch(f): | 515 if narrowmatch(f): |
527 pass | 516 pass |
528 elif not branchmerge: | 517 elif not branchmerge: |
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' |
536 ) | 525 ) |
537 hint = _(b'merging in the other direction may work') | 526 hint = _(b'merging in the other direction may work') |