[Updated] D10830: merge: make applyupdates() not mutate mresult argument

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Mon Jun 7 07:44:31 UTC 2021


Closed by commit rHG9e6e12e1a87e: merge: make applyupdates() not mutate mresult argument (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D10830?vs=28388&id=28460

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

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

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
@@ -1724,20 +1724,13 @@
     removed += msremoved
 
     extraactions = ms.actions()
-    if extraactions:
-        for k, acts in pycompat.iteritems(extraactions):
-            for a in acts:
-                mresult.addfile(a[0], k, *a[1:])
-            if k == mergestatemod.ACTION_GET and wantfiledata:
-                # no filedata until mergestate is updated to provide it
-                for a in acts:
-                    getfiledata[a[0]] = None
 
     progress.complete()
-    assert len(getfiledata) == (
-        mresult.len((mergestatemod.ACTION_GET,)) if wantfiledata else 0
+    return (
+        updateresult(updated, merged, removed, unresolved),
+        getfiledata,
+        extraactions,
     )
-    return updateresult(updated, merged, removed, unresolved), getfiledata
 
 
 def _advertisefsmonitor(repo, num_gets, p1node):
@@ -2122,7 +2115,7 @@
         )
 
         wantfiledata = updatedirstate and not branchmerge
-        stats, getfiledata = applyupdates(
+        stats, getfiledata, extraactions = applyupdates(
             repo,
             mresult,
             wc,
@@ -2133,6 +2126,18 @@
         )
 
         if updatedirstate:
+            if extraactions:
+                for k, acts in pycompat.iteritems(extraactions):
+                    for a in acts:
+                        mresult.addfile(a[0], k, *a[1:])
+                    if k == mergestatemod.ACTION_GET and wantfiledata:
+                        # no filedata until mergestate is updated to provide it
+                        for a in acts:
+                            getfiledata[a[0]] = None
+
+            assert len(getfiledata) == (
+                mresult.len((mergestatemod.ACTION_GET,)) if wantfiledata else 0
+            )
             with repo.dirstate.parentchange():
                 repo.setparents(fp1, fp2)
                 mergestatemod.recordupdates(



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


More information about the Mercurial-patches mailing list