[Updated] D8824: merge: pass mergeresult obj instead of actions dict in _resolvetrivial()

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


Closed by commit rHG00e9c5edcd58: merge: pass mergeresult obj instead of actions dict in _resolvetrivial() (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/D8824?vs=22108&id=22207

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

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

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
@@ -959,26 +959,28 @@
     return mresult
 
 
-def _resolvetrivial(repo, wctx, mctx, ancestor, actions):
+def _resolvetrivial(repo, wctx, mctx, ancestor, mresult):
     """Resolves false conflicts where the nodeid changed but the content
        remained the same."""
     # We force a copy of actions.items() because we're going to mutate
     # actions as we resolve trivial conflicts.
-    for f, (m, args, msg) in list(actions.items()):
+    for f, (m, args, msg) in list(mresult.actions.items()):
         if (
             m == mergestatemod.ACTION_CHANGED_DELETED
             and f in ancestor
             and not wctx[f].cmp(ancestor[f])
         ):
             # local did change but ended up with same content
-            actions[f] = mergestatemod.ACTION_REMOVE, None, b'prompt same'
+            mresult.addfile(
+                f, mergestatemod.ACTION_REMOVE, None, b'prompt same'
+            )
         elif (
             m == mergestatemod.ACTION_DELETED_CHANGED
             and f in ancestor
             and not mctx[f].cmp(ancestor[f])
         ):
             # remote did change but ended up with same content
-            del actions[f]  # don't get = keep local deleted
+            mresult.removefile(f)  # don't get = keep local deleted
 
 
 def calculateupdates(
@@ -1127,7 +1129,7 @@
     prunedactions = sparse.filterupdatesactions(
         repo, wctx, mctx, branchmerge, mresult.actions
     )
-    _resolvetrivial(repo, wctx, mctx, ancestors[0], mresult.actions)
+    _resolvetrivial(repo, wctx, mctx, ancestors[0], mresult)
 
     mresult.setactions(prunedactions)
     return mresult



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/d7f9d25d/attachment-0002.html>


More information about the Mercurial-patches mailing list