News for hackers. Stuff that matters.
Re:Mercurial 4.0 Sprint Notes by lucideer on Tuesday October 18, 2016 @12:27PM (#12736061)
The biggest technical difference is the mostly immutable history, which is a feature or a drawback depending on who you talk to.

More subjectively, most people I've chatted to about it seem to find Mercurial's interface much easier to grok / pick up as a new user than Git's (which is somewhat notorious for its quirks).

There are other differences, but these stand out to me. That said, I use Git because adoption + community (and my experience with hg-git has been less successful than some... though it's been a while since I gave it a spin)

Re:Mercurial 4.0 Sprint Notes by marcinkuzminski on Tuesday October 18, 2016 @12:46PM (#12736276)
CTO of RhodeCode here.

If you use phases (draft/secret/public) correctly it's really close to being mutable. For example all our devs forks are having non-publishing repositories since it's a private non-shared space. By keeping all commits as draft it's easy to do a rebase and then push new changed commits.

While the main repo is publishing and once pushed commits are never mutable, also we keep a workflow that only dev forks can have multiple heads while production repo cant.

IMHO it's the nicer form of mutability

Re:Mercurial 4.0 Sprint Notes by Bjartr on Tuesday October 18, 2016 @04:40PM (#12738465)
Do you have or know of writeups describing this workflow in more detail? I'm interested in learning more.
Re:Mercurial 4.0 Sprint Notes by ngoldbaum on Tuesday October 18, 2016 @04:58PM (#12738656)
This workflow is described in the documentation for the mercurial evolve extension: https://www.mercurial-scm.org/doc/evolution/
Re:Mercurial 4.0 Sprint Notes by marcinkuzminski on Wednesday October 19, 2016 @07:50AM (#12742936)
Here's a blog post on how to use Bookmarks in Mercurial workflow using code-review. We back ported from one of the guys that works for us and described our workflow:

https://rhodecode.com/blog/120/mercurial-workflow-using-book...

Re:Mercurial 4.0 Sprint Notes by jjnoakes on Tuesday October 18, 2016 @06:28PM (#12739294)
Can you elaborate on what you mean by immutable history, and how git lacks it?
Re:Mercurial 4.0 Sprint Notes by lucideer on Tuesday October 18, 2016 @08:45PM (#12740044)
In git you can edit past commits and rebase, which completely destroys historical data and traces of the rebase. This can be very useful, e.g. for keeping a frequently-committed-to branch "clean" and informative by squashing commits, for removing accidentally committed sensitive credentials, etc.

Mercurial, on the other hand, is architecturally set up in a way that considers the repo history to be a somewhat "sacred" truthful account.

You still get the same flexibility as git if/when you need the above mutability: it's not 100% immutable, it supports local rebases, and also global mutablity via "phases" - see Marcin's post on this. In an absolute worst case scenario you can also coordinate reclones of a repo of course, but generally speaking the point is that immutability is "on by default".

Re:Mercurial 4.0 Sprint Notes by jjnoakes on Wednesday October 19, 2016 @08:13AM (#12743051)
I'm sorry, I still don't see the distinction. It sounds like in both systems the default is immutability, with commands to override that if necessary.

And by the way, doesn't git rebase not mutate history? I believe it creates a parallel history (and updates the branch and head refs to point to the new history) but the old history still exists in git's storage and can be recovered (until you GC your storage).

Re:Mercurial 4.0 Sprint Notes by jordigh on Wednesday October 19, 2016 @01:37PM (#12745849)
In git, you `git rebase` any commit will always do whatever you tell it to do.

In Mercurial, `hg rebase` will abort if you're trying to make it do something to public commits. Public commits are commits that have been shared on a publishing server. The contrast with draft commits, which are commits that have not been shared or only shared on a non-publishing server.

If you really want to edit public commits, you have to manually force them back to the draft phase before you can rebase or rewrite them.

Re:Mercurial 4.0 Sprint Notes by jjnoakes on Wednesday October 19, 2016 @02:26PM (#12746328)
If you "git push" after rebasing published commits, you get an error, unless you use "--force" or you pull and merge manually before hand.

So I'm still not sure the distinction you are making between which one is "immutable" and which one isn't.

Re:Mercurial 4.0 Sprint Notes by jordigh on Wednesday October 19, 2016 @03:10PM (#12746762)
Phases catch this problem early before `git push`. You don't want to run into the problem too late. Then you'll be faced with the decision to throw out your work because you accidentally rewrote something that should not have been rewritten. Or you'll have to decide at the last minute that you really did mean to make problems for everyone else.

Btw, with Mercurial Evolve, there's no need to force-push, as Evolve will propagate meta-history to other users that indicates what commits replace which ones.

Re:Mercurial 4.0 Sprint Notes by jjnoakes on Wednesday October 19, 2016 @03:22PM (#12746874)
Ok so it has nothing to do with immutability, it's just one warns earlier than the other.

Thanks for clarifying.

Re:Mercurial 4.0 Sprint Notes by jordigh on Wednesday October 19, 2016 @03:27PM (#12746922)
It is about immutability. No Mercurial command (histedit, rebase, uncommit, amend) will allow you to change an immutable (public) commit unless you first force it back into the draft phase.

You can say that because you can always force public commits into drafts that they're not really immutable, but that's a bit of a perversion of what Mercurial's phase system is intended to do.

Re:Mercurial 4.0 Sprint Notes by jjnoakes on Wednesday October 19, 2016 @04:11PM (#12747274)
And no git command lets you change what public history looks like unless you --force the push.

So the check is in a different place. That doesn't seem to me to imply that Mercurial's history is "immutable" and git's is "mutable", especially since those words have precise meanings, and even WITH the --force, git doesn't change anything in the history, it just writes out a new history and updates the branch ref to point to the new history.

The only thing mutated (in both systems) is the ref to the branch head, right? So aside from warnings and errors being in different places (both before publish time), what is the difference between the two that leads you to argue that one is immutable and one isn't?

Re:Mercurial 4.0 Sprint Notes by marcinkuzminski on Wednesday October 19, 2016 @04:15PM (#12747313)
I think what Mercurial brings here is that even if you have a repo and you do a force-push you keep all the heads. Thus it's almost like a history of changes.

I think if you do a code-review and you get the final state of the repo to check, you can nicely tell how it was evolved/squashed/re-ordered.

I find that workflow much more useful than just rewriting history like in git (i know about reflog)

Re:Mercurial 4.0 Sprint Notes by RandomOpinion on Tuesday October 18, 2016 @08:01PM (#12739820)
To add my 2 cents, immutable history is more of an annoyance than anything. If someone checks in something by mistake that absolutely must be removed (e.g. something that contains a password), it is a considerable undertaking to actually remove that commit from the repository.
Re:Mercurial 4.0 Sprint Notes by agentgt on Wednesday October 19, 2016 @09:02AM (#12743343)
It is not hard once you know how to do it is just not readily documented (ie histedit and force push).

BTW if you checked in a password... you really should now go change that password :)

Re:Mercurial 4.0 Sprint Notes by RandomOpinion on Saturday October 22, 2016 @02:47PM (#12769994)
I know better than to check in passwords, thank you very much. Regrettably, some of my colleagues do not.