« Simple AMQP Library for Ruby | Main | Server Side AS3 »

Converting Mercurial To Git

Today I wanted to convert a Mercurial repository I was using to the git format so that I can put it onto Github. Previously I had used Tailor to perform a migration of a different repository from Monotone to Mercurial. When I tried this with git on OSX 10.5 however, I ran into a path issue with the git command. Whilst trying to debug this, I stumbled across the hg-to-git tool written by Stelian Pop, who wrote this tool for better branch handling. Because it saved me a lot of time that I would have spent trying to debug tailor, I've decided to make a record of how to use the converter for future reference.

First of all you need to get the tool from the git repository:

$ git clone git://repo.or.cz/fast-export.git

After that, create a new directory to house the new git repository, initialize a new git database and then point the export tool at the location of your hg repository:

$ mkdir TARGET_REPO
$ cd TARGET_REPO
$ git init-db
$ ../fast-export/hg-fast-export.sh -r PATH_TO_HG_REPO
master: Exporting full revision 1/19 with 14/0/0 \
added/changed/removed files
.....
Exporting tag [0.1] at [hg r8] [git :9]
.....
Issued 23 commands
git-fast-import statistics:
.....

Then you can push the new repository out to wherever you remote repository is located:

$ git remote add origin git@github.com:0x6e6562/as3-amqp.git
$ git push origin master
Counting objects: 293, done.
Compressing objects: 100% (79/79), done.
Writing objects: 100% (293/293), 1.70 MiB, done.
Total 293 (delta 157), reused 293 (delta 157)
To git@github.com:0x6e6562/as3-amqp.git
 * [new branch]      master -> master

And now the code is on Github in this project.

Posted on Saturday, July 5, 2008 at 08:30PM by Registered Commenter0x6e6562 | CommentsPost a Comment | References1 Reference

References (1)

References allow you to track sources for this article, as well as articles that were written in response to this article.
  • Response
    Could you help me. By the time I'd grown up, I naturally supposed that I'd be grown up. Help me! Can not find sites on the: loan interest rate quotes. I found only this - http://www.bwmetrotietehotel.com.br/Members/Taxattorney/irs-tax-attorneys. Individually, one might be foreign to help with an early incentive population before promoting any ...

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>