##// END OF EJS Templates
merge: introduce `addcommitinfo()` on mergeresult object...
Pulkit Goyal -
r45944:72e503a2 default
parent child Browse files
Show More
@@ -582,10 +582,9 b' class mergeresult(object):'
582 self._commitinfo = collections.defaultdict(dict)
582 self._commitinfo = collections.defaultdict(dict)
583 self._actionmapping = collections.defaultdict(dict)
583 self._actionmapping = collections.defaultdict(dict)
584
584
585 def updatevalues(self, diverge, renamedelete, commitinfo):
585 def updatevalues(self, diverge, renamedelete):
586 self._diverge = diverge
586 self._diverge = diverge
587 self._renamedelete = renamedelete
587 self._renamedelete = renamedelete
588 self._commitinfo = commitinfo
589
588
590 def addfile(self, filename, action, data, message):
589 def addfile(self, filename, action, data, message):
591 """ adds a new file to the mergeresult object
590 """ adds a new file to the mergeresult object
@@ -671,6 +670,11 b' class mergeresult(object):'
671 for key, val in pycompat.iteritems(self._filemapping):
670 for key, val in pycompat.iteritems(self._filemapping):
672 yield key, val
671 yield key, val
673
672
673 def addcommitinfo(self, filename, key, value):
674 """ adds key-value information about filename which will be required
675 while committing this merge """
676 self._commitinfo[filename][key] = value
677
674 @property
678 @property
675 def diverge(self):
679 def diverge(self):
676 return self._diverge
680 return self._diverge
@@ -756,7 +760,6 b' def manifestmerge('
756 # information from merge which is needed at commit time
760 # information from merge which is needed at commit time
757 # for example choosing filelog of which parent to commit
761 # for example choosing filelog of which parent to commit
758 # TODO: use specific constants in future for this mapping
762 # TODO: use specific constants in future for this mapping
759 commitinfo = collections.defaultdict(dict)
760 if followcopies:
763 if followcopies:
761 branch_copies1, branch_copies2, diverge = copies.mergecopies(
764 branch_copies1, branch_copies2, diverge = copies.mergecopies(
762 repo, wctx, p2, pa
765 repo, wctx, p2, pa
@@ -844,7 +847,9 b' def manifestmerge('
844 b'remote is newer',
847 b'remote is newer',
845 )
848 )
846 if branchmerge:
849 if branchmerge:
847 commitinfo[f][b'filenode-source'] = b'other'
850 mresult.addcommitinfo(
851 f, b'filenode-source', b'other'
852 )
848 elif nol and n2 == a: # remote only changed 'x'
853 elif nol and n2 == a: # remote only changed 'x'
849 mresult.addfile(
854 mresult.addfile(
850 f,
855 f,
@@ -860,7 +865,7 b' def manifestmerge('
860 b'remote is newer',
865 b'remote is newer',
861 )
866 )
862 if branchmerge:
867 if branchmerge:
863 commitinfo[f][b'filenode-source'] = b'other'
868 mresult.addcommitinfo(f, b'filenode-source', b'other')
864 else: # both changed something
869 else: # both changed something
865 mresult.addfile(
870 mresult.addfile(
866 f,
871 f,
@@ -1027,7 +1032,7 b' def manifestmerge('
1027 renamedelete = branch_copies1.renamedelete
1032 renamedelete = branch_copies1.renamedelete
1028 renamedelete.update(branch_copies2.renamedelete)
1033 renamedelete.update(branch_copies2.renamedelete)
1029
1034
1030 mresult.updatevalues(diverge, renamedelete, commitinfo)
1035 mresult.updatevalues(diverge, renamedelete)
1031 return mresult
1036 return mresult
1032
1037
1033
1038
@@ -1183,8 +1188,7 b' def calculateupdates('
1183 mresult.addfile(f, *l[0])
1188 mresult.addfile(f, *l[0])
1184 continue
1189 continue
1185 repo.ui.note(_(b'end of auction\n\n'))
1190 repo.ui.note(_(b'end of auction\n\n'))
1186 # TODO: think about commitinfo when bid merge is used
1191 mresult.updatevalues(diverge, renamedelete)
1187 mresult.updatevalues(diverge, renamedelete, {})
1188
1192
1189 if wctx.rev() is None:
1193 if wctx.rev() is None:
1190 _forgetremoved(wctx, mctx, branchmerge, mresult)
1194 _forgetremoved(wctx, mctx, branchmerge, mresult)
General Comments 0
You need to be logged in to leave comments. Login now