Issue2007

Title hg pull --rebase merges in the wrong direction
Priority bug Status chatting
Superseder Nosy List abuehl, astratto, gward, jlebar, pmezard
Assigned To Topics rebase

Created on 2010-01-30.03:55:59 by jlebar, last changed 2010-01-31.21:49:45 by gward.

Messages
msg11554 (view) Author: gward Date: 2010-01-31.21:49:45
I think this is a general problem with rebase, not specific to 'merge --
rebase'.  It's annoying: if my current cset (first parent of working dir) is 
A and I run "hg merge B", then I get A=local and B=other.  But if I rebase A 
onto B, the relationship is backwards.  At the level of file merges, merging 
B with A should be the same as rebasing A onto B.
msg11545 (view) Author: jlebar Date: 2010-01-30.18:27:44
This was with hg 1.4.1.
msg11544 (view) Author: astratto Date: 2010-01-30.12:32:43
This is due to the fact that rebase first updates to 'target' and then
merges it with the branch that's to be rebased.

i.e., Given repo1 and repo2
Repo1:
 a - b

Repo2:
 a - c

hg pull --rebase in Repo2 means:
1 - pull b and we obtain:
 a - b
  \
   c

2 - rebase c onto b, that is "update to b and merge with c". Hence, b
becomes the 'local' revision.
msg11543 (view) Author: pmezard Date: 2010-01-30.11:27:50
What hg version do you have ?
msg11542 (view) Author: jlebar Date: 2010-01-30.03:55:59
When using merge=internal:merge, merge conflicts in an hg pull --rebase are
labeled incorrectly.  The chunk local to the current repository is labeled
"other", and the chunk from the remote repository is labeled "local".

Steps to reproduce:

~$ mkdir repo1
~$ cd repo1
~/repo1$ hg init
~/repo1$ echo 'ABC' > file
~/repo1$ hg add file
~/repo1$ hg ci -m "file contains ABC"
~/repo1$ cd ..
~$ hg clone repo1 repo2
~$ cd repo2
~/repo2$ echo '111' > file
~/repo2$ hg ci -m "file contains 111"
~/repo2$ cd ../repo1
~/repo1$ echo '222' > file
~/repo1$ hg ci -m "file contains 222"
~/repo1$ cd ../repo2
~/repo2$ hg pull --rebase
pulling from /home/jlebar/repo1
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
(run 'hg heads' to see heads, 'hg merge' to merge)
merging file
warning: conflicts during merge.
merging file failed!
abort: fix unresolved conflicts with hg resolve then run hg rebase --continue

~/repo2$ cat file
<<<<<<< local
222
=======
111
>>>>>>> other
History
Date User Action Args
2010-01-31 21:49:45gwardsetnosy: + gward
messages: + msg11554
2010-01-30 18:27:44jlebarsetnosy: pmezard, abuehl, astratto, jlebar
messages: + msg11545
2010-01-30 12:32:43astrattosettopic: + rebase
nosy: + astratto
messages: + msg11544
2010-01-30 11:27:50pmezardsetstatus: unread -> chatting
nosy: pmezard, abuehl, jlebar
messages: + msg11543
2010-01-30 11:27:27pmezardsetnosy: + pmezard
2010-01-30 05:00:54abuehlsetnosy: + abuehl
2010-01-30 03:55:59jlebarcreate