##// END OF EJS Templates
merge: introduce 'commitinfo' in mergeresult...
Pulkit Goyal -
r45832:8e8d5139 default
parent child Browse files
Show More
@@ -217,6 +217,7 b' class mercurial_sink(common.converter_si'
217 """
217 """
218 anc = [p1ctx.ancestor(p2ctx)]
218 anc = [p1ctx.ancestor(p2ctx)]
219 # Calculate what files are coming from p2
219 # Calculate what files are coming from p2
220 # TODO: mresult.commitinfo might be able to get that info
220 mresult = mergemod.calculateupdates(
221 mresult = mergemod.calculateupdates(
221 self.repo,
222 self.repo,
222 p1ctx,
223 p1ctx,
@@ -546,18 +546,21 b' class mergeresult(object):'
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):
@@ -571,6 +574,10 b' class mergeresult(object):'
571 def renamedelete(self):
574 def renamedelete(self):
572 return self._renamedelete
575 return self._renamedelete
573
576
577 @property
578 def commitinfo(self):
579 return self._commitinfo
580
574 def setactions(self, actions):
581 def setactions(self, actions):
575 self._actions = actions
582 self._actions = actions
576
583
@@ -608,6 +615,10 b' def manifestmerge('
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
@@ -701,6 +712,8 b' def manifestmerge('
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,
@@ -715,6 +728,8 b' def manifestmerge('
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,
@@ -875,7 +890,7 b' def manifestmerge('
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):
@@ -1034,7 +1049,8 b' def calculateupdates('
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)
General Comments 0
You need to be logged in to leave comments. Login now