Problems with merge --preview
Greg Ward
greg at gerg.ca
Fri Aug 28 19:36:14 UTC 2009
Is anyone else confused by the behaviour of the new 'merge --preview'
option in 1.3? Every time I use it, it confounds my expectations in a
different way. But my current problem is very easy to demonstrate, so
I'll explain it first.
Here's a picture of my repo:
$ hg glog -q
o 143:56506c690f24
|
o 142:c153fd8f5e9f
|
| @ 141:8495ef63b28d
| |
| o 140:215339372dd6
| |
| o 139:913877029fa4
| |
o | 138:37b23eb24c67
| |
| o 137:886f0ab2a6d9
|/|
o | 136:c90c1bc49058
| |
| o 135:28da6bcb90a2
| |
[...]
I want to merge 143 onto 141. Clearly, their latest common ancestor is 136:
$ hg debugancestor 143 141
136:c90c1bc49058dc3a6bfe0ed1e628a65e4d77cf94
Thus, I expect the following patches to be merged:
136->138
138->142
142->143
In other words, I expect the following changesets to be merged:
138
142
143
The TipsAndTricks wiki page contains a trick for showing the
changesets that would be merged, and it meets my expectations:
$ hg -q log -r 143:null --prune 141
-1:000000000000
138:37b23eb24c67
142:c153fd8f5e9f
143:56506c690f24
In English, that means "show me all history up to 143 [the other
head], excluding any changesets that are ancestors of 141 [the current
head]". (Actually, I'm puzzled why -1 is not considered an ancestor
of 141, since has only one root -- 0 is the ancestor of everything,
and -1 is the parent of 0.)
But 'merge --preview' shows me one extra changeset:
$ hg -q merge --preview 143
136:c90c1bc49058
138:37b23eb24c67
142:c153fd8f5e9f
143:56506c690f24
>From the glog output above, 136 is clearly already an ancestor of the
current head (141). But merge --preview claims it's going to be
merged. And if I look at the patch in 136 (diff -c136), I can see
that it has already been incorporated into the code at 141.
This smells wrong to me. Am I missing something, or is merge --preview broken?
Greg
More information about the Mercurial
mailing list