Problem with DOS formatted text files and mq

David Frey dpfrey at shaw.ca
Wed Jun 20 20:28:36 UTC 2007


Hi,

I was playing around with Mercurial at work to manage my own work.  I
have run into a fairly severe roadblock.  What follows is a step by step
guide to produce the problem on my machine.  I am running Mercurial
0.9.3 on Windows XP.  It is compiled from source because the binary
required administrator rights to install (which I don't have).

$ is a command, // is a comment by me and <action> is an action I
performed.

$ mkdir test
$ cd test
$ hg init
$ hg qinit
$ hg add test.txt // test.txt is a 44 line DOS text file
$ hg commit -m "added test.txt"
$ hg qnew test.patch
<Insert a line around the middle of the file>
// :set ff in vim shows DOS
$ hg qrefresh // file is still in DOS format
// .hg/patches/test.patch is a unix text file, but has ^M showing at
// the end of each line of the diff content
$ hg qpop // File is now back to original state
$ hg qpush test.patch
applying test.patch
test.txt
Hunk #1 FAILED at 28.
1 out of 1 hunk FAILED -- saving rejects to file test.txt.rej
patch failed, unable to continue (try -v)
patch failed, rejects left in working dir
Errors during apply, please fix and refresh test.patch
// At this point, test.txt, still has its original content, but now
// it is in unix format.
$ hg qpop
// test.txt is back to DOS format now
<edit .hg/patches/test.patch to remove all ^M characters>
$ hg qpush test.patch
applying test.patch
Now at: test.patch
// test.txt has my edit, but is now in unix format
<add a line to the text file and delete another>
$ hg qrefresh
// Now the test.patch file is huge, it contains every line in the
// original file with a ^M at the end followed by every line in the
// latest version with no ^M since the file is now in unix format.
$ hg qpop
$ hg qpush test.patch
applying test.patch
test.txt
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file test.txt.rej
patch failed, unable to continue (try -v)
patch failed, rejects left in working dir
Errors during apply, please fix and refresh test.patch
// So now I have a bloated patch that won't even apply.  I can do
// the remove all ^M trick, but then my patch is still massive.


Is this a bug in Mercurial or the mq extension?  Can I change my config
to get around this?  Simply converting all of my files to unix format is
not an acceptable solution to me.

Thanks,
David Frey




More information about the Mercurial mailing list