Newbie question: hg backout

FP fphg at mailinator.com
Tue Jun 10 17:57:48 CDT 2008


Hi,

I'm reading through the hg book (the one at hgbook.red-bean.com), but 
I've hit a section where what happens on my PC (Vista + cygwin, 
Mercurial 1.0.1 from mercurial.berkwood.com) doesn't match the book. The 
code is section 9.3.1 to 9.3.3, reproduced below with the extraneous 
commands removed and quotes fixed for Windows:

hg init myrepo
cd myrepo
echo first change >> myfile
hg add myfile
hg commit -m "first change"
echo second change >> myfile
hg commit -m "second change"
echo third change >> myfile
hg commit -m "third change"
hg backout --merge -m "back out second change" 1

This gives me the following error:

reverting myfile
created new head
changeset 3:1110092ae73d backs out changeset 1:10f3768e4064
merging with changeset 3:1110092ae73d
merging myfile
warning: conflicts during merge.
merging myfile failed!
0 files updated, 0 files merged, 0 files removed, 1 files unresolved
There are unresolved merges, you can redo the full merge using:
   hg update -C 2
   hg merge 3

And the contents of myfile in the working directory as:

first change
<<<<<<< local
second change
third change
=======
 >>>>>>> other

The book says the contents of myfile after the backout should be:

first change
third change

So can someone tell me why the results differ and what if anything I 
need to change?
Also I barely understand the concept of merging (or VCS in general) but 
how is it even possible to get the result listed in the book? Even if I 
was manually merging how would I know which line to keep and which to 
discard (without refering back to the original patch)?

p.s. I've looked at the other threads on this list and they seem to be 
on a much higher level than this one, so sorry if this question isn't 
appropriate here.

Thanks.


More information about the Mercurial mailing list