Show More
@@ -1,66 +1,141 | |||||
1 | #!/bin/sh |
|
1 | ||
|
2 | Test interactions between mq and patch.eol | |||
|
3 | ||||
2 |
|
4 | |||
3 | # Test interactions between mq and patch.eol |
|
5 | $ echo "[extensions]" >> $HGRCPATH | |
|
6 | $ echo "mq=" >> $HGRCPATH | |||
|
7 | $ echo "[diff]" >> $HGRCPATH | |||
|
8 | $ echo "nodates=1" >> $HGRCPATH | |||
4 |
|
9 | |||
5 | echo "[extensions]" >> $HGRCPATH |
|
10 | $ cat > makepatch.py <<EOF | |
6 | echo "mq=" >> $HGRCPATH |
|
11 | > f = file('eol.diff', 'wb') | |
7 | echo "[diff]" >> $HGRCPATH |
|
12 | > w = f.write | |
8 | echo "nodates=1" >> $HGRCPATH |
|
13 | > w('test message\n') | |
|
14 | > w('diff --git a/a b/a\n') | |||
|
15 | > w('--- a/a\n') | |||
|
16 | > w('+++ b/a\n') | |||
|
17 | > w('@@ -1,5 +1,5 @@\n') | |||
|
18 | > w(' a\n') | |||
|
19 | > w('-b\r\n') | |||
|
20 | > w('+y\r\n') | |||
|
21 | > w(' c\r\n') | |||
|
22 | > w(' d\n') | |||
|
23 | > w('-e\n') | |||
|
24 | > w('\ No newline at end of file\n') | |||
|
25 | > w('+z\r\n') | |||
|
26 | > w('\ No newline at end of file\r\n') | |||
|
27 | > EOF | |||
9 |
|
28 | |||
10 |
cat > |
|
29 | $ cat > cateol.py <<EOF | |
11 | f = file('eol.diff', 'wb') |
|
30 | > import sys | |
12 | w = f.write |
|
31 | > for line in file(sys.argv[1], 'rb'): | |
13 | w('test message\n') |
|
32 | > line = line.replace('\r', '<CR>') | |
14 | w('diff --git a/a b/a\n') |
|
33 | > line = line.replace('\n', '<LF>') | |
15 | w('--- a/a\n') |
|
34 | > print line | |
16 | w('+++ b/a\n') |
|
35 | > EOF | |
17 | w('@@ -1,5 +1,5 @@\n') |
|
36 | ||
18 | w(' a\n') |
|
37 | $ hg init repo | |
19 | w('-b\r\n') |
|
38 | $ cd repo | |
20 | w('+y\r\n') |
|
39 | $ echo '\.diff' > .hgignore | |
21 | w(' c\r\n') |
|
40 | $ echo '\.rej' >> .hgignore | |
22 | w(' d\n') |
|
41 | ||
23 | w('-e\n') |
|
42 | ||
24 | w('\ No newline at end of file\n') |
|
43 | Test different --eol values | |
25 | w('+z\r\n') |
|
44 | ||
26 | w('\ No newline at end of file\r\n') |
|
45 | $ python -c 'file("a", "wb").write("a\nb\nc\nd\ne")' | |
27 | EOF |
|
46 | $ hg ci -Am adda | |
|
47 | adding .hgignore | |||
|
48 | adding a | |||
|
49 | $ python ../makepatch.py | |||
|
50 | $ hg qimport eol.diff | |||
|
51 | adding eol.diff to series file | |||
|
52 | ||||
|
53 | should fail in strict mode | |||
|
54 | ||||
|
55 | $ hg qpush | |||
|
56 | applying eol.diff | |||
|
57 | patching file a | |||
|
58 | Hunk #1 FAILED at 0 | |||
|
59 | 1 out of 1 hunks FAILED -- saving rejects to file a.rej | |||
|
60 | patch failed, unable to continue (try -v) | |||
|
61 | patch failed, rejects left in working dir | |||
|
62 | errors during apply, please fix and refresh eol.diff | |||
|
63 | $ hg qpop | |||
|
64 | popping eol.diff | |||
|
65 | patch queue now empty | |||
|
66 | ||||
|
67 | invalid eol | |||
28 |
|
68 | |||
29 | cat > cateol.py <<EOF |
|
69 | $ hg --config patch.eol='LFCR' qpush | |
30 | import sys |
|
70 | applying eol.diff | |
31 | for line in file(sys.argv[1], 'rb'): |
|
71 | patch failed, unable to continue (try -v) | |
32 | line = line.replace('\r', '<CR>') |
|
72 | patch failed, rejects left in working dir | |
33 | line = line.replace('\n', '<LF>') |
|
73 | errors during apply, please fix and refresh eol.diff | |
34 | print line |
|
74 | $ hg qpop | |
35 | EOF |
|
75 | popping eol.diff | |
|
76 | patch queue now empty | |||
36 |
|
77 | |||
37 | hg init repo |
|
78 | force LF | |
38 | cd repo |
|
|||
39 | echo '\.diff' > .hgignore |
|
|||
40 | echo '\.rej' >> .hgignore |
|
|||
41 |
|
79 | |||
42 | # Test different --eol values |
|
80 | $ hg --config patch.eol='CRLF' qpush | |
43 | python -c 'file("a", "wb").write("a\nb\nc\nd\ne")' |
|
81 | applying eol.diff | |
44 | hg ci -Am adda |
|
82 | now at: eol.diff | |
45 | python ../makepatch.py |
|
83 | $ hg qrefresh | |
46 | hg qimport eol.diff |
|
84 | $ python ../cateol.py .hg/patches/eol.diff | |
47 | echo % should fail in strict mode |
|
85 | test message<LF> | |
48 | hg qpush |
|
86 | <LF> | |
49 | hg qpop |
|
87 | diff -r 0d0bf99a8b7a a<LF> | |
50 | echo % invalid eol |
|
88 | --- a/a<LF> | |
51 | hg --config patch.eol='LFCR' qpush |
|
89 | +++ b/a<LF> | |
52 | hg qpop |
|
90 | @@ -1,5 +1,5 @@<LF> | |
53 | echo % force LF |
|
91 | -a<LF> | |
54 | hg --config patch.eol='CRLF' qpush |
|
92 | -b<LF> | |
55 | hg qrefresh |
|
93 | -c<LF> | |
56 | python ../cateol.py .hg/patches/eol.diff |
|
94 | -d<LF> | |
57 | python ../cateol.py a |
|
95 | -e<LF> | |
58 | hg qpop |
|
96 | \ No newline at end of file<LF> | |
59 | echo % push again forcing LF and compare revisions |
|
97 | +a<CR><LF> | |
60 | hg --config patch.eol='CRLF' qpush |
|
98 | +y<CR><LF> | |
61 | python ../cateol.py a |
|
99 | +c<CR><LF> | |
62 | hg qpop |
|
100 | +d<CR><LF> | |
63 | echo % push again without LF and compare revisions |
|
101 | +z<LF> | |
64 | hg qpush |
|
102 | \ No newline at end of file<LF> | |
65 | python ../cateol.py a |
|
103 | $ python ../cateol.py a | |
66 | hg qpop |
|
104 | a<CR><LF> | |
|
105 | y<CR><LF> | |||
|
106 | c<CR><LF> | |||
|
107 | d<CR><LF> | |||
|
108 | z | |||
|
109 | $ hg qpop | |||
|
110 | popping eol.diff | |||
|
111 | patch queue now empty | |||
|
112 | ||||
|
113 | push again forcing LF and compare revisions | |||
|
114 | ||||
|
115 | $ hg --config patch.eol='CRLF' qpush | |||
|
116 | applying eol.diff | |||
|
117 | now at: eol.diff | |||
|
118 | $ python ../cateol.py a | |||
|
119 | a<CR><LF> | |||
|
120 | y<CR><LF> | |||
|
121 | c<CR><LF> | |||
|
122 | d<CR><LF> | |||
|
123 | z | |||
|
124 | $ hg qpop | |||
|
125 | popping eol.diff | |||
|
126 | patch queue now empty | |||
|
127 | ||||
|
128 | push again without LF and compare revisions | |||
|
129 | ||||
|
130 | $ hg qpush | |||
|
131 | applying eol.diff | |||
|
132 | now at: eol.diff | |||
|
133 | $ python ../cateol.py a | |||
|
134 | a<CR><LF> | |||
|
135 | y<CR><LF> | |||
|
136 | c<CR><LF> | |||
|
137 | d<CR><LF> | |||
|
138 | z | |||
|
139 | $ hg qpop | |||
|
140 | popping eol.diff | |||
|
141 | patch queue now empty |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now