If you run monotone pre 0.41, what's described here doesn't apply since you don't have mtn suspend
. We recommend that you upgrade, but if there's a reason you can't, please have a look at the older version of this page
Renaming Monotone Branches
Complete branch renaming, with every branch cert mentioning the old branch, is not natively supported or encouraged in monotone. However, it does support a method that has the same effect in practice.
Start off with identifiying the head of the branch you want to rename, something like this:
REV=`mtn automate heads OLDBRANCH`
(make sure $REV
is only one revision. If not, you might want to do a merge first, or have a look at Partial Renaming below)
Then just add on a branch cert for the new branch:
mtn cert $REV branch NEWBRANCH
Finally, make the old branch "disappear":
mtn suspend $REV -b OLDBRANCH
VoilĂ , you're done! Don't forget to update all workspaces that are affected by this change.
Alternative Way
An alternative way is to simply commit a new revision in the new branch (this requires that you are in a workspace holding the up-to-date old branch):
mtn ci -b NEWBRANCH
Now, all you need is to suspend the parent:
mtn suspend p: -b OLDBRANCH
Partial Renaming
If you have two heads, nothing stops you from just renaming the branch for one of them and leaving the other one in the old branch. There might be good reasons to do this, for example if you realise that one of the heads really does belong in a branch of its own.
All you need to do is to select the revision to do the rename with carefully, and then apply one of the methods above.