tags:

views:

912

answers:

8

First, let me say I'm not a professional programmer, but an engineer who had a need for it and had to learn. I was always working alone, so it was just me and my seven split personalities ... and we worked okey as a team :) Most of my stuff is done in C/Fortran/Matlab and so far I've been learning git to manage it all. However, although I've had no unsolvable problems with it, I've never been "that" happy with it ... for everything I cannot do, I have to look up a book. And, for some time now I've been hearing a lot of good stuff about Mercurial.
Now, a colleague of mine will have to work with me on a project (I almost feel sorry for him) and he's started learning Mercurial (says he likes it more), and I'm considering the switch myself.

We work almost exclusively on Windows platform (although I manage relatively ok using Unix tools and things that come from that part of the world).

So, I was wondering, in a described scenario, what problems could I expect with the switch. I heard that Mercurial is rather more user friendly towards windows users, regarding the user interfaces.

How does it handle repositories ? Does it create them the same way as git does (just one subdirectory in a working directory) and can I just copy the whole project directory (including git repo) and just carry them somewhere with no extra thinking ? (I really liked that when I was choosing over git/svn).

Are there any good books on it that you can recommend (something like Pro Git, only for Mercurial).

What are good ways to implement Mercurial into Visual Studio/GVim for Windows, or into Windows Explorer so I can work relatively easily (I would like to avoid using the command line for everything regarding it, like in git shell).

Is there something else I should be aware of (please, on this don't point me to other questions ... they just give me a ton of info, and I'm not sure what is it that I should take as important, and what to disregard). I'm trying to cut some time, since I cannot spend all that time relearning Mercurial, like I did for git.

I've also heard git is c project, while mercurial is python ... is there any noticeable difference in speed. git was pretty speedy ... will I encounter some waiting while working.

Notice: All my projects are of let's say, middle size ... mostly numerical simulations ... 10-15000 lines (medium size?)

+4  A: 

If you are happy with git, I doubt there is a real compelling reason to switch although I like Hg a lot. Git has TortoiseGit/GitCheetah, although I think TortoiseHg is a little better and stable IMHO.

You might want to watch this free video on using Hg and TortoiseHg (as well as the Visual Studio Hg plug-in) on tekpub/codeplex. The video will give you a feel for Hg.

