[Commented On] D11150: sparse: apply update with in a `parentchange` context

baymax (Baymax, Your Personal Patch-care Companion) phabricator at mercurial-scm.org
Tue Jul 20 07:26:10 UTC 2021


baymax added a comment.
baymax updated this revision to Diff 29564.


  ✅ refresh by Heptapod after a successful CI run (🐙 💚)

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11150?vs=29416&id=29564

BRANCH
  default

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

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

AFFECTED FILES
  mercurial/sparse.py
  tests/test-sparse.t

CHANGE DETAILS

diff --git a/tests/test-sparse.t b/tests/test-sparse.t
--- a/tests/test-sparse.t
+++ b/tests/test-sparse.t
@@ -420,12 +420,12 @@
 We have files in the dirstate that are included and excluded. Some are in the
 manifest and some are not.
   $ hg debugdirstate --no-dates
-  n 644          0 * excluded (glob)
-  a   0         -1 * excludednomanifest (glob)
-  n 644          0 * included (glob)
-  a   0         -1 * includedadded (glob)
+  n * excluded (glob)
+  a * excludednomanifest (glob)
+  n * included (glob)
+  a * includedadded (glob)
   $ hg debugrebuilddirstate --minimal
   $ hg debugdirstate --no-dates
-  n 644          0 * included (glob)
-  a   0         -1 * includedadded (glob)
+  n * included (glob)
+  a * includedadded (glob)
 
diff --git a/mercurial/sparse.py b/mercurial/sparse.py
--- a/mercurial/sparse.py
+++ b/mercurial/sparse.py
@@ -439,13 +439,21 @@
                     message,
                 )
 
-        mergemod.applyupdates(
-            repo, tmresult, repo[None], repo[b'.'], False, wantfiledata=False
-        )
+        with repo.dirstate.parentchange():
+            mergemod.applyupdates(
+                repo,
+                tmresult,
+                repo[None],
+                repo[b'.'],
+                False,
+                wantfiledata=False,
+            )
 
-        dirstate = repo.dirstate
-        for file, flags, msg in tmresult.getactions([mergestatemod.ACTION_GET]):
-            dirstate.normal(file)
+            dirstate = repo.dirstate
+            for file, flags, msg in tmresult.getactions(
+                [mergestatemod.ACTION_GET]
+            ):
+                dirstate.normal(file)
 
     profiles = activeconfig(repo)[2]
     changedprofiles = profiles & files



To: marmoute, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210720/17ba3c0c/attachment-0002.html>


More information about the Mercurial-patches mailing list