changeset 47708:7bdfd88251c0

sparse: apply update with in a `parentchange` context We are changing the reference so we should be within such context manager. This seems make the actual dirstate content a bit flaky with content being sometime ambigous (but maybe it was flaky before?) So I increased the matching. Differential Revision: https://phab.mercurial-scm.org/D11150
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 19 Jul 2021 04:26:06 +0200
parents 61753b1ba96f
children a0e79084389d
files mercurial/sparse.py tests/test-sparse.t
diffstat 2 files changed, 20 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/sparse.py	Mon Jul 19 03:52:20 2021 +0200
+++ b/mercurial/sparse.py	Mon Jul 19 04:26:06 2021 +0200
@@ -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
--- a/tests/test-sparse.t	Mon Jul 19 03:52:20 2021 +0200
+++ b/tests/test-sparse.t	Mon Jul 19 04:26:06 2021 +0200
@@ -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)