diff -r 774ed116dd7c -r e27a5a012323 mercurial/commands.py --- a/mercurial/commands.py Thu Mar 02 14:45:21 2023 +0100 +++ b/mercurial/commands.py Thu Mar 02 14:45:29 2023 +0100 @@ -837,7 +837,7 @@ return 1 else: hg.clean(repo, node, show_stats=False) - repo.dirstate.setbranch(branch) + repo.dirstate.setbranch(branch, repo.currenttransaction()) cmdutil.revert(ui, repo, rctx) if opts.get(b'no_commit'):