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