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?
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:
With a small shell script and the --force option to git-tag you can annotate all of your tags.
This is a somewhat known issue. You can try patching the following file /usr/lib/python2.6/site-packages/hgext/convert/hg.py (or wherever it's located) by changing this:
extra = {'branch': self.tagsbranch}
to:
extra = {'branch': 'default'}
and then converting it again.
EDIT: On a deeper look at the state of things it seems that it may be difficult--it not impossible--to do what you want. Even more so to do it correctly.
Since you only have 8 tags consider saving yourself the hassle by crafting the .hgtags file by hand. You can figure out what's up with 'hg convert' later (I'll keep my eyes pealed as well).
Luck.
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