544 ''''An object representing result of merging manifests. |
544 ''''An object representing result of merging manifests. |
545 |
545 |
546 It has information about what actions need to be performed on dirstate |
546 It has information about what actions need to be performed on dirstate |
547 mapping of divergent renames and other such cases. ''' |
547 mapping of divergent renames and other such cases. ''' |
548 |
548 |
549 def __init__(self, actions, diverge, renamedelete): |
549 def __init__(self, actions, diverge, renamedelete, commitinfo): |
550 """ |
550 """ |
551 actions: dict of filename as keys and action related info as values |
551 actions: dict of filename as keys and action related info as values |
552 diverge: mapping of source name -> list of dest name for |
552 diverge: mapping of source name -> list of dest name for |
553 divergent renames |
553 divergent renames |
554 renamedelete: mapping of source name -> list of destinations for files |
554 renamedelete: mapping of source name -> list of destinations for files |
555 deleted on one side and renamed on other. |
555 deleted on one side and renamed on other. |
|
556 commitinfo: dict containing data which should be used on commit |
|
557 contains a filename -> info mapping |
556 """ |
558 """ |
557 |
559 |
558 self._actions = actions |
560 self._actions = actions |
559 self._diverge = diverge |
561 self._diverge = diverge |
560 self._renamedelete = renamedelete |
562 self._renamedelete = renamedelete |
|
563 self._commitinfo = commitinfo |
561 |
564 |
562 @property |
565 @property |
563 def actions(self): |
566 def actions(self): |
564 return self._actions |
567 return self._actions |
565 |
568 |
568 return self._diverge |
571 return self._diverge |
569 |
572 |
570 @property |
573 @property |
571 def renamedelete(self): |
574 def renamedelete(self): |
572 return self._renamedelete |
575 return self._renamedelete |
|
576 |
|
577 @property |
|
578 def commitinfo(self): |
|
579 return self._commitinfo |
573 |
580 |
574 def setactions(self, actions): |
581 def setactions(self, actions): |
575 self._actions = actions |
582 self._actions = actions |
576 |
583 |
577 |
584 |
606 ] |
613 ] |
607 |
614 |
608 branch_copies1 = copies.branch_copies() |
615 branch_copies1 = copies.branch_copies() |
609 branch_copies2 = copies.branch_copies() |
616 branch_copies2 = copies.branch_copies() |
610 diverge = {} |
617 diverge = {} |
|
618 # information from merge which is needed at commit time |
|
619 # for example choosing filelog of which parent to commit |
|
620 # TODO: use specific constants in future for this mapping |
|
621 commitinfo = {} |
611 if followcopies: |
622 if followcopies: |
612 branch_copies1, branch_copies2, diverge = copies.mergecopies( |
623 branch_copies1, branch_copies2, diverge = copies.mergecopies( |
613 repo, wctx, p2, pa |
624 repo, wctx, p2, pa |
614 ) |
625 ) |
615 |
626 |
699 if branchmerge |
710 if branchmerge |
700 else mergestatemod.ACTION_GET, |
711 else mergestatemod.ACTION_GET, |
701 (fl2, False), |
712 (fl2, False), |
702 b'remote is newer', |
713 b'remote is newer', |
703 ) |
714 ) |
|
715 if branchmerge: |
|
716 commitinfo[f] = b'other' |
704 elif nol and n2 == a: # remote only changed 'x' |
717 elif nol and n2 == a: # remote only changed 'x' |
705 actions[f] = ( |
718 actions[f] = ( |
706 mergestatemod.ACTION_EXEC, |
719 mergestatemod.ACTION_EXEC, |
707 (fl2,), |
720 (fl2,), |
708 b'update permissions', |
721 b'update permissions', |
713 if branchmerge |
726 if branchmerge |
714 else mergestatemod.ACTION_GET, |
727 else mergestatemod.ACTION_GET, |
715 (fl1, False), |
728 (fl1, False), |
716 b'remote is newer', |
729 b'remote is newer', |
717 ) |
730 ) |
|
731 if branchmerge: |
|
732 commitinfo[f] = b'other' |
718 else: # both changed something |
733 else: # both changed something |
719 actions[f] = ( |
734 actions[f] = ( |
720 mergestatemod.ACTION_MERGE, |
735 mergestatemod.ACTION_MERGE, |
721 (f, f, f, False, pa.node()), |
736 (f, f, f, False, pa.node()), |
722 b'versions differ', |
737 b'versions differ', |
873 _filternarrowactions(narrowmatch, branchmerge, actions) |
888 _filternarrowactions(narrowmatch, branchmerge, actions) |
874 |
889 |
875 renamedelete = branch_copies1.renamedelete |
890 renamedelete = branch_copies1.renamedelete |
876 renamedelete.update(branch_copies2.renamedelete) |
891 renamedelete.update(branch_copies2.renamedelete) |
877 |
892 |
878 return mergeresult(actions, diverge, renamedelete) |
893 return mergeresult(actions, diverge, renamedelete, commitinfo) |
879 |
894 |
880 |
895 |
881 def _resolvetrivial(repo, wctx, mctx, ancestor, actions): |
896 def _resolvetrivial(repo, wctx, mctx, ancestor, actions): |
882 """Resolves false conflicts where the nodeid changed but the content |
897 """Resolves false conflicts where the nodeid changed but the content |
883 remained the same.""" |
898 remained the same.""" |
1032 _(b' %s: ambiguous merge - picked %s action\n') % (f, m) |
1047 _(b' %s: ambiguous merge - picked %s action\n') % (f, m) |
1033 ) |
1048 ) |
1034 actions[f] = l[0] |
1049 actions[f] = l[0] |
1035 continue |
1050 continue |
1036 repo.ui.note(_(b'end of auction\n\n')) |
1051 repo.ui.note(_(b'end of auction\n\n')) |
1037 mresult = mergeresult(actions, diverge, renamedelete) |
1052 # TODO: think about commitinfo when bid merge is used |
|
1053 mresult = mergeresult(actions, diverge, renamedelete, {}) |
1038 |
1054 |
1039 if wctx.rev() is None: |
1055 if wctx.rev() is None: |
1040 fractions = _forgetremoved(wctx, mctx, branchmerge) |
1056 fractions = _forgetremoved(wctx, mctx, branchmerge) |
1041 mresult.actions.update(fractions) |
1057 mresult.actions.update(fractions) |
1042 |
1058 |