merge: update commitinfo from all mergeresults during bid merge
authorPulkit Goyal <7895pulkit@gmail.com>
Wed, 26 Aug 2020 16:37:23 +0530
changeset 45470 6e474eec4be6
parent 45469 49ffaa4f65f6
child 45471 a03fde1077ce
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
mercurial/merge.py
--- a/mercurial/merge.py	Mon Aug 24 17:22:28 2020 +0530
+++ b/mercurial/merge.py	Wed Aug 26 16:37:23 2020 +0530
@@ -1130,6 +1130,7 @@
         # mapping of following form:
         # {ACTION_X : [info, ..], ACTION_Y : [info, ..]}
         fbids = {}
+        mresult = mergeresult()
         diverge, renamedelete = None, None
         for ancestor in ancestors:
             repo.ui.note(_(b'\ncalculating bids for ancestor %s\n') % ancestor)
@@ -1156,6 +1157,12 @@
             ):
                 renamedelete = mresult1.renamedelete
 
+            # blindly update final mergeresult commitinfo with what we get
+            # from mergeresult object for each ancestor
+            # TODO: some commitinfo depends on what bid merge choose and hence
+            # we will need to make commitinfo also depend on bid merge logic
+            mresult._commitinfo.update(mresult1._commitinfo)
+
             for f, a in mresult1.filemap(sort=True):
                 m, args, msg = a
                 repo.ui.debug(b' %s: %s -> %s\n' % (f, msg, m))
@@ -1174,7 +1181,6 @@
             _(b'\nauction for merging merge bids (%d ancestors)\n')
             % len(ancestors)
         )
-        mresult = mergeresult()
         for f, bids in sorted(fbids.items()):
             if repo.ui.debugflag:
                 repo.ui.debug(b" list of bids for %s:\n" % f)