# HG changeset patch # User Pierre-Yves David # Date 2023-02-14 21:27:24 # Node ID 1f28172cfce97a988296980cba7c4fb5564f547a # Parent 637d46c5b1fab70b09a1c0cf7b27176d5ccfd94e 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. diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -3128,6 +3128,9 @@ def debugrebuilddirstate(ui, repo, rev, """ 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.