Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/merge.py @ 45481:6e474eec4be6
merge: update commitinfo from all mergeresults during bid merge
During bid merge, it's not clear which commitinfo should be stored and which one
should not. This depends on which side the bid merge chooses for a file. For
this we will need to refactor bid merge code and commitinfo handling.
For now, we just blindly updates info since we hardly have any users of
commitinfo and this will help us in testing and clearing out further path.
Differential Revision: https://phab.mercurial-scm.org/D8965
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 26 Aug 2020 16:37:23 +0530 |
parents | 49ffaa4f65f6 |
children | c4f14db3da1d |
comparison
equal
deleted
inserted
replaced
45480:49ffaa4f65f6 | 45481:6e474eec4be6 |
---|---|
1128 # {FILENAME1 : BID1, FILENAME2 : BID2} | 1128 # {FILENAME1 : BID1, FILENAME2 : BID2} |
1129 # BID is another dictionary which contains | 1129 # BID is another dictionary which contains |
1130 # mapping of following form: | 1130 # mapping of following form: |
1131 # {ACTION_X : [info, ..], ACTION_Y : [info, ..]} | 1131 # {ACTION_X : [info, ..], ACTION_Y : [info, ..]} |
1132 fbids = {} | 1132 fbids = {} |
1133 mresult = mergeresult() | |
1133 diverge, renamedelete = None, None | 1134 diverge, renamedelete = None, None |
1134 for ancestor in ancestors: | 1135 for ancestor in ancestors: |
1135 repo.ui.note(_(b'\ncalculating bids for ancestor %s\n') % ancestor) | 1136 repo.ui.note(_(b'\ncalculating bids for ancestor %s\n') % ancestor) |
1136 mresult1 = manifestmerge( | 1137 mresult1 = manifestmerge( |
1137 repo, | 1138 repo, |
1154 if renamedelete is None or len(renamedelete) < len( | 1155 if renamedelete is None or len(renamedelete) < len( |
1155 mresult1.renamedelete | 1156 mresult1.renamedelete |
1156 ): | 1157 ): |
1157 renamedelete = mresult1.renamedelete | 1158 renamedelete = mresult1.renamedelete |
1158 | 1159 |
1160 # blindly update final mergeresult commitinfo with what we get | |
1161 # from mergeresult object for each ancestor | |
1162 # TODO: some commitinfo depends on what bid merge choose and hence | |
1163 # we will need to make commitinfo also depend on bid merge logic | |
1164 mresult._commitinfo.update(mresult1._commitinfo) | |
1165 | |
1159 for f, a in mresult1.filemap(sort=True): | 1166 for f, a in mresult1.filemap(sort=True): |
1160 m, args, msg = a | 1167 m, args, msg = a |
1161 repo.ui.debug(b' %s: %s -> %s\n' % (f, msg, m)) | 1168 repo.ui.debug(b' %s: %s -> %s\n' % (f, msg, m)) |
1162 if f in fbids: | 1169 if f in fbids: |
1163 d = fbids[f] | 1170 d = fbids[f] |
1172 # Pick the best bid for each file | 1179 # Pick the best bid for each file |
1173 repo.ui.note( | 1180 repo.ui.note( |
1174 _(b'\nauction for merging merge bids (%d ancestors)\n') | 1181 _(b'\nauction for merging merge bids (%d ancestors)\n') |
1175 % len(ancestors) | 1182 % len(ancestors) |
1176 ) | 1183 ) |
1177 mresult = mergeresult() | |
1178 for f, bids in sorted(fbids.items()): | 1184 for f, bids in sorted(fbids.items()): |
1179 if repo.ui.debugflag: | 1185 if repo.ui.debugflag: |
1180 repo.ui.debug(b" list of bids for %s:\n" % f) | 1186 repo.ui.debug(b" list of bids for %s:\n" % f) |
1181 for m, l in sorted(bids.items()): | 1187 for m, l in sorted(bids.items()): |
1182 for _f, args, msg in l: | 1188 for _f, args, msg in l: |