[Updated] D8922: merge: introduce `addcommitinfo()` on mergeresult object

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Sat Aug 22 23:33:17 UTC 2020


Closed by commit rHG72e503a24715: merge: introduce `addcommitinfo()` on mergeresult object (authored by pulkit).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8922?vs=22394&id=22425

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8922/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8922

AFFECTED FILES
  mercurial/merge.py

CHANGE DETAILS

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -582,10 +582,9 @@
         self._commitinfo = collections.defaultdict(dict)
         self._actionmapping = collections.defaultdict(dict)
 
-    def updatevalues(self, diverge, renamedelete, commitinfo):
+    def updatevalues(self, diverge, renamedelete):
         self._diverge = diverge
         self._renamedelete = renamedelete
-        self._commitinfo = commitinfo
 
     def addfile(self, filename, action, data, message):
         """ adds a new file to the mergeresult object
@@ -671,6 +670,11 @@
             for key, val in pycompat.iteritems(self._filemapping):
                 yield key, val
 
+    def addcommitinfo(self, filename, key, value):
+        """ adds key-value information about filename which will be required
+        while committing this merge """
+        self._commitinfo[filename][key] = value
+
     @property
     def diverge(self):
         return self._diverge
@@ -756,7 +760,6 @@
     # information from merge which is needed at commit time
     # for example choosing filelog of which parent to commit
     # TODO: use specific constants in future for this mapping
-    commitinfo = collections.defaultdict(dict)
     if followcopies:
         branch_copies1, branch_copies2, diverge = copies.mergecopies(
             repo, wctx, p2, pa
@@ -844,7 +847,9 @@
                             b'remote is newer',
                         )
                         if branchmerge:
-                            commitinfo[f][b'filenode-source'] = b'other'
+                            mresult.addcommitinfo(
+                                f, b'filenode-source', b'other'
+                            )
                 elif nol and n2 == a:  # remote only changed 'x'
                     mresult.addfile(
                         f,
@@ -860,7 +865,7 @@
                         b'remote is newer',
                     )
                     if branchmerge:
-                        commitinfo[f][b'filenode-source'] = b'other'
+                        mresult.addcommitinfo(f, b'filenode-source', b'other')
                 else:  # both changed something
                     mresult.addfile(
                         f,
@@ -1027,7 +1032,7 @@
     renamedelete = branch_copies1.renamedelete
     renamedelete.update(branch_copies2.renamedelete)
 
-    mresult.updatevalues(diverge, renamedelete, commitinfo)
+    mresult.updatevalues(diverge, renamedelete)
     return mresult
 
 
@@ -1183,8 +1188,7 @@
             mresult.addfile(f, *l[0])
             continue
         repo.ui.note(_(b'end of auction\n\n'))
-        # TODO: think about commitinfo when bid merge is used
-        mresult.updatevalues(diverge, renamedelete, {})
+        mresult.updatevalues(diverge, renamedelete)
 
     if wctx.rev() is None:
         _forgetremoved(wctx, mctx, branchmerge, mresult)



To: pulkit, #hg-reviewers, marmoute, indygreg
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200822/3e1dec93/attachment-0002.html>


More information about the Mercurial-patches mailing list