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 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)