[Updated] D8819: merge: make mergeresult constructor initialize empty object

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Sun Aug 2 17:44:21 UTC 2020


Closed by commit rHGfe2040abb183: merge: make mergeresult constructor initialize empty 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/D8819?vs=22103&id=22202

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

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

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
@@ -546,7 +546,7 @@
     It has information about what actions need to be performed on dirstate
     mapping of divergent renames and other such cases. '''
 
-    def __init__(self, actions, diverge, renamedelete, commitinfo):
+    def __init__(self):
         """
         actions: dict of filename as keys and action related info as values
         diverge: mapping of source name -> list of dest name for
@@ -556,7 +556,12 @@
         commitinfo: dict containing data which should be used on commit
                     contains a filename -> info mapping
         """
+        self._actions = {}
+        self._diverge = {}
+        self._renamedelete = {}
+        self._commitinfo = {}
 
+    def updatevalues(self, actions, diverge, renamedelete, commitinfo):
         self._actions = actions
         self._diverge = diverge
         self._renamedelete = renamedelete
@@ -914,7 +919,9 @@
     renamedelete = branch_copies1.renamedelete
     renamedelete.update(branch_copies2.renamedelete)
 
-    return mergeresult(actions, diverge, renamedelete, commitinfo)
+    mresult = mergeresult()
+    mresult.updatevalues(actions, diverge, renamedelete, commitinfo)
+    return mresult
 
 
 def _resolvetrivial(repo, wctx, mctx, ancestor, actions):
@@ -965,6 +972,7 @@
     # Avoid cycle.
     from . import sparse
 
+    mresult = None
     if len(ancestors) == 1:  # default
         mresult = manifestmerge(
             repo,
@@ -1075,7 +1083,8 @@
             continue
         repo.ui.note(_(b'end of auction\n\n'))
         # TODO: think about commitinfo when bid merge is used
-        mresult = mergeresult(actions, diverge, renamedelete, {})
+        mresult = mergeresult()
+        mresult.updatevalues(actions, diverge, renamedelete, {})
 
     if wctx.rev() is None:
         fractions = _forgetremoved(wctx, mctx, branchmerge)



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


More information about the Mercurial-patches mailing list