08 December 2009

How to get hg-git working with Mercurial without installing Python on Windows

Sorry for the horrendous search keyword-driven title, but I’ve been trying to get this to work for ages.

Here’s a step by step guide, along with some potential pitfalls.

1) Download TortoiseHg. I used 0.9.1.1. with Mercurial 1.4.1. Do not use the windows Mercurial command line only distribution – we’ll need to modify a zip file later and for some reason the zip file with the command line distribution cannot be modified with either WinRar, Winzip or 7-zip.

2) Install TortoiseHg as usual.

3) Download dulwich 0.4.0.

4) Add the directory called ‘dulwich’ inside the dulwich download (the one with the file __init__.py in it) to the library.zip file in the TortoiseHg folder (normally just C: \Program Files\TortoiseHg) using your favorite zip utility.

5) Download the tip of an up to date hg-git fork. I used http://bitbucket.org/gwik/hg-git/.

6) Put the hg-git directory in the TortoiseHg directory.

7) Add the following lines to your Mercurial.ini file:

bookmarks =

hggit = C:\Program Files\TortoiseHg\hg-git\hggit

That’s it. I finally managed to clone the ClojureClr repository with the above install:

> hg clone git://github.com/richhickey/clojure-clr.git
destination directory: clojure-clr.git
importing Hg objects into Git
Counting objects: 4001, done.
Compressing objects: 100% (1816/1816), done.
Total 4001 (delta 3153), reused 2774 (delta 2148)
importing Git objects into Hg
at:   0/307
at: 100/307
at: 200/307
at: 300/307
updating to branch default
313 files updated, 0 files merged, 0 files removed, 0 files unresolved

And with this we’re back to functional programming languages ;)

I didn’t test this any further.

Good luck!

Technorati: , , ,

Share this post :

3 comments:

  1. everything seems to work except for hg-push

    any idea how to get by it?


    C:\sample_transplant\iris.git>hg push --debug git+ssh://git@10.0.0.116:iris/iiri
    s.
    pushing to git+ssh://git@10.0.0.116:iris/iiris.
    importing Hg objects into Git
    creating and sending data
    abort: The system cannot find the file specified

    i always get this error

    ReplyDelete
  2. Hi,

    No idea - I've used it to clone and pull exclusively so far. Try adding an issue to an hg-git repo on github.

    Kurt

    ReplyDelete
  3. >>git+ssh://git@10.0.0.116:iris/iiri

    You have to convert the ':' to '/' so its like this: git+ssh://git@10.0.0.116/iris/iiri

    The message is because its looking for /iiri and its not finding it, per HTTP.

    ReplyDelete