summaryrefslogblamecommitdiffstats
path: root/computer/mirror-mercurial-repository-to-git.rst
blob: 4b3ee1987fabdc5b95f2494ab029bab53265de67 (plain) (tree)
1
2
3
4
5
6




                                   
                                                 













































































                                                                                                       
Mirror Mercurial repository to git?
###################################

:date: 2011-02-12T17:01:00
:category: computer
:tags: lazyweb, git, mercurial, github, gitorious

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?

.. _`Gajim, XMPP client`:
    http://gajim.org/
.. _`my packages`:
    http://mcepl.fedorapeople.org/rpms/
.. _`not alone`:
    http://www.youtube.com/watch?v=4XpnKHJAok8
.. _`bugzilla triage scripts`:
    https://fedorahosted.org/bugzilla-triage-scripts/
.. _`nonsensical commits`:
    https://fedorahosted.org/bugzilla-triage-scripts/changeset/861297063d99fd1121bbacb8823e0b5ec7e12ca1
.. _`on github`:
    https://github.com/mozilla/addon-sdk
.. _`on gitorious`:
    http://github.com/mcepl/gajim
.. _`blogpost about mirroring mozilla-central`:
    http://www.bluishcoder.co.nz/2011/02/10/git-conversion-of-mozilla-central.html
.. _Hg-Git:
    http://hg-git.github.com/
.. _dulwich:
    http://www.samba.org/~jelmer/dulwich/