Problem with Mercurial and Branches

Arne Babenhauserheide arne_bab at web.de
Fri Jan 9 14:29:46 CST 2009


#I used the output to create a simple test script: 

## Script to reproduce losing work from the Dragonfly repo.

# Create the source repo with the branches b1 and b2
hg init source
cd source
echo 1 > file-1.txt
echo 2 > file-2.txt
hg add
hg ci -m "added files"
hg branch b1
echo 1.1 > file-1.txt
echo 2.1 > file-2.txt
hg ci -m "created branch b1"
hg branch b2
echo 1.2 > file-1.txt
echo 2.2 > file-2.txt
hg ci -m "created branch b2"
cd ..

# Clone to copy
hg clone source copy

# Edit a file in source, branch b1, and merge b1 into b2
cd source
hg up b1
hg status
echo 1.1.src > file-1.txt
hg ci -m "edited file 1 in source in b1"
hg up b2
hg merge b1
hg resolve -m
hg ci -m "merged b1 to b2 in source"

# Edit a file in copy, branch b1, and merge b1 into b2. 
cd ../copy
hg up b1
echo 2.1.copy > file-2.txt
hg status
hg ci -m "edited file 2 in copy in b1"
hg up b2
hg merge b1
hg resolve -m
hg ci -m "merged b1 to b2 in copy"

# Pull the changes from source and merge the heads (in b2)
hg pull
hg heads
hg merge
hg resolve -m
hg ci -m "merged the two heads in copy"
hg up b1

# Check the file. 
cat file-2.txt

## I'd expect file-2.txt to now contain the following: 
# +<<<<<<< local
# +2.2
# +=======
# +2.1.copy
# +>>>>>>> other
## but it contains
# 2.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://selenic.com/pipermail/mercurial/attachments/20090109/dfdec5d6/attachment.pgp 


More information about the Mercurial mailing list