PhoneixS
PhoneixS

Reputation: 11016

How to fix mercurial repository without default branch?

I have a mercurial repository with only one main branch, the problem is that is a named branch called xml. Even the revision 0 is of branch "xml".

I think this happened because it was imported from a subversion branch. I have used it after this without problem, but now that I know a little more about mercurial I know that it is bad to have a repository like it.

So here is my question. How can I fix it so it is the default branch and called "default"? And if possible, can all revisions moved to "default" instead of be "xml" branch?

Note: My development team that use this repository is very small (2) so it isn't a problem if it is needed to re-clone or edit the history somehow.

Edit: I can only think in make a new branch named "default" from the actual tip, but I don't know if I will lose something important that have the really "default" branch. Also I have tried to do a hg checkout default but it tell that don't exist.

Upvotes: 1

Views: 127

Answers (2)

Christophe Muller
Christophe Muller

Reputation: 5090

If you really do not mind editing the history, then you can use the convert extension with its --branchmap option, see:

https://www.mercurial-scm.org/wiki/ConvertExtension#A--branchmap

which will allow you to rename the "xml" branch to "default".

Upvotes: 4

Ry4an Brase
Ry4an Brase

Reputation: 78330

It's absolutely okay to just create a new comment on a branch named default. It won't matter at all that it's not a root.

Upvotes: 1

Related Questions