How to handle the default branch in Mercurial

mercurial

We've got a repository with two named branches in it: dev and production. There's also the default branch, which we aren't using. Unfortunately, whenever people clone the repository, it automatically puts them on default, and we're having problems because people will inadvertently commit to it.

Is there a way to delete the default branch, or disable it, or set Mercurial so that clones will automatically start on the dev branch?

Best Answer

The mercurial documentation has some examples of precommit hooks and one, ironically, is checking the branch name. In the example, it checks to make sure it matches a regular expression. You could tweak it to make sure the name isn't "default".

This may not prevent the clones from starting on the "default" branch, but at least with this hook in place, no one can put any code into "default".

Related Topic