Ryan
Ryan, thanks for answering. I didn't know about TortoiseGit, but it looks really nice. You said it is a little unstable. My way of work is relatively simple ... I write code, create "save" points (as to have a history of what I did), and sometimes just branch a current or an older savepoint and add some feature to test it. Maybe merge it afterwards. Nothing more. Do you think it is stable enough for that ? I really like it, from what I've seen so far, but the unstable part worries me a little (I hate losing work :( ... In any case, thanks again for the answer.
richard
Thanks for the link to the codeplex videos. Those are well done.
Ben
@richard, by unstable I meant the Windows Explorer integration (GitCheetah/TortoiseGit) and it crashed Windows Explorer several times on one of my systems. Nothing was lost, but it seemed to make Win Explorer much less stable. Since I already had TortoiseSvn and TortoiseHg installed and my system was previously stable, I uninstalled the Git Windows Explorer integration. I'm sure it will be more stable in the future, but IMHO it is not there yet.
Ryan
+1  A: 

I can't really talk about Mercurial, bit I can confirm git is written in C. Take a look at the gitweb for the source.

As for needing the commandline for everything to do with git, you don't necessarily need to. There's a tool called TortoiseGit which integrates with the explorer shell and will manage your git repositories for you - if you use Eclipse there's also EGit. On Linux, there's QGit although the CLI is much more powerful.

I'm a Linux/C developer and so naturally prefer Git; I too have heard good things about Mercurial though, I've just never bothered to learn it.

Ninefingers
+11  A: 

Git Pros:

  • Ultrafast (scales well to very large projects)
  • Extreme flexibility
  • C tools that fit in well with the Unix philosophy

Git Cons:

  • Steep learning curve
  • GUI tools exist, but (IMO) are not all that solid

HG Pros:

  • Very fast (though not as fast as GIT) -- Delays shouldn't be a significant problem on a project of 15-20k lines
  • Nice GUI tools, even on Windows (TortoiseHg is good and very mature, and there are others as well)
  • Well documented, and even the windows version has a nice GUI with a graphical view of changesets
  • Slightly easier learning curve than GIT (imo)

HG Cons:

  • Somewhat slower than git
  • Possibly a little bit less flexible

There are other significant differences, but these are the most significant in my mind. Honestly, if I were mostly working on Windows, I would go probably go with Mercurial.

jsight
@jsight, thanks for answering. Could you tell me, if you've used both, how does hg handle repos ? Just a subdirectory in a project directory, or ... ? Can I just copy it somewhere along with the project directory ? ... that was one of the very nice git features I really liked about it.
richard
@Richard: Yes. A good intro: http://hginit.com/
Douglas
@Douglas: I was about to recommend that. Entertaining and provides a great overview of the typical workflow.
intuited
@Richard - Yes, hg just has a .hg dir structure. Its easy to just copy a whole folder (including .hg) to keep the whole history for a repository.
jsight
This answer doesn't answer what problems could be experienced during the switch. But still, quite a lovely answer!
Maxim Zaslavsky
@Douglas, intuited - a wonderful intro :))) Just starting to read it :)
richard
The "steep learning curve" of git is a myth. It's pretty easy to learn.
hasen j
@hasenj - I disagree, and I love git. Coming from SVN, it was quite a learning curve. It really wasn't until I found an article explaining the core of git that things really started making sense and I could see why git was better. I don't know if I would say steep, but it definitely had a greater learning curve than other VCS's
mozillalives
@mozillalives: maybe because you were in "svn" mode? http://hginit.com/00.html
hasen j
+6  A: 

In terms of your points:

  • Mercurial is better for Windows users - easier to install, no wacky terminal corruption :) - basically more with less work, IMHO.
  • Git is faster than Mercurial - benchmarks show this. This is, as you said, because Git is written in C. I don't find Mercurial that slow, though, to be honest.
  • If your friend uses Mercurial, use Mercurial for that project. They are very similar in their basic interface and functionality - I could pick up Hg very easily coming from Git.
  • I may be wrong, but my perception is that Git has a bigger user community, probably due to it's use by the Linux kernel.
  • Thanks to the commenters: Git has Github - one of the best code hosting sites ever. (Trust me!)
  • A lot of high-profile projects use Git (the kernel, Rails, JQuery) - the Github repositories page is interesting - I am amazed at how many projects I recognise and use on a daily basis use Git!
  • Mercurial has a really, really good tutorial written by Joel Spolsky at hginit.com. It is the best tutorial on source control I've ever read! :)
