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') |