Subject: Re: [boost] [git] Mercurial?
From: Martin Geisler (mg_at_[hidden])
Date: 2012-03-22 06:57:10
Julian Gonggrijp <j.gonggrijp_at_[hidden]> writes:
> Julien Nitard wrote:
>>> That's actually not true. DVCS tools are not magic and when there is
>>> a genuine conflict in SVN (the same region was editited in parallel
>>> by two developers) then you also get a conflict in Git and
>> Could you please confirm this ? I am not an expert on that, but it
>> seems that the diff algo in Git and Hg is completely different. For
>> instance it is able to detect that lines were moved rather than some
>> lines deleted and some (unrelated) lines inserted in the SVN way.
> I've heard about that too, even that git (and probably also hg) is
> able to detect that some lines moved from one file to another. I
> haven't observed that neat trick by myself yet (not sure whether it
> didn't happen or I just wasn't aware of it) and I can't remember where
> I read about it.
It seems that everybody has heard of this magic... but nobody has
actually seen it, and nobody can remember where they read about it :)
> I think it doesn't necessarily need to have something to do with the
> diff tool; the magic could also be in the algorithms that process the
> diffs or perhaps in the use of hashes. In fact I suspect it's not in
> the diff tool, since you can configure git to use a different diff
Right -- both Git and Mercurial let you plug in merge and diff tools.
The diff tool is used for presentation: you can add a 'hg oodiff'
command that will diff OpenOffice documents for you. It's just
post-processing, but still very nice.
The merge tool is called when there is a conflict. It is called with
three files: ancestor, mine, yours. It can do whatever it want to merge
the files. It can for example analyse the history from ancestor to mine
and from ancestor to yours and detect moved code and act accordingly.
> That said, when two developers really edit the very same line in
> parallel (say one changes it to all uppercase and the other to all
> lowercase), of course there is no way that any tool in the world would
> be able to resolve the conflict.
-- Martin Geisler aragost Trifork Professional Mercurial support http://www.aragost.com/mercurial/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk