confused about switching branches

Matt Mackall mpm at selenic.com
Mon Aug 22 00:10:53 CDT 2005


On Mon, Aug 22, 2005 at 06:01:13AM +0100, Sanjoy Mahajan wrote:
> I'm going through the 'notes.txt' and clarifying what I find
> confusing, eventually to put it on the Wiki.  By doing small
> experiments, and using 'hg debugstate' a lot, I've understood matters
> until about halfway through, i.e. until the nuts and bolts of merging:
> 
>   It decides when a merge is necessary by first determining if there
>   are any uncommitted changes in the working directory. This
>   effectively makes the working directory a branch off the checked in
>   version it's based on. Then it also determines if the working
>   directory is a direct ancestor or descendent of the second version
>   we're attempting to checkout. If neither is true, we simply replace
>   the working directory version with the new version. Otherwise we
>   perform a merge between the two versions.
> 
> A small experiment (v0.6b) suggests otherwise.  The changeset graph
> (from 'hg debugstatedot') looks like:
> 
> -1 -> 0 -> 1 -> 2 -> 3 -> 5 -> more stuff
>                  \-> 4 - /    

Please try the tip, I seem to recall fixing this.

> The update() function in
> hg.py (line 1258) has a possibly related asymmetry:
> 
>         p1, p2 = pl[0], node
> 
> Why is the pl[0] parent preferred over the pl[1] one?

Dirstate is relative to the first parent.

-- 
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial mailing list