Mirror Mercurial repository to git?

So 12 února 2011

I am a big fan of Gajim, XMPP client and for years I have followed its latest development versions with my packages. Unfortunately, gajim’s development is tracked in a Mercurial repository. Please, understand correctly, I have nothing against Mercurial (and I am apparently not alone), the first version of bugzilla triage scripts were hosted in the Mercurial repository. However, this experience taught me two things. First of all, my head is probably irreparably damaged by git, so I couldn’t get my head around randomly occurring multiple heads constantly erupting in my repository. I was constantly battling with it and generating nonsensical commits just to get rid of them. I never felt like pushing mercurial to the background just to work for me, in the same manner git already worked for me. However, the final nail to the coffin of my efforts to domesticate Mercurial was when I found out that the Jetpack repository itself will be most likely hosted predominantly on github. So, I have mirrored for years gajim repository on gitorious, and I was not that much surprised when I read today’s blogpost about mirroring mozilla-central in a git. However, I was reminded about Hg-Git plugin. Chris reminded me again about the problem that I need to run git checkout -f from time to time to clean the repository. I was also tickled by the idea of stable commit IDs. The idea that two git repositories converted from the same hg one would be compatible was interesting. However, I haven’t found hg-git that awesome:

  1. Speed ... I like Python, but using dulwich seems questionable at the best. Git users are quite proud about the speed of git, but speed of both hg gexport (the conversion itself) and hg push to git repository is just depressive. Couldn’t somebody make version of hg-git using native C git commands?

  2. Branches ... another thing git users tend to love IMHO are branches. So the fact that hg-git hides all hg heads from me per default and forces me to get back into fiddling with hg bookmarks and heads and all that, doesn’t make me smile. hg-fast-export by default just making all heads into branches makes me much much more happy.

  3. This not complaint just reminder about suggested change of defaults (no I don’t complain, I promised never to fight over defaults ever). Run, don’t just go to your ~/.hgrc and add there:

    [git]
    intree = True
    

    The original default just, in my opinion, doesn’t make sense. So, the only objection I have against hg-fast-export is the necessity to do git checkout -f from time to time (and my uncertainty, what would happen if I do hg-fast-export outside of master branch). This script (called git-hgimport) makes me completely happy and secures hg-fast-export future as the converter of my gajim git repo:

    !/bin/sh
    

    set -e git checkout master hg pull --update hg-fast-export --quiet git checkout -f

And of course, if this script is in $PATH, then git suddenly knows about git hgimport command. Does anybody out there knows about some better comparisons between hg-fast-export and hg-git?

Category: computer Tagged: lazyweb git mercurial github gitorious


Page 1 of 1