author | Wagner Bruna <wbruna@softwareexpress.com.br> |
Mon, 16 Nov 2009 14:37:31 -0200 | |
changeset 9865 | 1a2bc8e55396 |
parent 8811 | 8b35b08724eb |
child 10128 | ea7c392f2b08 |
permissions | -rwxr-xr-x |
8811
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
1 |
#!/bin/sh |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
2 |
|
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
3 |
# Test interactions between mq and patch.eol |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
4 |
|
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
5 |
echo "[extensions]" >> $HGRCPATH |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
6 |
echo "mq=" >> $HGRCPATH |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
7 |
|
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
8 |
cat > makepatch.py <<EOF |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
9 |
f = file('eol.diff', 'wb') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
10 |
w = f.write |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
11 |
w('test message\n') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
12 |
w('diff --git a/a b/a\n') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
13 |
w('--- a/a\n') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
14 |
w('+++ b/a\n') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
15 |
w('@@ -1,5 +1,5 @@\n') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
16 |
w(' a\n') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
17 |
w('-b\r\n') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
18 |
w('+y\r\n') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
19 |
w(' c\r\n') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
20 |
w(' d\n') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
21 |
w('-e\n') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
22 |
w('\ No newline at end of file\n') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
23 |
w('+z\r\n') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
24 |
w('\ No newline at end of file\r\n') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
25 |
EOF |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
26 |
|
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
27 |
cat > cateol.py <<EOF |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
28 |
import sys |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
29 |
for line in file(sys.argv[1], 'rb'): |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
30 |
line = line.replace('\r', '<CR>') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
31 |
line = line.replace('\n', '<LF>') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
32 |
print line |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
33 |
EOF |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
34 |
|
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
35 |
hg init repo |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
36 |
cd repo |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
37 |
echo '\.diff' > .hgignore |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
38 |
echo '\.rej' >> .hgignore |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
39 |
|
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
40 |
# Test different --eol values |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
41 |
python -c 'file("a", "wb").write("a\nb\nc\nd\ne")' |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
42 |
hg ci -Am adda |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
43 |
python ../makepatch.py |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
44 |
hg qimport eol.diff |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
45 |
echo % should fail in strict mode |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
46 |
hg qpush |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
47 |
hg qpop |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
48 |
echo % invalid eol |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
49 |
hg --config patch.eol='LFCR' qpush |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
50 |
hg qpop |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
51 |
echo % force LF |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
52 |
hg --config patch.eol='CRLF' qpush |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
53 |
hg qrefresh |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
54 |
python ../cateol.py .hg/patches/eol.diff |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
55 |
python ../cateol.py a |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
56 |
hg qpop |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
57 |
echo % push again forcing LF and compare revisions |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
58 |
hg --config patch.eol='CRLF' qpush |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
59 |
python ../cateol.py a |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
60 |
hg qpop |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
61 |
echo % push again without LF and compare revisions |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
62 |
hg qpush |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
63 |
python ../cateol.py a |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
64 |
hg qpop |