Major bug in hg convert (Mercurial): filemap option changes file content

Michael Platings platings at ccdc.cam.ac.uk
Tue Feb 28 11:50:52 CST 2012


Using the --filemap option with hg convert can significantly change the contents of files in ways unrelated to the contents of the filemap. The problem doesn't occur if the filemap option isn't used.
I'm using Mercurial version 2.1 (the version that came with TortoiseHg 2.3) on Windows 7 64-bit.

Steps to reproduce:

echo exclude dummy>filemap
hg init bug
cd bug
echo a>a
hg ci -A -m 0
echo b>a
hg ci -m 1
hg up 0
echo c>c
hg debugsetparents 0 1
hg ci -A -m 2
cd ..
hg convert bug bugconvert --filemap filemap


You'll see that the contents of file 'a' in revision 2 is different between bug and bugconvert. Additionally, revision 2 loses its first parent in bugconvert.

It may seem contrived to use debugsetparents, but this is to get the effect given by the 'fixup changesets' that you find in repositories generated by cvs2hg. I believe it's also used by TortoiseHg when merging with the 'Discard all changes from merge target (other) revision' option.

The changes often won't be immediately obvious so I can imagine this bug causing a lot of pain to those who encounter it. I hope someone more knowledgeable than me in the ways of Hg can fix it soon...

Thanks,
Michael Platings

LEGAL NOTICE
Unless expressly stated otherwise, information contained in this
message is confidential. If this message is not intended for you,
please inform postmaster at ccdc.cam.ac.uk and delete the message.
The Cambridge Crystallographic Data Centre is a company Limited
by Guarantee and a Registered Charity.
Registered in England No. 2155347 Registered Charity No. 800579
Registered office 12 Union Road, Cambridge CB2 1EZ.


More information about the Mercurial mailing list