Lucas Jones
The thing that I noticed about git ... and I have to admit it worried me a little in the beginning, is that for example, on this site, a lot of people are asking a lot of questions about it. So I thought, it must be complicated. I didn't find it *that* hard so far, but I'm only an amateur using it. I don't know is it because mercurial is really easier to understand, or is it that it has less users (judging only by the number of questions posted).
richard
i would think the speed difference is mainly down to git having slightly more compact repositories. file and network IO would dominate surely?
jk
Git does seem to be used on more projects. Also it has github, which is so Awesome™ that people have been wanting to use it for mercurial projects. So they wrote a bridge module (hg-git) that will let you push from mercurial to git repos or pull from git repos to mercurial. It's said to be very close to a full translation with no loss of information.
intuited
@Richard: I wouldn't be too worried - look at it as: there's more questions that have already been answered for me!
Lucas Jones
@jk: Quite possibly. I'm not an expert at Git/Hg internals, but network does have a big impact. I remember watching a Google TechTalk with Linus Torvalds on Git which discusses some of that, IIRC - http://www.youtube.com/watch?v=4XpnKHJAok8.
Lucas Jones
@intuited: Yes - a lot of high profile ones as well (Rails, etc.). Github is definitely Awesome™ - I use it, and it is much easier to use than I expected.
Lucas Jones
@Lucas - indeed. I've just started reading it (someone in here already mentioned it) ... it is actually fun to read.
richard
@richard, most git questions on SO are for advanced operations
hasen j
@jk: actually speed isn't really different, but Hg usually has better IO patterns do to the way it stores stuff (it tries to avoid seeks).The benchmark page that was linked is quite old, almost all of them use hg pre 1.0. (it's 1.5 now).
tonfa
@tonfa: I imagine that for most small projects, the speed is very similar. The speed advantage of Git becomes apparent in very large projects, such as the kernel.
Lucas Jones
@Lucas, the target for hg was kernel-size repo too, they both were built with the same purpose in mind.
tonfa
@tonfa: Huh. I didn't know that. :) I think Git still performs faster right now, though.
Lucas Jones
@Lucas: Both Mercurial and Git was made by kernel hackers (Matt Mackall and Linus Torvalds) and meant to be used for the Linux kernel after the developers could no longer use Bitkeeper. Since Linus put his weight behind Git, that is of course the official system for the kernel, but he has said nice things about Mercurial too and there even is an updated Mercurial mirror: http://www.kernel.org/hg/linux-2.6/
Martin Geisler
Interesting... I didn't know that. :)
Lucas Jones
Git isn't faster "because it is written in C", it is faster because the algorithms and data structures chosen, from the ground up, are purpose specific. You have to be careful about what assertions you make. In truth you could get similar performance if it was written in C++ or a hybrid model mixed with a 4th generation language / glue-language.
Hassan Syed
+3  A: 

I'll take it point by point...

I consider Hg relatively intuitive, easy to use and, when that fails, well documented.

Mercurial had an edge on Windows, but I believe Git improved there as well so it's probably not a good differentiator.

As far as the user interfaces go, you might consider TortoiseHg (the Windows shell integration you mentioned) to be of use if you don't like the command line. Working on Windows, I don't blame you. :)

Mercurial creates repositories the same way Git does: one, hidden subdirectory under the root direcory. You can move it around however you like (put it on a stick, take it elsewhere etc.) Why was that a problem with svn?

I'm happy to say that, considering Hg a tool to get a job done, I haven't felt the need to find a "good book". There might be some, but the available on-line docs were more than adequate for what I wanted to do.

I don't believe there's a performance difference worth mentioning, especially not with the kind of code base you have.

To conclude, I'm a Mercurial user (haven't used Git, but have read about it a bit) and it's rare that I enjoy using a software product because 95+% of the time, they're raw, have rough edges, bugs etc. Mercurial is truly a solution I enjoy using and would heartily recommend!

Tomislav Nakic-Alfirevic
+5  A: 

First, let me say I'm not a professional programmer, but an engineer who had a need for it and had to learn.

Engineer here, too. I've used Mercurial, Subversion, BitKeeper, and CVS. Haven't made it to Git yet.

I heard that hg is rather more user friendly towards windows users, regarding the user interfaces.

Not sure what was meant here, Git and Mercurial are both command-line tools at heart.

How does it handle repositories?

It's a distributed version control system (DVCS), just like Git.

Does it create them the same way as git does (just one subdirectory in a working directory) and can I just copy the whole project directory (including git repo) and just carry them somewhere with no extra thinking ? (I really liked that when I was choosing over git/svn).

Yes. Mercurial's repository lives in a .hg directory in the working directory. Also, Mercurial has a naming system in its repository to prevent filename collisions if you use it with a case-insensitive filesystem like FAT, NTFS, or HFS+.

Are there any good books on it that you can recommend (something like Pro Git, only for Hg).

I'd recommend the web site: http://mercurial.selenic.com/guide/

What are good ways to implement hg into Visual Studio/GVim for Windows, or into Windows Explorer so I can work relatively easily (I would like to avoid using the command line for everything regarding it, like in git shell).

There's a tool called TortoiseHG, available from the Mercurial download page. I can't attest to how good it is, since I usually just use the command-line version via Cygwin.

