Mercurial > hg
annotate tests/test-mq-eol @ 11400:e5b7841e0008
i18n-zh_CN: split messages into paragraphs
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Sat, 19 Jun 2010 17:19:15 +0200 |
parents | 9c2c94934f0d |
children |
rev | line source |
---|---|
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 |
10190
9c2c94934f0d
mq: upgrade to git patch when necessary (issue767)
Patrick Mezard <pmezard@gmail.com>
parents:
10129
diff
changeset
|
7 echo "[diff]" >> $HGRCPATH |
9c2c94934f0d
mq: upgrade to git patch when necessary (issue767)
Patrick Mezard <pmezard@gmail.com>
parents:
10129
diff
changeset
|
8 echo "nodates=1" >> $HGRCPATH |
8811
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
9 |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
10 cat > makepatch.py <<EOF |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
11 f = file('eol.diff', 'wb') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
12 w = f.write |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
13 w('test message\n') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
14 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
|
15 w('--- a/a\n') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
16 w('+++ b/a\n') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
17 w('@@ -1,5 +1,5 @@\n') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
18 w(' a\n') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
19 w('-b\r\n') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
20 w('+y\r\n') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
21 w(' c\r\n') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
22 w(' d\n') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
23 w('-e\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\n') |
10129
900ccbd79ef7
diffhelpers: handle CRLF in hunk last line without EOL
Patrick Mezard <pmezard@gmail.com>
parents:
10128
diff
changeset
|
25 w('+z\r\n') |
8811
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
26 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
|
27 EOF |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
28 |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
29 cat > cateol.py <<EOF |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
30 import sys |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
31 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
|
32 line = line.replace('\r', '<CR>') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
33 line = line.replace('\n', '<LF>') |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
34 print line |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
35 EOF |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
36 |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
37 hg init repo |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
38 cd repo |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
39 echo '\.diff' > .hgignore |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
40 echo '\.rej' >> .hgignore |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
41 |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
42 # Test different --eol values |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
43 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
|
44 hg ci -Am adda |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
45 python ../makepatch.py |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
46 hg qimport eol.diff |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
47 echo % should fail in strict mode |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
48 hg qpush |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
49 hg qpop |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
50 echo % invalid eol |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
51 hg --config patch.eol='LFCR' qpush |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
52 hg qpop |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
53 echo % force LF |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
54 hg --config patch.eol='CRLF' qpush |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
55 hg qrefresh |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
56 python ../cateol.py .hg/patches/eol.diff |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
57 python ../cateol.py a |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
58 hg qpop |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
59 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
|
60 hg --config patch.eol='CRLF' qpush |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
61 python ../cateol.py a |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
62 hg qpop |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
63 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
|
64 hg qpush |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
65 python ../cateol.py a |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
66 hg qpop |