[Updated] D8889: merge: pass mergeresult obj in _forgetremoved() (API)

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Sat Aug 8 16:57:21 UTC 2020


Closed by commit rHG1aef38d973e8: merge: pass mergeresult obj in _forgetremoved() (API) (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/D8889?vs=22310&id=22347

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

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

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
@@ -255,7 +255,7 @@
         mresult.addfile(f, mergestatemod.ACTION_GET, (flags, backup), msg)
 
 
-def _forgetremoved(wctx, mctx, branchmerge):
+def _forgetremoved(wctx, mctx, branchmerge, mresult):
     """
     Forget removed files
 
@@ -270,25 +270,20 @@
     as removed.
     """
 
-    actions = {}
     m = mergestatemod.ACTION_FORGET
     if branchmerge:
         m = mergestatemod.ACTION_REMOVE
     for f in wctx.deleted():
         if f not in mctx:
-            actions[f] = m, None, b"forget deleted"
+            mresult.addfile(f, m, None, b"forget deleted")
 
     if not branchmerge:
         for f in wctx.removed():
             if f not in mctx:
-                actions[f] = (
-                    mergestatemod.ACTION_FORGET,
-                    None,
-                    b"forget removed",
+                mresult.addfile(
+                    f, mergestatemod.ACTION_FORGET, None, b"forget removed",
                 )
 
-    return actions
-
 
 def _checkcollision(repo, wmf, mresult):
     """
@@ -704,10 +699,6 @@
         for f, (act, data, msg) in pycompat.iteritems(self._filemapping):
             self._actionmapping[act][f] = data, msg
 
-    def updateactions(self, updates):
-        for f, (a, data, msg) in pycompat.iteritems(updates):
-            self.addfile(f, a, data, msg)
-
     def hasconflicts(self):
         """ tells whether this merge resulted in some actions which can
         result in conflicts or not """
@@ -1196,8 +1187,7 @@
         mresult.updatevalues(diverge, renamedelete, {})
 
     if wctx.rev() is None:
-        fractions = _forgetremoved(wctx, mctx, branchmerge)
-        mresult.updateactions(fractions)
+        _forgetremoved(wctx, mctx, branchmerge, mresult)
 
     sparse.filterupdatesactions(repo, wctx, mctx, branchmerge, mresult)
     _resolvetrivial(repo, wctx, mctx, ancestors[0], 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/20200808/27f2ac52/attachment-0002.html>


More information about the Mercurial-patches mailing list