##// 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
@@ -1,152 +1,312 b''
1 Test EOL update
1 Test EOL update
2
2
3 $ cat >> $HGRCPATH <<EOF
3 $ cat >> $HGRCPATH <<EOF
4 > [diff]
4 > [diff]
5 > git = 1
5 > git = 1
6 > EOF
6 > EOF
7
7
8 $ seteol () {
8 $ seteol () {
9 > if [ $1 = "LF" ]; then
9 > if [ $1 = "LF" ]; then
10 > EOL='\n'
10 > EOL='\n'
11 > else
11 > else
12 > EOL='\r\n'
12 > EOL='\r\n'
13 > fi
13 > fi
14 > }
14 > }
15
15
16 $ makerepo () {
16 $ makerepo () {
17 > echo
17 > echo
18 > echo "# ==== setup repository ===="
18 > echo "# ==== setup repository ===="
19 > echo '% hg init'
19 > echo '% hg init'
20 > hg init repo
20 > hg init repo
21 > cd repo
21 > cd repo
22 >
22 >
23 > cat > .hgeol <<EOF
23 > cat > .hgeol <<EOF
24 > [patterns]
24 > [patterns]
25 > **.txt = LF
25 > **.txt = LF
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 ..
40 > }
43 > }
41
44
42 $ dotest () {
45 $ dotest () {
43 > seteol $1
46 > seteol $1
44 >
47 >
45 > echo
48 > echo
46 > echo "% hg clone repo repo-$1"
49 > echo "% hg clone repo repo-$1"
47 > hg clone --noupdate repo repo-$1
50 > hg clone --noupdate repo repo-$1
48 > cd repo-$1
51 > cd repo-$1
49 >
52 >
50 > cat > .hg/hgrc <<EOF
53 > cat > .hg/hgrc <<EOF
51 > [extensions]
54 > [extensions]
52 > eol =
55 > eol =
53 > EOF
56 > EOF
54 >
57 >
55 > hg update
58 > hg update
56 >
59 >
57 > echo '% a.txt (before)'
60 > echo '% a.txt (before)'
58 > cat a.txt
61 > cat a.txt
59 >
62 >
60 > printf "first${EOL}third${EOL}" > a.txt
63 > printf "first${EOL}third${EOL}" > a.txt
61 >
64 >
62 > echo '% a.txt (after)'
65 > echo '% a.txt (after)'
63 > cat a.txt
66 > cat a.txt
64 > echo '% hg diff'
67 > echo '% hg diff'
65 > hg diff
68 > hg diff
66 >
69 >
67 > echo '% hg update 0'
70 > echo '% hg update 0'
68 > hg update 0
71 > hg update 0
69 >
72 >
70 > echo '% a.txt'
73 > echo '% a.txt'
71 > cat a.txt
74 > cat a.txt
72 > echo '% hg diff'
75 > echo '% hg diff'
73 > hg diff
76 > hg diff
74 >
77 >
75 >
78 >
76 > cd ..
79 > cd ..
77 > rm -r repo-$1
80 > rm -r repo-$1
78 > }
81 > }
79
82
80 $ makerepo
83 $ makerepo
81
84
82 # ==== setup repository ====
85 # ==== setup repository ====
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)
93 third\r (esc)
97 third\r (esc)
94 % a.txt (after)
98 % a.txt (after)
95 first
99 first
96 third
100 third
97 % hg diff
101 % hg diff
98 diff --git a/a.txt b/a.txt
102 diff --git a/a.txt b/a.txt
99 --- a/a.txt
103 --- a/a.txt
100 +++ b/a.txt
104 +++ b/a.txt
101 @@ -1,3 +1,2 @@
105 @@ -1,3 +1,2 @@
102 first\r (esc)
106 first\r (esc)
103 -second\r (esc)
107 -second\r (esc)
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
111 % hg diff
115 % hg diff
112 diff --git a/a.txt b/a.txt
116 diff --git a/a.txt b/a.txt
113 --- a/a.txt
117 --- a/a.txt
114 +++ b/a.txt
118 +++ b/a.txt
115 @@ -1,3 +1,2 @@
119 @@ -1,3 +1,2 @@
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)
126 third\r (esc)
136 third\r (esc)
127 % a.txt (after)
137 % a.txt (after)
128 first\r (esc)
138 first\r (esc)
129 third\r (esc)
139 third\r (esc)
130 % hg diff
140 % hg diff
131 diff --git a/a.txt b/a.txt
141 diff --git a/a.txt b/a.txt
132 --- a/a.txt
142 --- a/a.txt
133 +++ b/a.txt
143 +++ b/a.txt
134 @@ -1,3 +1,2 @@
144 @@ -1,3 +1,2 @@
135 first\r (esc)
145 first\r (esc)
136 -second\r (esc)
146 -second\r (esc)
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
144 % hg diff
154 % hg diff
145 diff --git a/a.txt b/a.txt
155 diff --git a/a.txt b/a.txt
146 --- a/a.txt
156 --- a/a.txt
147 +++ b/a.txt
157 +++ b/a.txt
148 @@ -1,3 +1,2 @@
158 @@ -1,3 +1,2 @@
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