diff -r e60f9168263c -r 774ed116dd7c mercurial/commands.py --- a/mercurial/commands.py Thu Mar 02 14:44:43 2023 +0100 +++ b/mercurial/commands.py Thu Mar 02 14:45:21 2023 +0100 @@ -1355,7 +1355,7 @@ with repo.wlock(): if opts.get(b'clean'): label = repo[b'.'].branch() - repo.dirstate.setbranch(label) + repo.dirstate.setbranch(label, repo.currenttransaction()) ui.status(_(b'reset working directory to branch %s\n') % label) elif label: @@ -1371,7 +1371,7 @@ hint=_(b"use 'hg update' to switch to it"), ) - repo.dirstate.setbranch(label) + repo.dirstate.setbranch(label, repo.currenttransaction()) ui.status(_(b'marked working directory as branch %s\n') % label) # find any open named branches aside from default