405 createdfiledirs = set() |
405 createdfiledirs = set() |
406 |
406 |
407 # The set of files deleted by all the actions. |
407 # The set of files deleted by all the actions. |
408 deletedfiles = set() |
408 deletedfiles = set() |
409 |
409 |
410 for f, (m, args, msg) in actions.items(): |
410 for f, (m, args, msg) in mresult.actions.items(): |
411 if m in ( |
411 if m in ( |
412 mergestatemod.ACTION_CREATED, |
412 mergestatemod.ACTION_CREATED, |
413 mergestatemod.ACTION_DELETED_CHANGED, |
413 mergestatemod.ACTION_DELETED_CHANGED, |
414 mergestatemod.ACTION_MERGE, |
414 mergestatemod.ACTION_MERGE, |
415 mergestatemod.ACTION_CREATED_MERGE, |
415 mergestatemod.ACTION_CREATED_MERGE, |
442 invalidconflicts.add(p) |
442 invalidconflicts.add(p) |
443 else: |
443 else: |
444 # A file is in a directory which aliases a local file. |
444 # A file is in a directory which aliases a local file. |
445 # We will need to rename the local file. |
445 # We will need to rename the local file. |
446 localconflicts.add(p) |
446 localconflicts.add(p) |
447 if p in actions and actions[p][0] in ( |
447 if p in mresult.actions and mresult.actions[p][0] in ( |
448 mergestatemod.ACTION_CREATED, |
448 mergestatemod.ACTION_CREATED, |
449 mergestatemod.ACTION_DELETED_CHANGED, |
449 mergestatemod.ACTION_DELETED_CHANGED, |
450 mergestatemod.ACTION_MERGE, |
450 mergestatemod.ACTION_MERGE, |
451 mergestatemod.ACTION_CREATED_MERGE, |
451 mergestatemod.ACTION_CREATED_MERGE, |
452 ): |
452 ): |
457 |
457 |
458 # Rename all local conflicting files that have not been deleted. |
458 # Rename all local conflicting files that have not been deleted. |
459 for p in localconflicts: |
459 for p in localconflicts: |
460 if p not in deletedfiles: |
460 if p not in deletedfiles: |
461 ctxname = bytes(wctx).rstrip(b'+') |
461 ctxname = bytes(wctx).rstrip(b'+') |
462 pnew = util.safename(p, ctxname, wctx, set(actions.keys())) |
462 pnew = util.safename(p, ctxname, wctx, set(mresult.actions.keys())) |
463 porig = wctx[p].copysource() or p |
463 porig = wctx[p].copysource() or p |
464 actions[pnew] = ( |
464 mresult.addfile( |
|
465 pnew, |
465 mergestatemod.ACTION_PATH_CONFLICT_RESOLVE, |
466 mergestatemod.ACTION_PATH_CONFLICT_RESOLVE, |
466 (p, porig), |
467 (p, porig), |
467 b'local path conflict', |
468 b'local path conflict', |
468 ) |
469 ) |
469 actions[p] = ( |
470 mresult.addfile( |
|
471 p, |
470 mergestatemod.ACTION_PATH_CONFLICT, |
472 mergestatemod.ACTION_PATH_CONFLICT, |
471 (pnew, b'l'), |
473 (pnew, b'l'), |
472 b'path conflict', |
474 b'path conflict', |
473 ) |
475 ) |
474 |
476 |
475 if remoteconflicts: |
477 if remoteconflicts: |
476 # Check if all files in the conflicting directories have been removed. |
478 # Check if all files in the conflicting directories have been removed. |
477 ctxname = bytes(mctx).rstrip(b'+') |
479 ctxname = bytes(mctx).rstrip(b'+') |
478 for f, p in _filesindirs(repo, mf, remoteconflicts): |
480 for f, p in _filesindirs(repo, mf, remoteconflicts): |
479 if f not in deletedfiles: |
481 if f not in deletedfiles: |
480 m, args, msg = actions[p] |
482 m, args, msg = mresult.actions[p] |
481 pnew = util.safename(p, ctxname, wctx, set(actions.keys())) |
483 pnew = util.safename( |
|
484 p, ctxname, wctx, set(mresult.actions.keys()) |
|
485 ) |
482 if m in ( |
486 if m in ( |
483 mergestatemod.ACTION_DELETED_CHANGED, |
487 mergestatemod.ACTION_DELETED_CHANGED, |
484 mergestatemod.ACTION_MERGE, |
488 mergestatemod.ACTION_MERGE, |
485 ): |
489 ): |
486 # Action was merge, just update target. |
490 # Action was merge, just update target. |
487 actions[pnew] = (m, args, msg) |
491 mresult.addfile(pnew, m, args, msg) |
488 else: |
492 else: |
489 # Action was create, change to renamed get action. |
493 # Action was create, change to renamed get action. |
490 fl = args[0] |
494 fl = args[0] |
491 actions[pnew] = ( |
495 mresult.addfile( |
|
496 pnew, |
492 mergestatemod.ACTION_LOCAL_DIR_RENAME_GET, |
497 mergestatemod.ACTION_LOCAL_DIR_RENAME_GET, |
493 (p, fl), |
498 (p, fl), |
494 b'remote path conflict', |
499 b'remote path conflict', |
495 ) |
500 ) |
496 actions[p] = ( |
501 mresult.addfile( |
|
502 p, |
497 mergestatemod.ACTION_PATH_CONFLICT, |
503 mergestatemod.ACTION_PATH_CONFLICT, |
498 (pnew, mergestatemod.ACTION_REMOVE), |
504 (pnew, mergestatemod.ACTION_REMOVE), |
499 b'path conflict', |
505 b'path conflict', |
500 ) |
506 ) |
501 remoteconflicts.remove(p) |
507 remoteconflicts.remove(p) |
937 b'prompt deleted/changed', |
943 b'prompt deleted/changed', |
938 ) |
944 ) |
939 |
945 |
940 if repo.ui.configbool(b'experimental', b'merge.checkpathconflicts'): |
946 if repo.ui.configbool(b'experimental', b'merge.checkpathconflicts'): |
941 # If we are merging, look for path conflicts. |
947 # If we are merging, look for path conflicts. |
942 checkpathconflicts(repo, wctx, p2, mresult.actions) |
948 checkpathconflicts(repo, wctx, p2, mresult) |
943 |
949 |
944 narrowmatch = repo.narrowmatch() |
950 narrowmatch = repo.narrowmatch() |
945 if not narrowmatch.always(): |
951 if not narrowmatch.always(): |
946 # Updates "actions" in place |
952 # Updates "actions" in place |
947 _filternarrowactions(narrowmatch, branchmerge, mresult.actions) |
953 _filternarrowactions(narrowmatch, branchmerge, mresult.actions) |