How do I convert my Git repository to Mercurial and bring along its tags
git, mercurial, port, portability
Solution
Are your tags lightweight git tags or full on annotated tags? `hg convert` only converts annotated tags, but git by default creates lightweight ones. I had this issue when converting one of my repositories recently. You can check what they are as follows:
git ls-remote --tags .
Running `hg convert` will only convert the tags that end in `^{}`, the annotated ones. You have 2 choices:
- patch the git.py hgext convert extension file to convert all types
- change your git tags to annotated tags prior to conversion
With a small shell script and the --force option to git-tag you can annotate all of your tags.
Problem
I am wanting to toy around with Mercurial a bit, so I am trying to convert one of my existing repositories over. I run the following command on my Mac: ``` hg convert myrepos myrepos-hg ``` The command successfully imports all of my commits, but it doesn't bring along the 8 or so tags that were marked in the Git repository (nor are any of the branches for that matter). Is there a special parameter I need to set to have my tags imported into Mercurial as well?