Patchwork [6,of,8] merge: update commitinfo from all mergeresults during bid merge

login
register
mail settings
Submitter Pulkit Goyal
Date Sept. 14, 2020, 11:15 a.m.
Message ID <21f520670eb08917eeb5.1600082122@workspace>
Download mbox | patch
Permalink /patch/47160/
State Accepted
Headers show

Comments

Pulkit Goyal - Sept. 14, 2020, 11:15 a.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1598440043 -19800
#      Wed Aug 26 16:37:23 2020 +0530
# Node ID 21f520670eb08917eeb5fcf11c75cc1dfb242530
# Parent  9be2d61f80be6059bcdc890bfb889d0a9670dbda
# EXP-Topic merge-newnode
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

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1130,6 +1130,7 @@  def calculateupdates(
         # 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 @@  def calculateupdates(
             ):
                 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 @@  def calculateupdates(
             _(b'\nauction for merging merge bids (%d ancestors)\n')
             % len(ancestors)
         )
-        mresult = mergeresult()
         for f, bids in sorted(fbids.items()):
             repo.ui.debug(_(b" list of bids for %s:\n") % f)
             for m, l in sorted(bids.items()):