142 points · by arunc · 12y ago · 182 comments
In addition, I found it to be slower, less flexible, and prone to permanent repository corruption - yes, in git you do see repo corruption but because of the cryptographic nature of git objects you know immediately. HG will (did?) happily let you work away at a corrupted repo for weeks until a fresh clone was attempted and the dreaded repo corrupted message killed development for days until the problem was painstakingly manually fixed.
This is just personal experience and a lot of it comes down to taste, but IMO if you are already proficient with git there is absolutely nothing about mercurial that is preferable and some considerable downsides I have been subjected to.
Disclaimer: This was a few years ago now, perhaps the project is more mature than it was.
Mercurial has come a long way in the last few years. While I used to see repo corruption semi-frequently, I have not seen it once in the last year or so. This can be attributed to bug fixes and less reliance on mq. mq is a giant hack on top of Mercurial's storage model and there were many corner cases in older Mercurials where mq could lead to repo corruption. I use the experimental evolve extension now, but I can't yet recommend that to the masses because it's very rough around the edges. Hopefully in the next 6-12 months.
I strongly disagree with the statement that Mercurial is less flexible than Git. I find Mercurial to be more flexible. If you don't take my word for it, ask Facebook [2]: "Our engineers were comfortable with Git and we preferred to stay with a familiar tool, so we took a long, hard look at improving it to work at scale. After much deliberation, we concluded that Git's internals would be difficult to work with for an ambitious scaling project." The article goes on to describe some key areas where Mercurial is more flexible.
Some things possible in Mercurial that aren't with Git:
* Extending the wire protocol. Git's wire protocol is the exchange of objects (key-value pairs) and refs to said objects. Mercurial's is command-based and you can have client and server talk their own commands.
* Revision sets [3]. Extremely useful feature. See [4] for how I've used this as Mozilla.
* Phases. Mercurial knows when you are changing a published and should-be-immutable changeset/commit and by default prevents you from footgunning yourself.
* Changeset evolution. The mindset about "pushing rebases is evil" has its roots almost completely in limitations of tools. Changeset evolution removes that limitation.
As I wrote at [1], I believe the future of Mercurial is bright. Don't discount Mercurial because of past experiences with ancient versions or because you assume the Git way is the only and right way.
[1] http://gregoryszorc.com/blog/2013/05/12/thoughts-on-mercuria... [2] https://code.facebook.com/posts/218678814984400/scaling-merc... [3] http://www.selenic.com/hg/help/revsets [4] http://gregoryszorc.com/blog/2013/11/08/using-mercurial-to-q...
From my understanding, the terminology and behavior of Mercurial is more in-line with other SCMs out there (like SVN), while Git seems to do things a bit differently. A lot of it is terminology differences or default behavior for various commands.
> I found it to be slower, less flexible,
Mercurial should be about the same speed as Git now adays. I'd be interested to hear what parts of HG you thought were slow. Also, for flexibility, Mercurial disables a lot of more advanced features by defaults (anything that could get a developer in trouble or mess with history). All of the extensions that ship with Mercurial are officially supported and can be used if you want that functionality.
> prone to permanent repository corruption
I'd be interested to hear if you ever found out what caused your problems. Mercurial has a page talking about this [0].
> IMO if you are already proficient with git there is absolutely nothing about mercurial that is preferable and some considerable downsides I have been subjected to.
For almost all features, I'd totally agree. There are 3 things in Mercurial that I see as an advantage over Git. (1) named branches (every commit on the branch will be tagged with the branch name). (2) LargeFile[1] extension for handling very large files you don't want people having to pull, though this breaks DVCS concepts. (3) A future feature that looks really promising, ChangesetEvolution[2], that will basically allow history rewriting that can be pushed to others.
[0] http://mercurial.selenic.com/wiki/RepositoryCorruption
If you give the developers the choice, they would drop git and go back to mercurial.
A likely one is that the benefits of a switch wouldn't outweigh the costs, at least not within a reasonable timeframe.
Another is that there may not be resources to dedicate to such an effort, even if the return would be suitable.
And yet another could be management buying into all of the git hype we've been subjected to a lot lately. Git (and GitHub) today are like Ruby on Rails was a few years back. Even though there are several alternatives, some of them much better in some ways, they just don't get the media attention, and thus don't get hyped, and thus don't get onto the radar of managers who decide which VCS to use, and thus don't see as much use, and thus aren't even seen as viable options by said managers.
Many of those customers have been sold to git hype before getting us on board.
To be fair: I believe mercurial commits enjoy the same level of protection, although via different means.
It should be noted, however, that Linus and others specifically disclaim that this is a security mechanism:
"Git uses SHA-1 in a way which has nothing at all to do with security.... It's just the best hash you can get.... It's about the ability to trust your data." --Linus (http://en.wikipedia.org/wiki/SHA-1#Data_integrity)
And in the midst of a discussion about how only professional cryptographers should design crypto, pretty much everyone insists that Git is not crypto (see replies to: https://news.ycombinator.com/item?id=6961683)
Actually they have almost exactly the same Merkel tree (there are some minor differences in the metadata that is included, mercurial also includes the file level parents while git does not, for example).
The inspiration came from Monotone.
mercurial does pretty much the same, as far as I know.
> so if you verify each commit
But surely that does not happen on every CLI operation does it? So you only find out about corruption when all the repository is traversed and checked, which will usually be explicitly or on clone. Thus the same as hg.
Edit: I was wrong and changed all the words
I prefer (and use) git myself, but it took awhile (and much of my developer/friend network to go first) for me to commit to the switch from subversion...my main issue was that subversion worked well enough for what I needed/wanted at the time. I didn't really switch until it became harder to work with others because of my subversion use and easier to work with others if/when I adopted git.
git doesn't run fsck on the entire repo for each operation, and unless you fsck or clone you won't detect corruption for quite a while.
it's exactly the same for hg, which is built on the same hashing concept as git (actually the other way round, as hg came first).
but this os pointless, the keyword in your post is "forced".
https://lists.gnu.org/archive/html/emacs-devel/2014-01/msg00...
Tl;dr: Mercurial is a free software project sharing GNU's goals, while Git is made by anti-GNU people who do not believe in free software and has an incompatible license.
WTF? Git is GPLv2 - the exact same as the Linux kernel. A great many developers are avoiding v3 due to the changes it made. And "anti-GNU people" is just a lame insult.
However, Linus Torvalds (Linux and git) has no problems with non-free at all and in fact wanted to support the production of such systems. Like many users of the GPL2 he never actually shared the goals of GNU.
Git's license was deliberately chosen to support the building of non-free systems. According to GNU ideology that is evil. If you are a GNU contributor you are not supposed to even link to non-free solutions. So yeah, of course the hardcore GNU ideologues do not like git or the people behind it.
(Except in the eyes of zealots, but who cares about them?)
Plenty of people share the (publicly stated) goals of the GNU project regarding free software, but disagree with the FSF's approach to realizing those goals, particularly with the GPLv3. (With the GPLv2 I merely thought that the FSF's approach was more restrictive than was necessary, with the GPLv3 and the use-based discrimination in the anti-tivoization clause, I find it actively harmful.)
Not necessarily true... it might simply be that they feel the goals of GNU are better pushed for via means other than GPLv3.
E.g. read a statement by Linux kernel devs regarding the second draft of GPLv3: http://lkml.org/lkml/2006/9/22/217
Has nothing to do with not supporting the goals of GNU, and more to do with not introducing end use restrictions (which is a significant restraint on software freedom), the risk of balkanizing the FLOSS community (which has actually come true to some extent), etc.
My point was that in the context of Emacs, arguably the GNUest of the GNU, being anti-GNU is nothing to scoff at. Indeed, bzr was chosen for a long time because it was an official GNU project and was usable enough.
The hg devs went through great pains to change the license from GPLv2 to GPLv2-or-later. Lead dev Matt Mackall calls himself a free software advocate (not open source) is good friends with the likes of Bradley Kuhn and Eben Moglen of Software Freedom Conservancy and the Software Freedom Law Center respectively, and makes a point about defending Mercurial's copyleft. Ideology being important for GNU Emacs, it also seemed important to me to argue in favour of Mercurial on these grounds.
That Mercurial also happens to be fast, featureful, innovative, and generally kickass is a nice cherry on top. Its only significant drawback is that it's not as popular as git.
It is an insult? Like "people with common sense" or "individuals of sound mind"?
Luckily, that particular argument is thoroughly rebutted downthread. Choice quote: "Emacs shot itself in this foot already" by choosing Bzr, GNU's blessed VCS, for such political reasons. (Worth noting: RMS raised no strong objections to Git.) Also, the OP is called out for not understanding the driving reasons for moving Emacs to Git.
Edit: Corrected reference to Hg's license; it's GPLv2+, not GPLv3.
I find git's GPLv2-only license to be a disadvantage when
contrasted with hg's GPLv2-or-later. For example,
this makes it more awkward to combine git with AGPL code, which is
something that we reasonably might want to do for web front-ends.
GPLv3 and AGPL have mutual cross-compatibility clauses with each
other, but AIUI, GPLv2-only and AGPL don't.
Incompatible in this context mean that "GPLv2 only" is causing more license incompatibilities than gplv2+.Jordi Gutiérrez Hermoso:
[...] main argument in favour of hg is not technical, but
rather social. For GNU, I think it is far more important
to support a project that aligns with GNU's aims [...] GPL2+
Reply by Eric S. Raymond: +1. And I say that as someone who *likes* hg and wishes
it had won. Repeating the bzr mistake would be stupid, stupid, *stupid*.
Edit: Raymond replied to Kastrup who replied to Hermoso.The discussion evolved in the meantime, so it's probably better to read the thread yourself: https://lists.gnu.org/archive/html/emacs-devel/2014-01/msg00...
Not even worth replying to, in my opinion.
Mercurial could be 10% better than git, but unless it's 500% better, it will never displace it.
And when I personally engage in mercurial advocacy it with an understanding that as you say, unless it's 500% better than git – which it is not – it will never displace git. However hg is every bit as good as git and most of my advocacy (as in this mail) is merely point this fact out and dispelling quite a lot of FUD, which seems to pop up in these discussions.
My goal is to see Mercurial continue in its position as the Mac (or Linux) of dvcs' to gits Windows. That is as an honest, respectable choice that you might, or might not make for valid reasons.
Where Mercurial falls short to me is that if you create a branch in your main repository like that, then it never goes away as far as I can tell. What Mercurial really wants you to do is clone your repo, and do that work that would be a Git branch in the clone. But to do that, you have to start with a clean repo, actively decide you want to create a new branch/clone, clone your repo, and only then start doing that work in the clone. If you've already done some work, and then decided that a piece of it ought to be branched off, then your workflow is pretty messy - you have to clone with the work uncommitted, then manually move the changes over to the clone and commit them there. And switch any working directories you might have open to the clone directory to work in it.
Yeah, no thanks, I'll stick with Git.
`bookmarks` will do that. Or you can use unnamed heads and track them manually[0] (that's essentially what bookmarks — and git branches — do). "Detached heads" are not a thing in mercurial, heads don't have to be named.
[0] obviously there's nothing to track if you're just going on a short tangent, just commit your stuff, and go back to the original to merge if it was a good idea or forget if it was not. And yes you can create a bookmark "after the fact" e.g. do half a dozen commits, realise that it's going to take longer than you thought and create a bookmark for the current experiment on the tip.
It's a beautiful thing, really <tears up a bit..../>
In my opinion, this is not all good although it clearly solves a problem. Having two somewhat non-orthogonal features for branching undoes a part of the easier learning curve argument. You end up having to educate people whether to use bookmarks or branches and in what situations.
If branches are permanent, who are allowed to create branches? Everyone or just maintainers/core developers? What if a would-be contributor creates a branch that isn't wanted as a permanent branch or has a bad name? Need to rename a branch or do some tricks to comply with the upstream conventions? It ends up being a similar social/political issue to git rebase vs. git merge.
The easier learning curve argument was more relevant when people were coming to hg from svn/cvs backgrounds. These days more and more people are coming from a git background.
Oddly enough, I find myself liking the simplicity of Git here. You can do pretty complex stuff with it, but having only one type of branch seems to help some. That, and the local-only stashsets, which seem to be intentionally kept as simple as possible. In Mercurial, you have named branches, unnamed branches, cloned repos, bookmarks, maybe some other stuff that I don't know about, and I'm not really sure how they all interact and what's used for what.
http://mercurial.selenic.com/wiki/ShelveExtension
It does pretty much exactly the same thing.
It's exactly the same thing git branches do. If it seems hacky, it's also hacky in git.
> At best, it would be as good as them, but then why not stick with the original?
Stick with what original? The originals in mercurial are branches (where the branch name is part of the commit metadata and thus of the repository's history forever, save for history rewriting) and "anonymous heads".
Then users clamoured for transient (movable, renamable, deletable) git-style branches, so bookmarks were added as an option.
> cloned repos
Erm… you can also clone repositories in git.
> I'm not really sure how they all interact
At the end of the day, it's all commit DAG.
That said, the handling of named branches remains a pain point, and at this point I would recommend people just go with Git despite the steeper learning curve.
Here's a blog post on how they are scaling hg for their monolithic repos https://code.facebook.com/posts/218678814984400/scaling-merc...
I've ever seen a convincing argument to choose hg over git. Sure you can do a lot of things with it and I'm sure it's perfectly fine to use, but if you know git, and you like git, there's no reason to switch. What does hg have that makes it better than git that you should give up git? Popularity is what git has over hg. Someone using git will probably never have to spend anytime worrying about learning hg, but an hg user will have to become familiar with git because git is used everywhere nowadays. So my recommendation to people new to versioning systems is to pick git. I can't for the life of me understand why someone would pick hg for an open source project unless they wanted to throw learning curves and barriers at developers, or they just really really liked hg (probably because they chose it over git a long time ago).
[1] http://mercurial.selenic.com/wiki/RevisionNumber
[2] http://stackoverflow.com/questions/8995598/can-i-mark-a-bran...
I don't get it. As a citation for your assertion that you can't easily have local branches, you link to a StackOverflow question for which the accepted answer explains how to easily have local branches.
What were you trying to say with that link?
Better user experience out of the box for Windows shops.
This might change with Microsoft's adoption of git for TFS, but you won't find many appraisals for git at my workplace. Many people still miss hg.
Mercurial being Python based has less UNIX feeling than Git on its workflow experience.
Plus there are better plugins for Visual Studio integration available then for Git.
Some of us use TortiseGit for logs, diffs, etc (we used to use TortiseSVN pretty much exclusively before we moved)
Nope. Revision numbers are just a convenience when you're working locally in a repo. Just like Git, each commit is uniquely identified using a SHA hash.
No again on the local branches. Again, Mercurial is even more flexible when it comes to branching that Git is: http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-me....
It's like using a different mail client or a different bug tracker; it doesn't affect what you can express or how can you build a program. It's just Version Control.
And it can take a significant amount of time getting to grips with a new one you are unfamiliar with.
And you can often quite easily get yourself in quite a serious tangle with complex merges and operations done with VCSs leading to a lot of cursing and hatred for a particular tool.
A pair of shoes is just a pair of shoes, but I'd still quite like a pair I find comfortable, thanks.
If they can convince themselves that the few things they know really well are the only things that are important to know, then maybe they don't feel bad about all of the things that they're just starting to realize that they don't know. That's my interpretation at least.
- Git is noticeably faster for all operations (yeah, specially if you don't use GitHub for pull/push as they're slow as hell ;-)
- Git has sensible default settings, for example, git log is easier than hg log|less. Similarly, git show HEAD^ is easier than hg log --patch --rev tip. (Both are easier to remember, type, and keep the logic across the tool).
- Finally, Git handles everything in a generic fashion. Want to make a test branch and play around? git branch blahtest and play. With hg, you have to use queues, and weird commands such as qpop, qremove, qseries, qnew <= this is very confusing to newcomers. Basically, I feel like Git knows how to KISS better than Mercurial.
cat >> ~/.hgrc
[pager]
pager = less -FRX
[extensions]
pager=
There, I fixed it.> Similarly, git show HEAD^ is easier than hg log --patch --rev tip
Wait, what? Those commands do completely different things. What are you trying to do?
Furthermore, the assertion that `git show` is "easier" than `hg log` seems odd on its face, why is it easier to have two different commands to see the same thing, with the only difference being the length of the revision set? (yes I know `git show` can also show other objects, but that's now how you used it here).
> Want to make a test branch and play around? git branch blahtest and play. With hg, you have to use queues
Uh… no. You can create a bookmark, or just commit stuff (hg has no prohibition against what git calls "detached heads", they're just anonymous branches).
You have to use MQ if you want to do quilt-type things. Used to be you also had to use it if you wanted to perform extensive history-rewriting, but that hasn't been the case for a few years now.
GP's point was about defaults, not what you can configure. Even being somewhat familiar with hg, I didn't know about the "pager" extension.
> `git show` does not show a patch by default[...]
It does for me, with git 1.7.9.5.
> (hg has no prohibition against what git calls "detached heads", they're just anonymous branches)
I have never understood why this is useful. Why not just name your heads something, anything? I wouldn't otherwise care, but I always seemed to end up with mysterious heads from who-knows-where left behind by long-ago merges.
Granted, but he then describes the difficulty of typing `hg log | less`. And defaults cut both ways, I still can't fathom why `git log HEAD` would display the whole repository history.
> It does for me, with git 1.7.9.5.
Doesn't for me with git 1.8.5.4. Regardless I removed that part since it's not the gist of the issue and the official documentation asserts it should.
> I have never understood why this is useful. Why not just name your heads something, anything?
Why is a meaningless name better than no name at all? Why is git's default behaviour of losing unnamed heads altogether better than just leaving them alone?
I know what you mean about hg not invoking a pager by default. I understand why the hg maintainers haven't done it, but it's still mildly annoying every time i have to throw in a |less.
I have no idea what you're talking about with queues. The last time i used queues was to do stashing back before hg got a proper shelve in the core. I don't think there's any sane use case which requires them now.
http://gregoryszorc.com/blog/2013/05/12/thoughts-on-mercuria...
tl;dr: "If you take anything away from this post it should be that Mercurial is a flexible and agile tool."
Seems having the right tool should be important.
Seems like that isn't the same situation. Rather the author should have asked " Windows and Mac OS X are also more popular; does this mean we shouldn't restrict developers to using a non-Windows, non-OS X system?" and the answer is quite simply "no, you shouldn't". Choosing a VCS means every needs to use that VCS. The same is not [necessarily] true for which operating systems can be used for development.
If you're okay with using closed-source services, Fog Creek's Kiln allows you to have repositories that can be accessed with both git and hg; commits/branches/bookmarks in one will show up in the other automatically.
It seems to me that this argument could be solved if someone went and built a F/OSS equivalent that did the same thing for the emacs devs.
One that I like that replaces my most frequent usage of magit is crecord: interactively select hunks for committing.
this is literally 'git add -p', and the -p flag can be passed to a load of different git tools to have this functionality?