changeset 50056:1f28172cfce9

debugrebuilddirstate: double check that no transaction is open Since transaction impact dirstate write, we make sure nobody is trying anything strange with this internal command.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 14 Feb 2023 22:27:24 +0100
parents 637d46c5b1fa
children 9313d8666a0f
files mercurial/debugcommands.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Tue Feb 14 22:26:23 2023 +0100
+++ b/mercurial/debugcommands.py	Tue Feb 14 22:27:24 2023 +0100
@@ -3128,6 +3128,9 @@
     """
     ctx = scmutil.revsingle(repo, rev)
     with repo.wlock():
+        if repo.currenttransaction() is not None:
+            msg = b'rebuild the dirstate outside of a transaction'
+            raise error.ProgrammingError(msg)
         dirstate = repo.dirstate
         changedfiles = None
         # See command doc for what minimal does.