Saturday, August 16, 2008

I am switching from Mercurial to git

After a long night of debugging and while preparing, reviewing and pushing final patches before a SymPy release, I got this:

$ hg qpush
applying 1645.diff
Unable to read 1645.diff
** unknown exception encountered, details follow
** report bug details to http://www.selenic.com/mercurial/bts
** or mercurial@selenic.com
** Mercurial Distributed SCM (version 1.0.1)
Traceback (most recent call last):
File "/usr/bin/hg", line 20, in
mercurial.dispatch.run()
File "/var/lib/python-support/python2.5/mercurial/dispatch.py", line 20, in run
sys.exit(dispatch(sys.argv[1:]))
File "/var/lib/python-support/python2.5/mercurial/dispatch.py", line 29, in dispatch
return _runcatch(u, args)
File "/var/lib/python-support/python2.5/mercurial/dispatch.py", line 45, in _runcatch
return _dispatch(ui, args)
File "/var/lib/python-support/python2.5/mercurial/dispatch.py", line 364, in _dispatch
ret = _runcommand(ui, options, cmd, d)
File "/var/lib/python-support/python2.5/mercurial/dispatch.py", line 417, in _runcommand
return checkargs()
File "/var/lib/python-support/python2.5/mercurial/dispatch.py", line 373, in checkargs
return cmdfunc()
File "/var/lib/python-support/python2.5/mercurial/dispatch.py", line 356, in
d = lambda: func(ui, repo, *args, **cmdoptions)
File "/var/lib/python-support/python2.5/hgext/mq.py", line 1942, in push
mergeq=mergeq)
File "/var/lib/python-support/python2.5/hgext/mq.py", line 833, in push
top = self.applied[-1].name
IndexError: list index out of range

I am using:

$ hg --version
Mercurial Distributed SCM (version 1.0.1)

Copyright (C) 2005-2008 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


And I just got pissed off and I am switching to git for good. I've been using mercurial every day since about November 2007, and I think I am quite proficient in it. But we were missing some features, like recording a patch by hunks (git add -p), so Kirill Smelkov (another SymPy developer) just implemented this to mercurial queues, it is now included in hg 1.0. But I am constantly beaten by stupid bugs, mercurial broke into pieces several times already (last time with hg bisect, before it with mercurial queues and file renaming), that just should not happen in a production version. Another problem is that hgweb is constantly using 100% of CPU on my server whenever someone clicks to see the contents of the README file. Again I can spend time debugging it, but I will just use git and if it works, I'll stay with it.

I started learning git recently and it is just better in every aspect. Bigger community, it has all the features that I was always missing in mercurial (like rebase, hunks recording, diff diff --color-words, better gitk). And it's superfast.

Unless I find some showstopper bugs in git too, I don't think I am coming back.

We'll have to create a live mercurial mirror of SymPy, so that people can continue using mercurial, but I'll myself just be using git. We wrote a simple translation table for anyone using mercurial to get started:

http://wiki.sympy.org/wiki/Git_hg_rosetta_stone

I love Python and I like that Mercurial is just a small C core and the rest is in Python, but for some reason, it still has the baby bugs, that should have been fixed years ago and why should we spend our time fixing and improving Mercurial, if other people have already done the job for us (and usually a better job than I could do) in git?

Another reason for switching is that in Debian, mercurial is not used for packages, while git is used a lot.

5 comments:

Andi Albrecht said...

I hope you will still share you're Mercurial knowledge with us... ;-)

Unknown said...

I have considered switching to git too. Please post how it goes.

Unknown said...

I stumbled upon this blog while searching for git mercurial mirror, because I want to mirror a git repos as a mercurial repos. While this process is simple enough, I wanted to see if someone had already written a script for this.

After I read your post, I found this counter argument:
http://www.selenic.com/pipermail/mercurial/2008-August/020876.html

Unknown said...

Hi Bradford,

if you figure out how to easily mirror git repos as mercurial repos, please let us know, we need that too.

Ondrej

P.S. you can find my reply here:

http://www.selenic.com/pipermail/mercurial/2008-August/020893.html

ulrik said...

Ondrej, are you by now aware of http://hg-git.github.com/ ? Just in case.