I've also heard git is c project, while mercurial is python ... is there any noticeable difference in speed. git was pretty speedy ... will I encounter some waiting while working.

Mercurial is pretty darn fast. I don't know about how it stacks up with Git, but it's a lot faster than Subversion.

Notice: All my projects are of let's say, middle size ... mostly numerical simulations ... 10-15000 lines (medium size?)

Sounds like my stuff. Not counting raw data, of course.

And off topic...

Most of my stuff is done in C/Fortran/Matlab and so far I've been learning git to manage it all.

I've been moving from Matlab to Python recently...

  • No license and maintenance crap to worry about.
  • It's all open source.
  • NumPy, SciPy, and MatPlotLib do most of what I need.
  • I can take my code and easily integrate it with socket-based code to talk to instrumentation. (I love being able to generate a waveform, download it to a function generator, wait for the scope to trigger, grab its trace and statistics, and put all that in a loop.)
  • I can integrate it with PyGtk, PyQt, a web server, a PDF generator (ReportLib), and who knows what else.
  • I can ship my Python-based code without having to deal with licensing or royalties.
  • Python is way better for disciplined software development than Matlab. Matlab's one-function-per-file and one-directory-per-class stuff is insane.
  • Python is easier to extend with C and C++ code. The libraries out there are better.

Just a thought.

Mike DeSimone
To be more exact Mercurial is in Python, with some core parts in C for performance.
Jakub Narębski
There is Scilab and Octave, which are open source equivalent / replacement for Matlab.
Jakub Narębski
@Mike DeSimone - Always nice to meet a fellow engineer! / Raw data isn't that much of a problem at my side. More of a problem are temporary files (can grow large) during the execution of the program. But I won't keep *them* in vcs. As far as Matlab/Python, yes, I agree. It definitely has some advantages. But, one sometimes cannot chooce what he will end up with, and we had matlab licences, I grew accustomed to it (long time now), and so it goes ... originally, I'm a fortran programmer, then matlab, then c (so to speak). I like python and have been reading about it in the recent
richard
times, but time is always short, and at this point, I don't see what it can help me with, (that those cannot handle), which would pay off my time learning it. Maybe one day ... the language definitely has a future. Although I don't really like that they change stuff between versions.
richard
@Jakub: I've looked at Scilab and Octave. While I feel they are good efforts, I don't think that the way Matlab does things is the way I want to go. Especially since one of our forever problems is that we would have to write things in Matlab and then reimplement in C++ to integrate an algorithm into a shipping product (and, no, the Matlab compiler doesn't cut it for deployment reasons), and then have to deal with keeping the two in sync and proving their equivalence every time something changes. A coworker without these hangups considered Octave and had problems with project politics.
Mike DeSimone
@richard: I meant that raw data that tends to be disproportionately huge compared to source code, so it gets its own storage solution anyway. As for moving to Python... I find Python to be a lot easier to deal with than C and not much slower. No makefiles; things like callbacks are trivial to do, since a function is an object just as much as a string is; strings can be arbitrary length and can contain nulls, and thus work with binary data easily; the struct tools make packing and unpacking structures easy, even fixing byte order... I can go on forever. Learn it at your own pace.
Mike DeSimone
+3  A: 

I'll recommend hgbook (Mercurial: The Definitive Guide) and hginit (Hg Init: a Mercurial tutorial. A friendly introduction to the Mercurial DVCS by Joel Spolsky.)

See also my answer in Git and Mercurial - Compare and Contrast SO question.

Jakub Narębski
+2  A: 

My transition from Git to Mercurial has been a lot easier after reading A Guide to Branching in Mercurial, which also refers to the Git way of branching.

If you have IIS 7, you can easily set up a Mercurial server: Setting up a Mercurial server under IIS7 on Windows Server 2008 R2, and you can easily find tutorials using IIS 6 or Apache2. Of course, for a quick sync hg serve is invaluable: using "hg serve" to push changes

Visual Studio integration:

Free hosting:

For guides and tutorials you can start at the Mercurial wiki.

alexandrul