The result I would need is that when cloning a repository the code is at the last revision of a branch that is not the default branch, with no need to do "hg update mybranchname". Is this possible?
In the Status bar, click the Mercurial Branch widget to open the Branches popup. Select the branch or bookmark to which you want to switch and in the menu that opens, click Update.
Mercurial's main branch is called "default" and is analogous to "trunk" in SVN, "HEAD" in CVS, and "master" in Git.
Branching can happen by committing a changeset within a single repository or by committing diverging changes in distinct (but related) repositories. Two repositories are said to be related if they were once cloned from the same repository but later may have diverged.
The advice until now has been: you should always use default
as your main branch since Mercurial will checkout default
if it finds it in the repository.
This changes a little with Mercurial 2.1: you can now close the default
branch (if you have one) and add a bookmark named default
in its place. A new clone will retrieve the bookmark and update to it, effectively switching to another branch in the process.
Note that it's your responsibility to keep the default
bookmark pointing to the head of the branch you want to checkout, so this is not 100% fool proof.
You could merge the branch into the default branch, like:
hg merge mybranchname
hg commit
Now the branch is in effect the main branch. You can hide the old branch with:
hg update mybranchname
hg commit --close-branch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With