changeset 50162:dae8dda6f582

debugrebuildstate: wrap the operation in a `changing_parents` context This ismaybe a "changing_files" case? However this would be the only usage of `rebuild` outside a `changing_parents` context and this is a debug command, so lets not make the code base more complex because of that one command.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 20 Feb 2023 14:05:19 +0100
parents 62158471d038
children c175b4857498
files mercurial/debugcommands.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Sun Feb 19 02:50:46 2023 +0100
+++ b/mercurial/debugcommands.py	Mon Feb 20 14:05:19 2023 +0100
@@ -3142,8 +3142,8 @@
             dsnotadded = {f for f in dsonly if not dirstate.get_entry(f).added}
             changedfiles = manifestonly | dsnotadded
 
-        dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles)
-        dirstate.write(repo.currenttransaction())
+        with dirstate.changing_parents(repo):
+            dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles)
 
 
 @command(