diff mercurial/sparse.py @ 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 26bf0b9fe78f
children a0e79084389d
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