[PATCH 1 of 1] patch: generate .rej wihtout eol adaptation

Shun-ichi Goto shunichi.goto at gmail.com
Thu Dec 2 07:16:18 CST 2010


2010/12/2 Mads Kiilerich <mads at kiilerich.com>:
>> To reproduce this issue:
>>  1. make taget file having CRLF line ending
>>  2. make patch file having CRLF content line ending
>>  3. prepare patch which would conflict
>>  4. applying patch with option 'patch.eol=auto'
>>  5. check .rej file has CRCRLF<= incorrect!
>
> Could this reproducer description go into a test in the test suite?

I only have a simple shell script because I'm not familiar with hg's test suit.
And it use mq (qpush) to kick patching as I experienced.
(Note that it has ^M code)

-----(cut)-----
export HOME=`pwd`  # place .hgrc in current dir. for test

rm -rf r
hg init r

cd r

rm -f a.txt
echo 1 hello^M >> a.txt
echo 2 hello^M >> a.txt
echo 3 hello^M >> a.txt
echo 4 hello^M >> a.txt
echo 5 hello^M >> a.txt
echo 6 hello^M >> a.txt
echo 7 hello^M >> a.txt
echo 8 hello^M >> a.txt
echo 9 hello^M >> a.txt
echo 0 hello^M >> a.txt

hg ci -Am 1

rm -f a.txt
echo 1 hello^M >> a.txt
echo 2 hello^M >> a.txt
echo 3 hello^M >> a.txt
echo 4 hello^M >> a.txt
echo 5 hello^M >> a.txt
echo 6 HELLO^M >> a.txt
echo 7 hello^M >> a.txt
echo 8 hello^M >> a.txt
echo 9 hello^M >> a.txt
echo 0 hello^M >> a.txt

hg qnew -fm "line 2" m1
hg qpop

rm -f a.txt
echo 1 hello^M >> a.txt
echo 2 hello^M >> a.txt
echo 3 hello^M >> a.txt
echo 4 hello^M >> a.txt
echo 5 good morning^M >> a.txt
echo 6 HELLO^M >> a.txt
echo 7 hello^M >> a.txt
echo 8 hello^M >> a.txt
echo 9 hello^M >> a.txt
echo 0 hello^M >> a.txt

hg ci -m 2

# try normal
hg --config 'patch.eol=LF' qpush
hg qpop
mv a.txt.rej a.txt.rej-1

hg --config 'patch.eol=auto' qpush
hg qpop
mv a.txt.rej a.txt.rej-2

cmp a.txt.rej-1 a.txt.rej-2
-----(cut)-----

-- 
Shun-ichi GOTO


More information about the Mercurial-devel mailing list