Show More
@@ -1,211 +1,211 b'' | |||||
1 |
|
1 | |||
2 | Test interactions between mq and patch.eol |
|
2 | Test interactions between mq and patch.eol | |
3 |
|
3 | |||
4 |
|
4 | |||
5 | $ cat <<EOF >> $HGRCPATH |
|
5 | $ cat <<EOF >> $HGRCPATH | |
6 | > [extensions] |
|
6 | > [extensions] | |
7 | > mq = |
|
7 | > mq = | |
8 | > [diff] |
|
8 | > [diff] | |
9 | > nodates = 1 |
|
9 | > nodates = 1 | |
10 | > EOF |
|
10 | > EOF | |
11 |
|
11 | |||
12 | $ cat > makepatch.py <<EOF |
|
12 | $ cat > makepatch.py <<EOF | |
13 | > f = open('eol.diff', 'wb') |
|
13 | > f = open('eol.diff', 'wb') | |
14 | > w = f.write |
|
14 | > w = f.write | |
15 | > w('test message\n') |
|
15 | > w(b'test message\n') | |
16 | > w('diff --git a/a b/a\n') |
|
16 | > w(b'diff --git a/a b/a\n') | |
17 | > w('--- a/a\n') |
|
17 | > w(b'--- a/a\n') | |
18 | > w('+++ b/a\n') |
|
18 | > w(b'+++ b/a\n') | |
19 | > w('@@ -1,5 +1,5 @@\n') |
|
19 | > w(b'@@ -1,5 +1,5 @@\n') | |
20 | > w(' a\n') |
|
20 | > w(b' a\n') | |
21 | > w('-b\r\n') |
|
21 | > w(b'-b\r\n') | |
22 | > w('+y\r\n') |
|
22 | > w(b'+y\r\n') | |
23 | > w(' c\r\n') |
|
23 | > w(b' c\r\n') | |
24 | > w(' d\n') |
|
24 | > w(b' d\n') | |
25 | > w('-e\n') |
|
25 | > w(b'-e\n') | |
26 | > w('\ No newline at end of file\n') |
|
26 | > w(b'\ No newline at end of file\n') | |
27 | > w('+z\r\n') |
|
27 | > w(b'+z\r\n') | |
28 | > w('\ No newline at end of file\r\n') |
|
28 | > w(b'\ No newline at end of file\r\n') | |
29 | > EOF |
|
29 | > EOF | |
30 |
|
30 | |||
31 | $ cat > cateol.py <<EOF |
|
31 | $ cat > cateol.py <<EOF | |
32 | > import sys |
|
32 | > import sys | |
33 | > for line in open(sys.argv[1], 'rb'): |
|
33 | > for line in open(sys.argv[1], 'rb'): | |
34 | > line = line.replace('\r', '<CR>') |
|
34 | > line = line.replace(b'\r', b'<CR>') | |
35 | > line = line.replace('\n', '<LF>') |
|
35 | > line = line.replace(b'\n', b'<LF>') | |
36 | > print(line) |
|
36 | > print(line) | |
37 | > EOF |
|
37 | > EOF | |
38 |
|
38 | |||
39 | $ hg init repo |
|
39 | $ hg init repo | |
40 | $ cd repo |
|
40 | $ cd repo | |
41 | $ echo '\.diff' > .hgignore |
|
41 | $ echo '\.diff' > .hgignore | |
42 | $ echo '\.rej' >> .hgignore |
|
42 | $ echo '\.rej' >> .hgignore | |
43 |
|
43 | |||
44 |
|
44 | |||
45 | Test different --eol values |
|
45 | Test different --eol values | |
46 |
|
46 | |||
47 | $ $PYTHON -c 'open("a", "wb").write("a\nb\nc\nd\ne")' |
|
47 | $ $PYTHON -c 'open("a", "wb").write(b"a\nb\nc\nd\ne")' | |
48 | $ hg ci -Am adda |
|
48 | $ hg ci -Am adda | |
49 | adding .hgignore |
|
49 | adding .hgignore | |
50 | adding a |
|
50 | adding a | |
51 | $ $PYTHON ../makepatch.py |
|
51 | $ $PYTHON ../makepatch.py | |
52 | $ hg qimport eol.diff |
|
52 | $ hg qimport eol.diff | |
53 | adding eol.diff to series file |
|
53 | adding eol.diff to series file | |
54 |
|
54 | |||
55 | should fail in strict mode |
|
55 | should fail in strict mode | |
56 |
|
56 | |||
57 | $ hg qpush |
|
57 | $ hg qpush | |
58 | applying eol.diff |
|
58 | applying eol.diff | |
59 | patching file a |
|
59 | patching file a | |
60 | Hunk #1 FAILED at 0 |
|
60 | Hunk #1 FAILED at 0 | |
61 | 1 out of 1 hunks FAILED -- saving rejects to file a.rej |
|
61 | 1 out of 1 hunks FAILED -- saving rejects to file a.rej | |
62 | patch failed, unable to continue (try -v) |
|
62 | patch failed, unable to continue (try -v) | |
63 | patch failed, rejects left in working directory |
|
63 | patch failed, rejects left in working directory | |
64 | errors during apply, please fix and qrefresh eol.diff |
|
64 | errors during apply, please fix and qrefresh eol.diff | |
65 | [2] |
|
65 | [2] | |
66 | $ hg qpop |
|
66 | $ hg qpop | |
67 | popping eol.diff |
|
67 | popping eol.diff | |
68 | patch queue now empty |
|
68 | patch queue now empty | |
69 |
|
69 | |||
70 | invalid eol |
|
70 | invalid eol | |
71 |
|
71 | |||
72 | $ hg --config patch.eol='LFCR' qpush |
|
72 | $ hg --config patch.eol='LFCR' qpush | |
73 | applying eol.diff |
|
73 | applying eol.diff | |
74 | patch failed, unable to continue (try -v) |
|
74 | patch failed, unable to continue (try -v) | |
75 | patch failed, rejects left in working directory |
|
75 | patch failed, rejects left in working directory | |
76 | errors during apply, please fix and qrefresh eol.diff |
|
76 | errors during apply, please fix and qrefresh eol.diff | |
77 | [2] |
|
77 | [2] | |
78 | $ hg qpop |
|
78 | $ hg qpop | |
79 | popping eol.diff |
|
79 | popping eol.diff | |
80 | patch queue now empty |
|
80 | patch queue now empty | |
81 |
|
81 | |||
82 | force LF |
|
82 | force LF | |
83 |
|
83 | |||
84 | $ hg --config patch.eol='CRLF' qpush |
|
84 | $ hg --config patch.eol='CRLF' qpush | |
85 | applying eol.diff |
|
85 | applying eol.diff | |
86 | now at: eol.diff |
|
86 | now at: eol.diff | |
87 | $ hg qrefresh |
|
87 | $ hg qrefresh | |
88 | $ $PYTHON ../cateol.py .hg/patches/eol.diff |
|
88 | $ $PYTHON ../cateol.py .hg/patches/eol.diff | |
89 | # HG changeset patch<LF> |
|
89 | # HG changeset patch<LF> | |
90 | # Parent 0d0bf99a8b7a3842c6f8ef09e34f69156c4bd9d0<LF> |
|
90 | # Parent 0d0bf99a8b7a3842c6f8ef09e34f69156c4bd9d0<LF> | |
91 | test message<LF> |
|
91 | test message<LF> | |
92 | <LF> |
|
92 | <LF> | |
93 | diff -r 0d0bf99a8b7a a<LF> |
|
93 | diff -r 0d0bf99a8b7a a<LF> | |
94 | --- a/a<LF> |
|
94 | --- a/a<LF> | |
95 | +++ b/a<LF> |
|
95 | +++ b/a<LF> | |
96 | @@ -1,5 +1,5 @@<LF> |
|
96 | @@ -1,5 +1,5 @@<LF> | |
97 | -a<LF> |
|
97 | -a<LF> | |
98 | -b<LF> |
|
98 | -b<LF> | |
99 | -c<LF> |
|
99 | -c<LF> | |
100 | -d<LF> |
|
100 | -d<LF> | |
101 | -e<LF> |
|
101 | -e<LF> | |
102 | \ No newline at end of file<LF> |
|
102 | \ No newline at end of file<LF> | |
103 | +a<CR><LF> |
|
103 | +a<CR><LF> | |
104 | +y<CR><LF> |
|
104 | +y<CR><LF> | |
105 | +c<CR><LF> |
|
105 | +c<CR><LF> | |
106 | +d<CR><LF> |
|
106 | +d<CR><LF> | |
107 | +z<LF> |
|
107 | +z<LF> | |
108 | \ No newline at end of file<LF> |
|
108 | \ No newline at end of file<LF> | |
109 | $ $PYTHON ../cateol.py a |
|
109 | $ $PYTHON ../cateol.py a | |
110 | a<CR><LF> |
|
110 | a<CR><LF> | |
111 | y<CR><LF> |
|
111 | y<CR><LF> | |
112 | c<CR><LF> |
|
112 | c<CR><LF> | |
113 | d<CR><LF> |
|
113 | d<CR><LF> | |
114 | z |
|
114 | z | |
115 | $ hg qpop |
|
115 | $ hg qpop | |
116 | popping eol.diff |
|
116 | popping eol.diff | |
117 | patch queue now empty |
|
117 | patch queue now empty | |
118 |
|
118 | |||
119 | push again forcing LF and compare revisions |
|
119 | push again forcing LF and compare revisions | |
120 |
|
120 | |||
121 | $ hg --config patch.eol='CRLF' qpush |
|
121 | $ hg --config patch.eol='CRLF' qpush | |
122 | applying eol.diff |
|
122 | applying eol.diff | |
123 | now at: eol.diff |
|
123 | now at: eol.diff | |
124 | $ $PYTHON ../cateol.py a |
|
124 | $ $PYTHON ../cateol.py a | |
125 | a<CR><LF> |
|
125 | a<CR><LF> | |
126 | y<CR><LF> |
|
126 | y<CR><LF> | |
127 | c<CR><LF> |
|
127 | c<CR><LF> | |
128 | d<CR><LF> |
|
128 | d<CR><LF> | |
129 | z |
|
129 | z | |
130 | $ hg qpop |
|
130 | $ hg qpop | |
131 | popping eol.diff |
|
131 | popping eol.diff | |
132 | patch queue now empty |
|
132 | patch queue now empty | |
133 |
|
133 | |||
134 | push again without LF and compare revisions |
|
134 | push again without LF and compare revisions | |
135 |
|
135 | |||
136 | $ hg qpush |
|
136 | $ hg qpush | |
137 | applying eol.diff |
|
137 | applying eol.diff | |
138 | now at: eol.diff |
|
138 | now at: eol.diff | |
139 | $ $PYTHON ../cateol.py a |
|
139 | $ $PYTHON ../cateol.py a | |
140 | a<CR><LF> |
|
140 | a<CR><LF> | |
141 | y<CR><LF> |
|
141 | y<CR><LF> | |
142 | c<CR><LF> |
|
142 | c<CR><LF> | |
143 | d<CR><LF> |
|
143 | d<CR><LF> | |
144 | z |
|
144 | z | |
145 | $ hg qpop |
|
145 | $ hg qpop | |
146 | popping eol.diff |
|
146 | popping eol.diff | |
147 | patch queue now empty |
|
147 | patch queue now empty | |
148 | $ cd .. |
|
148 | $ cd .. | |
149 |
|
149 | |||
150 |
|
150 | |||
151 | Test .rej file EOL are left unchanged |
|
151 | Test .rej file EOL are left unchanged | |
152 |
|
152 | |||
153 | $ hg init testeol |
|
153 | $ hg init testeol | |
154 | $ cd testeol |
|
154 | $ cd testeol | |
155 | $ $PYTHON -c "open('a', 'wb').write('1\r\n2\r\n3\r\n4')" |
|
155 | $ $PYTHON -c "open('a', 'wb').write(b'1\r\n2\r\n3\r\n4')" | |
156 | $ hg ci -Am adda |
|
156 | $ hg ci -Am adda | |
157 | adding a |
|
157 | adding a | |
158 | $ $PYTHON -c "open('a', 'wb').write('1\r\n2\r\n33\r\n4')" |
|
158 | $ $PYTHON -c "open('a', 'wb').write(b'1\r\n2\r\n33\r\n4')" | |
159 | $ hg qnew patch1 |
|
159 | $ hg qnew patch1 | |
160 | $ hg qpop |
|
160 | $ hg qpop | |
161 | popping patch1 |
|
161 | popping patch1 | |
162 | patch queue now empty |
|
162 | patch queue now empty | |
163 | $ $PYTHON -c "open('a', 'wb').write('1\r\n22\r\n33\r\n4')" |
|
163 | $ $PYTHON -c "open('a', 'wb').write(b'1\r\n22\r\n33\r\n4')" | |
164 | $ hg ci -m changea |
|
164 | $ hg ci -m changea | |
165 |
|
165 | |||
166 | $ hg --config 'patch.eol=LF' qpush |
|
166 | $ hg --config 'patch.eol=LF' qpush | |
167 | applying patch1 |
|
167 | applying patch1 | |
168 | patching file a |
|
168 | patching file a | |
169 | Hunk #1 FAILED at 0 |
|
169 | Hunk #1 FAILED at 0 | |
170 | 1 out of 1 hunks FAILED -- saving rejects to file a.rej |
|
170 | 1 out of 1 hunks FAILED -- saving rejects to file a.rej | |
171 | patch failed, unable to continue (try -v) |
|
171 | patch failed, unable to continue (try -v) | |
172 | patch failed, rejects left in working directory |
|
172 | patch failed, rejects left in working directory | |
173 | errors during apply, please fix and qrefresh patch1 |
|
173 | errors during apply, please fix and qrefresh patch1 | |
174 | [2] |
|
174 | [2] | |
175 | $ hg qpop |
|
175 | $ hg qpop | |
176 | popping patch1 |
|
176 | popping patch1 | |
177 | patch queue now empty |
|
177 | patch queue now empty | |
178 | $ cat a.rej |
|
178 | $ cat a.rej | |
179 | --- a |
|
179 | --- a | |
180 | +++ a |
|
180 | +++ a | |
181 | @@ -1,4 +1,4 @@ |
|
181 | @@ -1,4 +1,4 @@ | |
182 | 1\r (esc) |
|
182 | 1\r (esc) | |
183 | 2\r (esc) |
|
183 | 2\r (esc) | |
184 | -3\r (esc) |
|
184 | -3\r (esc) | |
185 | +33\r (esc) |
|
185 | +33\r (esc) | |
186 | 4 |
|
186 | 4 | |
187 | \ No newline at end of file |
|
187 | \ No newline at end of file | |
188 |
|
188 | |||
189 | $ hg --config 'patch.eol=auto' qpush |
|
189 | $ hg --config 'patch.eol=auto' qpush | |
190 | applying patch1 |
|
190 | applying patch1 | |
191 | patching file a |
|
191 | patching file a | |
192 | Hunk #1 FAILED at 0 |
|
192 | Hunk #1 FAILED at 0 | |
193 | 1 out of 1 hunks FAILED -- saving rejects to file a.rej |
|
193 | 1 out of 1 hunks FAILED -- saving rejects to file a.rej | |
194 | patch failed, unable to continue (try -v) |
|
194 | patch failed, unable to continue (try -v) | |
195 | patch failed, rejects left in working directory |
|
195 | patch failed, rejects left in working directory | |
196 | errors during apply, please fix and qrefresh patch1 |
|
196 | errors during apply, please fix and qrefresh patch1 | |
197 | [2] |
|
197 | [2] | |
198 | $ hg qpop |
|
198 | $ hg qpop | |
199 | popping patch1 |
|
199 | popping patch1 | |
200 | patch queue now empty |
|
200 | patch queue now empty | |
201 | $ cat a.rej |
|
201 | $ cat a.rej | |
202 | --- a |
|
202 | --- a | |
203 | +++ a |
|
203 | +++ a | |
204 | @@ -1,4 +1,4 @@ |
|
204 | @@ -1,4 +1,4 @@ | |
205 | 1\r (esc) |
|
205 | 1\r (esc) | |
206 | 2\r (esc) |
|
206 | 2\r (esc) | |
207 | -3\r (esc) |
|
207 | -3\r (esc) | |
208 | +33\r (esc) |
|
208 | +33\r (esc) | |
209 | 4 |
|
209 | 4 | |
210 | \ No newline at end of file |
|
210 | \ No newline at end of file | |
211 | $ cd .. |
|
211 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now