Show More
@@ -11,6 +11,8 b' syntax: glob' | |||||
11 | *.pyc |
|
11 | *.pyc | |
12 | *.swp |
|
12 | *.swp | |
13 | *.prof |
|
13 | *.prof | |
|
14 | \#*\# | |||
|
15 | .\#* | |||
14 | tests/.coverage* |
|
16 | tests/.coverage* | |
15 | tests/annotated |
|
17 | tests/annotated | |
16 | tests/*.err |
|
18 | tests/*.err |
@@ -99,11 +99,19 b' def macencode(s, cmd):' | |||||
99 |
|
99 | |||
100 | def forbidnewline(ui, repo, hooktype, node, newline, **kwargs): |
|
100 | def forbidnewline(ui, repo, hooktype, node, newline, **kwargs): | |
101 | halt = False |
|
101 | halt = False | |
102 | for rev in xrange(repo[node].rev(), len(repo)): |
|
102 | seen = util.set() | |
|
103 | # we try to walk changesets in reverse order from newest to | |||
|
104 | # oldest, so that if we see a file multiple times, we take the | |||
|
105 | # newest version as canonical. this prevents us from blocking a | |||
|
106 | # changegroup that contains an unacceptable commit followed later | |||
|
107 | # by a commit that fixes the problem. | |||
|
108 | tip = repo['tip'] | |||
|
109 | for rev in xrange(len(repo)-1, repo[node].rev()-1, -1): | |||
103 | c = repo[rev] |
|
110 | c = repo[rev] | |
104 | for f in c.files(): |
|
111 | for f in c.files(): | |
105 | if f not in c: |
|
112 | if f in seen or f not in tip or f not in c: | |
106 | continue |
|
113 | continue | |
|
114 | seen.add(f) | |||
107 | data = c[f].data() |
|
115 | data = c[f].data() | |
108 | if not util.binary(data) and newline in data: |
|
116 | if not util.binary(data) and newline in data: | |
109 | if not halt: |
|
117 | if not halt: |
@@ -1,5 +1,8 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
|
3 | hg init t | |||
|
4 | cd t | |||
|
5 | ||||
3 | cat > unix2dos.py <<EOF |
|
6 | cat > unix2dos.py <<EOF | |
4 | import sys |
|
7 | import sys | |
5 |
|
8 | |||
@@ -14,7 +17,6 b' import sys' | |||||
14 | print(sys.stdin.read().replace('\n', '<LF>').replace('\r', '<CR>').replace('\0', '<NUL>')) |
|
17 | print(sys.stdin.read().replace('\n', '<LF>').replace('\r', '<CR>').replace('\0', '<NUL>')) | |
15 | EOF |
|
18 | EOF | |
16 |
|
19 | |||
17 | hg init |
|
|||
18 | echo '[hooks]' >> .hg/hgrc |
|
20 | echo '[hooks]' >> .hg/hgrc | |
19 | echo 'pretxncommit.crlf = python:hgext.win32text.forbidcrlf' >> .hg/hgrc |
|
21 | echo 'pretxncommit.crlf = python:hgext.win32text.forbidcrlf' >> .hg/hgrc | |
20 | echo 'pretxnchangegroup.crlf = python:hgext.win32text.forbidcrlf' >> .hg/hgrc |
|
22 | echo 'pretxnchangegroup.crlf = python:hgext.win32text.forbidcrlf' >> .hg/hgrc | |
@@ -23,14 +25,41 b' echo' | |||||
23 |
|
25 | |||
24 | echo hello > f |
|
26 | echo hello > f | |
25 | hg add f |
|
27 | hg add f | |
|
28 | echo commit should succeed | |||
26 | hg ci -m 1 -d'0 0' |
|
29 | hg ci -m 1 -d'0 0' | |
27 | echo |
|
30 | echo | |
28 |
|
31 | |||
|
32 | hg clone . ../zoz | |||
|
33 | cp .hg/hgrc ../zoz/.hg | |||
|
34 | ||||
29 | python unix2dos.py f |
|
35 | python unix2dos.py f | |
|
36 | echo commit should fail | |||
|
37 | hg ci -m 2.1 -d'0 0' | |||
|
38 | echo | |||
|
39 | ||||
|
40 | mv .hg/hgrc .hg/hgrc.bak | |||
|
41 | echo commits should succeed | |||
30 | hg ci -m 2 -d'0 0' |
|
42 | hg ci -m 2 -d'0 0' | |
31 | hg revert -a |
|
43 | hg cp f g | |
|
44 | hg ci -m 2.2 -d'0 0' | |||
32 | echo |
|
45 | echo | |
33 |
|
46 | |||
|
47 | echo push should fail | |||
|
48 | hg push ../zoz | |||
|
49 | echo | |||
|
50 | ||||
|
51 | mv .hg/hgrc.bak .hg/hgrc | |||
|
52 | echo hello > f | |||
|
53 | hg rm g | |||
|
54 | echo commit should succeed | |||
|
55 | hg ci -m 2.3 -d'0 0' | |||
|
56 | echo | |||
|
57 | ||||
|
58 | echo push should succeed | |||
|
59 | hg push ../zoz | |||
|
60 | echo | |||
|
61 | ||||
|
62 | echo and now for something completely different | |||
34 | mkdir d |
|
63 | mkdir d | |
35 | echo hello > d/f2 |
|
64 | echo hello > d/f2 | |
36 | python unix2dos.py d/f2 |
|
65 | python unix2dos.py d/f2 |
@@ -2,115 +2,29 b'' | |||||
2 | pretxncommit.crlf = python:hgext.win32text.forbidcrlf |
|
2 | pretxncommit.crlf = python:hgext.win32text.forbidcrlf | |
3 | pretxnchangegroup.crlf = python:hgext.win32text.forbidcrlf |
|
3 | pretxnchangegroup.crlf = python:hgext.win32text.forbidcrlf | |
4 |
|
4 | |||
5 |
|
5 | commit should succeed | ||
6 | Attempt to commit or push text file(s) using CRLF line endings |
|
|||
7 | in b1aa5cde7ff4: f |
|
|||
8 | transaction abort! |
|
|||
9 | rollback completed |
|
|||
10 | abort: pretxncommit.crlf hook failed |
|
|||
11 | reverting f |
|
|||
12 |
|
||||
13 | Attempt to commit or push text file(s) using CRLF line endings |
|
|||
14 | in 88b17af74937: d/f2 |
|
|||
15 | transaction abort! |
|
|||
16 | rollback completed |
|
|||
17 | abort: pretxncommit.crlf hook failed |
|
|||
18 | forgetting d/f2 |
|
|||
19 |
|
||||
20 |
|
||||
21 | changeset: 2:b67b2dae057a |
|
|||
22 | tag: tip |
|
|||
23 | user: test |
|
|||
24 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
|||
25 | files: bin |
|
|||
26 | description: |
|
|||
27 | 5 |
|
|||
28 |
|
||||
29 |
|
||||
30 | changeset: 1:c72a7d1d0907 |
|
|||
31 | user: test |
|
|||
32 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
|||
33 | files: f |
|
|||
34 | description: |
|
|||
35 | 4 |
|
|||
36 |
|
||||
37 |
|
||||
38 | changeset: 0:fcf06d5c4e1d |
|
|||
39 | user: test |
|
|||
40 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
|||
41 | files: f |
|
|||
42 | description: |
|
|||
43 | 1 |
|
|||
44 |
|
||||
45 |
|
||||
46 |
|
6 | |||
47 | updating working directory |
|
7 | updating working directory | |
48 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
8 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
49 |
|
9 | commit should fail | ||
50 | adding dupe/a |
|
10 | Attempt to commit or push text file(s) using CRLF line endings | |
51 | adding dupe/b |
|
11 | in f583ea08d42a: f | |
52 | adding dupe/c |
|
12 | transaction abort! | |
53 | adding dupe/d |
|
13 | rollback completed | |
54 | changeset: 5:6e8a7629ff5b |
|
14 | abort: pretxncommit.crlf hook failed | |
55 | tag: tip |
|
|||
56 | user: test |
|
|||
57 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
|||
58 | files: d |
|
|||
59 | description: |
|
|||
60 | d |
|
|||
61 |
|
||||
62 |
|
||||
63 | changeset: 4:ac30a42ce8bc |
|
|||
64 | user: test |
|
|||
65 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
|||
66 | files: b c |
|
|||
67 | description: |
|
|||
68 | b/c |
|
|||
69 |
|
||||
70 |
|
15 | |||
71 | changeset: 3:a73b85ef1fb7 |
|
16 | commits should succeed | |
72 | user: test |
|
|||
73 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
|||
74 | files: a |
|
|||
75 | description: |
|
|||
76 | a |
|
|||
77 |
|
||||
78 |
|
||||
79 | changeset: 2:b67b2dae057a |
|
|||
80 | user: test |
|
|||
81 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
|||
82 | files: bin |
|
|||
83 | description: |
|
|||
84 | 5 |
|
|||
85 |
|
||||
86 |
|
17 | |||
87 | changeset: 1:c72a7d1d0907 |
|
18 | push should fail | |
88 | user: test |
|
19 | pushing to ../zoz | |
89 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
|||
90 | files: f |
|
|||
91 | description: |
|
|||
92 | 4 |
|
|||
93 |
|
||||
94 |
|
||||
95 | changeset: 0:fcf06d5c4e1d |
|
|||
96 | user: test |
|
|||
97 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
|||
98 | files: f |
|
|||
99 | description: |
|
|||
100 | 1 |
|
|||
101 |
|
||||
102 |
|
||||
103 |
|
||||
104 | pulling from dupe |
|
|||
105 | searching for changes |
|
20 | searching for changes | |
106 | adding changesets |
|
21 | adding changesets | |
107 | adding manifests |
|
22 | adding manifests | |
108 | adding file changes |
|
23 | adding file changes | |
109 |
added |
|
24 | added 2 changesets with 2 changes to 2 files | |
110 | Attempt to commit or push text file(s) using CRLF line endings |
|
25 | Attempt to commit or push text file(s) using CRLF line endings | |
111 | in ac30a42ce8bc: b |
|
26 | in b94ebd309a6d: g | |
112 | in ac30a42ce8bc: c |
|
27 | in b1aa5cde7ff4: f | |
113 | in 6e8a7629ff5b: d |
|
|||
114 |
|
28 | |||
115 | To prevent this mistake in your local repository, |
|
29 | To prevent this mistake in your local repository, | |
116 | add to Mercurial.ini or .hg/hgrc: |
|
30 | add to Mercurial.ini or .hg/hgrc: | |
@@ -130,7 +44,26 b' transaction abort!' | |||||
130 | rollback completed |
|
44 | rollback completed | |
131 | abort: pretxnchangegroup.crlf hook failed |
|
45 | abort: pretxnchangegroup.crlf hook failed | |
132 |
|
46 | |||
133 | changeset: 2:b67b2dae057a |
|
47 | commit should succeed | |
|
48 | ||||
|
49 | push should succeed | |||
|
50 | pushing to ../zoz | |||
|
51 | searching for changes | |||
|
52 | adding changesets | |||
|
53 | adding manifests | |||
|
54 | adding file changes | |||
|
55 | added 3 changesets with 3 changes to 2 files | |||
|
56 | ||||
|
57 | and now for something completely different | |||
|
58 | Attempt to commit or push text file(s) using CRLF line endings | |||
|
59 | in cefdb8d0b741: d/f2 | |||
|
60 | transaction abort! | |||
|
61 | rollback completed | |||
|
62 | abort: pretxncommit.crlf hook failed | |||
|
63 | forgetting d/f2 | |||
|
64 | ||||
|
65 | ||||
|
66 | changeset: 5:d4ea9ae21be3 | |||
134 | tag: tip |
|
67 | tag: tip | |
135 | user: test |
|
68 | user: test | |
136 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
69 | date: Thu Jan 01 00:00:00 1970 +0000 | |
@@ -139,7 +72,88 b' description:' | |||||
139 | 5 |
|
72 | 5 | |
140 |
|
73 | |||
141 |
|
74 | |||
142 |
changeset: |
|
75 | changeset: 4:6ba409927d51 | |
|
76 | user: test | |||
|
77 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
78 | files: f | |||
|
79 | description: | |||
|
80 | 4 | |||
|
81 | ||||
|
82 | ||||
|
83 | changeset: 3:788a4e595187 | |||
|
84 | user: test | |||
|
85 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
86 | files: f g | |||
|
87 | description: | |||
|
88 | 2.3 | |||
|
89 | ||||
|
90 | ||||
|
91 | changeset: 2:b94ebd309a6d | |||
|
92 | user: test | |||
|
93 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
94 | files: g | |||
|
95 | description: | |||
|
96 | 2.2 | |||
|
97 | ||||
|
98 | ||||
|
99 | changeset: 1:b1aa5cde7ff4 | |||
|
100 | user: test | |||
|
101 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
102 | files: f | |||
|
103 | description: | |||
|
104 | 2 | |||
|
105 | ||||
|
106 | ||||
|
107 | changeset: 0:fcf06d5c4e1d | |||
|
108 | user: test | |||
|
109 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
110 | files: f | |||
|
111 | description: | |||
|
112 | 1 | |||
|
113 | ||||
|
114 | ||||
|
115 | ||||
|
116 | updating working directory | |||
|
117 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
118 | ||||
|
119 | adding dupe/a | |||
|
120 | adding dupe/b | |||
|
121 | adding dupe/c | |||
|
122 | adding dupe/d | |||
|
123 | changeset: 8:7654104f33c3 | |||
|
124 | tag: tip | |||
|
125 | user: test | |||
|
126 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
127 | files: d | |||
|
128 | description: | |||
|
129 | d | |||
|
130 | ||||
|
131 | ||||
|
132 | changeset: 7:9be4c2808cc9 | |||
|
133 | user: test | |||
|
134 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
135 | files: b c | |||
|
136 | description: | |||
|
137 | b/c | |||
|
138 | ||||
|
139 | ||||
|
140 | changeset: 6:aa4367ed325a | |||
|
141 | user: test | |||
|
142 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
143 | files: a | |||
|
144 | description: | |||
|
145 | a | |||
|
146 | ||||
|
147 | ||||
|
148 | changeset: 5:d4ea9ae21be3 | |||
|
149 | user: test | |||
|
150 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
151 | files: bin | |||
|
152 | description: | |||
|
153 | 5 | |||
|
154 | ||||
|
155 | ||||
|
156 | changeset: 4:6ba409927d51 | |||
143 | user: test |
|
157 | user: test | |
144 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
158 | date: Thu Jan 01 00:00:00 1970 +0000 | |
145 | files: f |
|
159 | files: f | |
@@ -147,6 +161,109 b' description:' | |||||
147 | 4 |
|
161 | 4 | |
148 |
|
162 | |||
149 |
|
163 | |||
|
164 | changeset: 3:788a4e595187 | |||
|
165 | user: test | |||
|
166 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
167 | files: f g | |||
|
168 | description: | |||
|
169 | 2.3 | |||
|
170 | ||||
|
171 | ||||
|
172 | changeset: 2:b94ebd309a6d | |||
|
173 | user: test | |||
|
174 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
175 | files: g | |||
|
176 | description: | |||
|
177 | 2.2 | |||
|
178 | ||||
|
179 | ||||
|
180 | changeset: 1:b1aa5cde7ff4 | |||
|
181 | user: test | |||
|
182 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
183 | files: f | |||
|
184 | description: | |||
|
185 | 2 | |||
|
186 | ||||
|
187 | ||||
|
188 | changeset: 0:fcf06d5c4e1d | |||
|
189 | user: test | |||
|
190 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
191 | files: f | |||
|
192 | description: | |||
|
193 | 1 | |||
|
194 | ||||
|
195 | ||||
|
196 | ||||
|
197 | pulling from dupe | |||
|
198 | searching for changes | |||
|
199 | adding changesets | |||
|
200 | adding manifests | |||
|
201 | adding file changes | |||
|
202 | added 3 changesets with 4 changes to 4 files | |||
|
203 | Attempt to commit or push text file(s) using CRLF line endings | |||
|
204 | in 7654104f33c3: d | |||
|
205 | in 9be4c2808cc9: b | |||
|
206 | in 9be4c2808cc9: c | |||
|
207 | ||||
|
208 | To prevent this mistake in your local repository, | |||
|
209 | add to Mercurial.ini or .hg/hgrc: | |||
|
210 | ||||
|
211 | [hooks] | |||
|
212 | pretxncommit.crlf = python:hgext.win32text.forbidcrlf | |||
|
213 | ||||
|
214 | and also consider adding: | |||
|
215 | ||||
|
216 | [extensions] | |||
|
217 | hgext.win32text = | |||
|
218 | [encode] | |||
|
219 | ** = cleverencode: | |||
|
220 | [decode] | |||
|
221 | ** = cleverdecode: | |||
|
222 | transaction abort! | |||
|
223 | rollback completed | |||
|
224 | abort: pretxnchangegroup.crlf hook failed | |||
|
225 | ||||
|
226 | changeset: 5:d4ea9ae21be3 | |||
|
227 | tag: tip | |||
|
228 | user: test | |||
|
229 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
230 | files: bin | |||
|
231 | description: | |||
|
232 | 5 | |||
|
233 | ||||
|
234 | ||||
|
235 | changeset: 4:6ba409927d51 | |||
|
236 | user: test | |||
|
237 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
238 | files: f | |||
|
239 | description: | |||
|
240 | 4 | |||
|
241 | ||||
|
242 | ||||
|
243 | changeset: 3:788a4e595187 | |||
|
244 | user: test | |||
|
245 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
246 | files: f g | |||
|
247 | description: | |||
|
248 | 2.3 | |||
|
249 | ||||
|
250 | ||||
|
251 | changeset: 2:b94ebd309a6d | |||
|
252 | user: test | |||
|
253 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
254 | files: g | |||
|
255 | description: | |||
|
256 | 2.2 | |||
|
257 | ||||
|
258 | ||||
|
259 | changeset: 1:b1aa5cde7ff4 | |||
|
260 | user: test | |||
|
261 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
262 | files: f | |||
|
263 | description: | |||
|
264 | 2 | |||
|
265 | ||||
|
266 | ||||
150 | changeset: 0:fcf06d5c4e1d |
|
267 | changeset: 0:fcf06d5c4e1d | |
151 | user: test |
|
268 | user: test | |
152 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
269 | date: Thu Jan 01 00:00:00 1970 +0000 |
General Comments 0
You need to be logged in to leave comments.
Login now