##// END OF EJS Templates
eol: test-eol-update.t coverage around update --clean using filters ... badly...
Mads Kiilerich -
r43471:a819b577 default
parent child Browse files
Show More
@@ -26,14 +26,17 b' Test EOL update'
26 > EOF
26 > EOF
27 >
27 >
28 > printf "first\nsecond\nthird\n" > a.txt
28 > printf "first\nsecond\nthird\n" > a.txt
29 > printf "f\r\n" > f
29 > hg commit --addremove -m 'LF commit'
30 > hg commit --addremove -m 'LF commit'
30 >
31 >
31 > cat > .hgeol <<EOF
32 > cat > .hgeol <<EOF
32 > [patterns]
33 > [patterns]
33 > **.txt = CRLF
34 > **.txt = CRLF
35 > f = LF
34 > EOF
36 > EOF
35 >
37 >
36 > printf "first\r\nsecond\r\nthird\r\n" > a.txt
38 > printf "first\r\nsecond\r\nthird\r\n" > a.txt
39 > printf "f\n" > f
37 > hg commit -m 'CRLF commit'
40 > hg commit -m 'CRLF commit'
38 >
41 >
39 > cd ..
42 > cd ..
@@ -83,10 +86,11 b' Test EOL update'
83 % hg init
86 % hg init
84 adding .hgeol
87 adding .hgeol
85 adding a.txt
88 adding a.txt
89 adding f
86 $ dotest LF
90 $ dotest LF
87
91
88 % hg clone repo repo-LF
92 % hg clone repo repo-LF
89 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
93 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
90 % a.txt (before)
94 % a.txt (before)
91 first\r (esc)
95 first\r (esc)
92 second\r (esc)
96 second\r (esc)
@@ -104,7 +108,7 b' Test EOL update'
104 third\r (esc)
108 third\r (esc)
105 % hg update 0
109 % hg update 0
106 merging a.txt
110 merging a.txt
107 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
111 2 files updated, 1 files merged, 0 files removed, 0 files unresolved
108 % a.txt
112 % a.txt
109 first
113 first
110 third
114 third
@@ -116,10 +120,16 b' Test EOL update'
116 first
120 first
117 -second
121 -second
118 third
122 third
123 diff --git a/f b/f
124 --- a/f
125 +++ b/f
126 @@ -1,1 +1,1 @@
127 -f\r (esc)
128 +f
119 $ dotest CRLF
129 $ dotest CRLF
120
130
121 % hg clone repo repo-CRLF
131 % hg clone repo repo-CRLF
122 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
132 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
123 % a.txt (before)
133 % a.txt (before)
124 first\r (esc)
134 first\r (esc)
125 second\r (esc)
135 second\r (esc)
@@ -137,7 +147,7 b' Test EOL update'
137 third\r (esc)
147 third\r (esc)
138 % hg update 0
148 % hg update 0
139 merging a.txt
149 merging a.txt
140 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
150 2 files updated, 1 files merged, 0 files removed, 0 files unresolved
141 % a.txt
151 % a.txt
142 first
152 first
143 third
153 third
@@ -149,4 +159,154 b' Test EOL update'
149 first
159 first
150 -second
160 -second
151 third
161 third
162 diff --git a/f b/f
163 --- a/f
164 +++ b/f
165 @@ -1,1 +1,1 @@
166 -f\r (esc)
167 +f
168
169 Test in repo using eol extension, while keeping an eye on how filters are
170 applied:
171
172 $ cd repo
173
174 $ hg up -q -c -r null
175 $ cat > .hg/hgrc <<EOF
176 > [extensions]
177 > eol =
178 > EOF
179
180 Update to revision 0 which has no .hgeol . Unfortunately, it uses the filter
181 from tip ... which evidently is wrong:
182
183 $ hg up -c -r 0 -v --debug
184 resolving manifests
185 branchmerge: False, force: False, partial: False
186 ancestor: 000000000000, local: 000000000000+, remote: 15cbdf8ca3db
187 calling hook preupdate.eol: hgext.eol.preupdate
188 .hgeol: remote created -> g
189 getting .hgeol
190 filtering .hgeol through
191 a.txt: remote created -> g
192 getting a.txt
193 filtering a.txt through
194 f: remote created -> g
195 getting f
196 filtering f through
197 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
198 $ hg st
199 M f
200 $ touch .hgeol * # ensure consistent dirtyness checks ignoring dirstate
201 $ hg up -C -r 0 -v --debug
202 eol: detected change in .hgeol
203 filtering .hgeol through
204 filtering a.txt through
205 resolving manifests
206 branchmerge: False, force: True, partial: False
207 ancestor: 15cbdf8ca3db+, local: 15cbdf8ca3db+, remote: 15cbdf8ca3db
208 calling hook preupdate.eol: hgext.eol.preupdate
209 f: remote is newer -> g
210 getting f
211 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
212
213 $ hg branch b
214 marked working directory as branch b
215 (branches are permanent and global, did you want a bookmark?)
216 $ hg ci -m b
217
218 Merge changes that apply a filter to f:
219
220 $ hg merge 1
221 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
222 (branch merge, don't forget to commit)
223 $ hg st
224 M .hgeol
225 M a.txt
226 M f
227 $ hg diff
228 diff --git a/.hgeol b/.hgeol
229 --- a/.hgeol
230 +++ b/.hgeol
231 @@ -1,2 +1,3 @@
232 [patterns]
233 -**.txt = LF
234 +**.txt = CRLF
235 +f = LF
236 diff --git a/a.txt b/a.txt
237 --- a/a.txt
238 +++ b/a.txt
239 @@ -1,3 +1,3 @@
240 -first
241 -second
242 -third
243 +first\r (esc)
244 +second\r (esc)
245 +third\r (esc)
246 diff --git a/f b/f
247 --- a/f
248 +++ b/f
249 @@ -1,1 +1,1 @@
250 -f\r (esc)
251 +f
252
253 Abort the merge with up -C to revision 0 ... but notice how .hgeol changes are
254 not detected correctly: f is filtered with tolf even though there is no filter
255 for f in revision 0, and it thus ends up with working directory changes.
256
257 $ touch .hgeol * # ensure consistent dirtyness checks ignoring dirstate
258 $ hg up -C -r 0 -v --debug
259 eol: detected change in .hgeol
260 resolving manifests
261 branchmerge: False, force: True, partial: False
262 ancestor: 1db78bdd3bd6+, local: 1db78bdd3bd6+, remote: 15cbdf8ca3db
263 calling hook preupdate.eol: hgext.eol.preupdate
264 .hgeol: remote is newer -> g
265 getting .hgeol
266 filtering .hgeol through
267 a.txt: remote is newer -> g
268 getting a.txt
269 filtering a.txt through
270 f: remote is newer -> g
271 getting f
272 filtering f through
273 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
274
275 $ touch .hgeol *
276 $ hg st --debug
277 eol: detected change in .hgeol
278 filtering .hgeol through
279 filtering a.txt through
280 M f
281 $ hg diff
282 diff --git a/f b/f
283 --- a/f
284 +++ b/f
285 @@ -1,1 +1,1 @@
286 -f\r (esc)
287 +f
288
289 Workaround: Update again - this will read the right .hgeol:
290
291 $ touch .hgeol *
292 $ hg up -C -r 0 -v --debug
293 eol: detected change in .hgeol
294 filtering .hgeol through
295 filtering a.txt through
296 resolving manifests
297 branchmerge: False, force: True, partial: False
298 ancestor: 15cbdf8ca3db+, local: 15cbdf8ca3db+, remote: 15cbdf8ca3db
299 calling hook preupdate.eol: hgext.eol.preupdate
300 f: remote is newer -> g
301 getting f
302 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
303
304 $ touch .hgeol *
305 $ hg st --debug
306 eol: detected change in .hgeol
307 filtering .hgeol through
308 filtering a.txt through
309
310 $ cd ..
311
152 $ rm -r repo
312 $ rm -r repo
General Comments 0
You need to be logged in to leave comments. Login now