Unnecessary merges?

David Smith dsmith at travelrepublic.co.uk
Fri Nov 22 11:07:59 CST 2013


Afraid I'm still confused.

To make matters a bit more confusing part of the history includes a rename.

Using TortoiseHg I see the following in A (while in the process of running hg merge)

[cid:image001.png at 01CEE7A4.491181E0]

and in B

[cid:image002.png at 01CEE7A4.C451A1A0]

to me this indicates that the two heads where merged in B and in A we have no more work to do.
However this results in a  merge conflict (on an indent).

You have got me thinking. We usually work through a remote repository (which will only ever have one head).

In this case the work was pulled from a repository that could potentially have had multiple heads at the time it was pulled.
Not sure if this is part of what is confusing us.

From: Kevin Bullock [mailto:kbullock+mercurial at ringworld.org]
Sent: 22 November 2013 16:28
To: David Smith
Cc: mercurial at selenic.com
Subject: Re: Unnecessary merges?

On Nov 21, 2013, at 8:10 AM, David Smith <dsmith at travelrepublic.co.uk<mailto:dsmith at travelrepublic.co.uk>> wrote:


Hi,

I have two repositories A and B.

I have pulled B into A.

For a given file on A hg log returns

changeset:   40967:d7f84148b444
parent:      40966:afbd3f7ddeea
parent:      40730:8658f8a70bd5
user:        anon <anon at outlook.com<mailto:anon at outlook.com>>
date:        Tue Nov 05 11:52:13 2013 +0000
summary:     merge from B

changeset:   40894:7f667abe8948
user:        anon
date:        Wed Oct 16 11:53:13 2013 +0100
summary:     Refactored some code

and on B hg log returns

changeset:   40570:d7f84148b444
parent:      40402:afbd3f7ddeea
parent:      40569:8658f8a70bd5
user:        anon <anon at outlook.com<mailto:anon at outlook.com>>
date:        Tue Nov 05 11:52:13 2013 +0000
summary:     merge from B

changeset:   39676:7f667abe8948
user:        anon
date:        Wed Oct 16 11:53:13 2013 +0100
summary:     Refactored some code

The two graphs appear identical and there are no commits in A for the file that aren't in B and vice versa.

However merging the two heads in A requires a conflict to be resolved for this file.

I guess (I hope) I'm missing something. What cases could cause Mercurial to think it needs to merge these two graphs?

Because you have two heads. You now have precisely the same 2 heads in A as in B—you have fully synchronized their history—but that history has more than one head in it. Pulling doesn't change that (unlike in Git, a pull does not also imply a merge). `hg log --graph` will help you visualize this.

pacem in terris / мир / शान्ति / ‎‫سَلاَم / 平和
Kevin R. Bullock

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial/attachments/20131122/f2de88bb/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 9056 bytes
Desc: image001.png
URL: <http://selenic.com/pipermail/mercurial/attachments/20131122/f2de88bb/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 9277 bytes
Desc: image002.png
URL: <http://selenic.com/pipermail/mercurial/attachments/20131122/f2de88bb/attachment-0001.png>


More information about the Mercurial mailing list