##// END OF EJS Templates
tests: stabilize test-eol-update on Windows...
Matt Harbison -
r43562:e88549a0 default
parent child Browse files
Show More
@@ -1,276 +1,278
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 > printf "f\r\n" > f
30 > hg commit --addremove -m 'LF commit'
30 > hg commit --addremove -m 'LF commit'
31 >
31 >
32 > cat > .hgeol <<EOF
32 > cat > .hgeol <<EOF
33 > [patterns]
33 > [patterns]
34 > **.txt = CRLF
34 > **.txt = CRLF
35 > f = LF
35 > f = LF
36 > EOF
36 > EOF
37 >
37 >
38 > 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
39 > printf "f\n" > f
40 > hg commit -m 'CRLF commit'
40 > hg commit -m 'CRLF commit'
41 >
41 >
42 > cd ..
42 > cd ..
43 > }
43 > }
44
44
45 $ dotest () {
45 $ dotest () {
46 > seteol $1
46 > seteol $1
47 >
47 >
48 > echo
48 > echo
49 > echo "% hg clone repo repo-$1"
49 > echo "% hg clone repo repo-$1"
50 > hg clone --noupdate repo repo-$1
50 > hg clone --noupdate repo repo-$1
51 > cd repo-$1
51 > cd repo-$1
52 >
52 >
53 > cat > .hg/hgrc <<EOF
53 > cat > .hg/hgrc <<EOF
54 > [extensions]
54 > [extensions]
55 > eol =
55 > eol =
56 > EOF
56 > EOF
57 >
57 >
58 > hg update
58 > hg update
59 >
59 >
60 > echo '% a.txt (before)'
60 > echo '% a.txt (before)'
61 > cat a.txt
61 > cat a.txt
62 >
62 >
63 > printf "first${EOL}third${EOL}" > a.txt
63 > printf "first${EOL}third${EOL}" > a.txt
64 >
64 >
65 > echo '% a.txt (after)'
65 > echo '% a.txt (after)'
66 > cat a.txt
66 > cat a.txt
67 > echo '% hg diff'
67 > echo '% hg diff'
68 > hg diff
68 > hg diff
69 >
69 >
70 > echo '% hg update 0'
70 > echo '% hg update 0'
71 > hg update 0
71 > hg update 0
72 >
72 >
73 > echo '% a.txt'
73 > echo '% a.txt'
74 > cat a.txt
74 > cat a.txt
75 > echo '% hg diff'
75 > echo '% hg diff'
76 > hg diff
76 > hg diff
77 >
77 >
78 >
78 >
79 > cd ..
79 > cd ..
80 > rm -r repo-$1
80 > rm -r repo-$1
81 > }
81 > }
82
82
83 $ makerepo
83 $ makerepo
84
84
85 # ==== setup repository ====
85 # ==== setup repository ====
86 % hg init
86 % hg init
87 adding .hgeol
87 adding .hgeol
88 adding a.txt
88 adding a.txt
89 adding f
89 adding f
90 $ dotest LF
90 $ dotest LF
91
91
92 % hg clone repo repo-LF
92 % hg clone repo repo-LF
93 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
93 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
94 % a.txt (before)
94 % a.txt (before)
95 first\r (esc)
95 first\r (esc)
96 second\r (esc)
96 second\r (esc)
97 third\r (esc)
97 third\r (esc)
98 % a.txt (after)
98 % a.txt (after)
99 first
99 first
100 third
100 third
101 % hg diff
101 % hg diff
102 diff --git a/a.txt b/a.txt
102 diff --git a/a.txt b/a.txt
103 --- a/a.txt
103 --- a/a.txt
104 +++ b/a.txt
104 +++ b/a.txt
105 @@ -1,3 +1,2 @@
105 @@ -1,3 +1,2 @@
106 first\r (esc)
106 first\r (esc)
107 -second\r (esc)
107 -second\r (esc)
108 third\r (esc)
108 third\r (esc)
109 % hg update 0
109 % hg update 0
110 merging a.txt
110 merging a.txt
111 2 files updated, 1 files merged, 0 files removed, 0 files unresolved
111 2 files updated, 1 files merged, 0 files removed, 0 files unresolved
112 % a.txt
112 % a.txt
113 first
113 first
114 third
114 third
115 % hg diff
115 % hg diff
116 diff --git a/a.txt b/a.txt
116 diff --git a/a.txt b/a.txt
117 --- a/a.txt
117 --- a/a.txt
118 +++ b/a.txt
118 +++ b/a.txt
119 @@ -1,3 +1,2 @@
119 @@ -1,3 +1,2 @@
120 first
120 first
121 -second
121 -second
122 third
122 third
123 $ dotest CRLF
123 $ dotest CRLF
124
124
125 % hg clone repo repo-CRLF
125 % hg clone repo repo-CRLF
126 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
126 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
127 % a.txt (before)
127 % a.txt (before)
128 first\r (esc)
128 first\r (esc)
129 second\r (esc)
129 second\r (esc)
130 third\r (esc)
130 third\r (esc)
131 % a.txt (after)
131 % a.txt (after)
132 first\r (esc)
132 first\r (esc)
133 third\r (esc)
133 third\r (esc)
134 % hg diff
134 % hg diff
135 diff --git a/a.txt b/a.txt
135 diff --git a/a.txt b/a.txt
136 --- a/a.txt
136 --- a/a.txt
137 +++ b/a.txt
137 +++ b/a.txt
138 @@ -1,3 +1,2 @@
138 @@ -1,3 +1,2 @@
139 first\r (esc)
139 first\r (esc)
140 -second\r (esc)
140 -second\r (esc)
141 third\r (esc)
141 third\r (esc)
142 % hg update 0
142 % hg update 0
143 merging a.txt
143 merging a.txt
144 2 files updated, 1 files merged, 0 files removed, 0 files unresolved
144 2 files updated, 1 files merged, 0 files removed, 0 files unresolved
145 % a.txt
145 % a.txt
146 first
146 first
147 third
147 third
148 % hg diff
148 % hg diff
149 diff --git a/a.txt b/a.txt
149 diff --git a/a.txt b/a.txt
150 --- a/a.txt
150 --- a/a.txt
151 +++ b/a.txt
151 +++ b/a.txt
152 @@ -1,3 +1,2 @@
152 @@ -1,3 +1,2 @@
153 first
153 first
154 -second
154 -second
155 third
155 third
156
156
157 Test in repo using eol extension, while keeping an eye on how filters are
157 Test in repo using eol extension, while keeping an eye on how filters are
158 applied:
158 applied:
159
159
160 $ cd repo
160 $ cd repo
161
161
162 $ hg up -q -c -r null
162 $ hg up -q -c -r null
163 $ cat > .hg/hgrc <<EOF
163 $ cat > .hg/hgrc <<EOF
164 > [extensions]
164 > [extensions]
165 > eol =
165 > eol =
166 > EOF
166 > EOF
167
167
168 Update to revision 0 which has no .hgeol, shouldn't use any filters, and
168 Update to revision 0 which has no .hgeol, shouldn't use any filters, and
169 obviously should leave things as tidy as they were before the clean update.
169 obviously should leave things as tidy as they were before the clean update.
170
170
171 $ hg up -c -r 0 -v --debug
171 $ hg up -c -r 0 -v --debug
172 resolving manifests
172 resolving manifests
173 branchmerge: False, force: False, partial: False
173 branchmerge: False, force: False, partial: False
174 ancestor: 000000000000, local: 000000000000+, remote: 15cbdf8ca3db
174 ancestor: 000000000000, local: 000000000000+, remote: 15cbdf8ca3db
175 calling hook preupdate.eol: hgext.eol.preupdate
175 calling hook preupdate.eol: hgext.eol.preupdate
176 .hgeol: remote created -> g
176 .hgeol: remote created -> g
177 getting .hgeol
177 getting .hgeol
178 filtering .hgeol through isbinary
178 filtering .hgeol through isbinary
179 a.txt: remote created -> g
179 a.txt: remote created -> g
180 getting a.txt
180 getting a.txt
181 filtering a.txt through tolf
181 filtering a.txt through tolf
182 f: remote created -> g
182 f: remote created -> g
183 getting f
183 getting f
184 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
184 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
185 $ hg st
185 $ hg st
186
186
187 $ hg branch b
187 $ hg branch b
188 marked working directory as branch b
188 marked working directory as branch b
189 (branches are permanent and global, did you want a bookmark?)
189 (branches are permanent and global, did you want a bookmark?)
190 $ hg ci -m b
190 $ hg ci -m b
191
191
192 Merge changes that apply a filter to f:
192 Merge changes that apply a filter to f:
193
193
194 $ hg merge 1
194 $ hg merge 1
195 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
195 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
196 (branch merge, don't forget to commit)
196 (branch merge, don't forget to commit)
197 $ hg st
197 $ hg st
198 M .hgeol
198 M .hgeol
199 M a.txt
199 M a.txt
200 M f
200 M f
201 $ hg diff
201 $ hg diff
202 diff --git a/.hgeol b/.hgeol
202 diff --git a/.hgeol b/.hgeol
203 --- a/.hgeol
203 --- a/.hgeol
204 +++ b/.hgeol
204 +++ b/.hgeol
205 @@ -1,2 +1,3 @@
205 @@ -1,2 +1,3 @@
206 [patterns]
206 [patterns]
207 -**.txt = LF
207 -**.txt = LF
208 +**.txt = CRLF
208 +**.txt = CRLF
209 +f = LF
209 +f = LF
210 diff --git a/a.txt b/a.txt
210 diff --git a/a.txt b/a.txt
211 --- a/a.txt
211 --- a/a.txt
212 +++ b/a.txt
212 +++ b/a.txt
213 @@ -1,3 +1,3 @@
213 @@ -1,3 +1,3 @@
214 -first
214 -first
215 -second
215 -second
216 -third
216 -third
217 +first\r (esc)
217 +first\r (esc)
218 +second\r (esc)
218 +second\r (esc)
219 +third\r (esc)
219 +third\r (esc)
220 diff --git a/f b/f
220 diff --git a/f b/f
221 --- a/f
221 --- a/f
222 +++ b/f
222 +++ b/f
223 @@ -1,1 +1,1 @@
223 @@ -1,1 +1,1 @@
224 -f\r (esc)
224 -f\r (esc)
225 +f
225 +f
226
226
227 Abort the merge with up -C to revision 0.
227 Abort the merge with up -C to revision 0.
228 Note that files are filtered correctly for revision 0: f is not filtered, a.txt
228 Note that files are filtered correctly for revision 0: f is not filtered, a.txt
229 is filtered with tolf, and everything is left tidy.
229 is filtered with tolf, and everything is left tidy.
230
230
231 $ touch .hgeol * # ensure consistent dirtyness checks ignoring dirstate
231 $ touch .hgeol * # ensure consistent dirtyness checks ignoring dirstate
232 $ hg up -C -r 0 -v --debug
232 $ hg up -C -r 0 -v --debug
233 eol: detected change in .hgeol
233 eol: detected change in .hgeol
234 resolving manifests
234 resolving manifests
235 branchmerge: False, force: True, partial: False
235 branchmerge: False, force: True, partial: False
236 ancestor: 1db78bdd3bd6+, local: 1db78bdd3bd6+, remote: 15cbdf8ca3db
236 ancestor: 1db78bdd3bd6+, local: 1db78bdd3bd6+, remote: 15cbdf8ca3db
237 calling hook preupdate.eol: hgext.eol.preupdate
237 calling hook preupdate.eol: hgext.eol.preupdate
238 .hgeol: remote is newer -> g
238 .hgeol: remote is newer -> g
239 getting .hgeol
239 getting .hgeol
240 filtering .hgeol through isbinary
240 filtering .hgeol through isbinary
241 a.txt: remote is newer -> g
241 a.txt: remote is newer -> g
242 getting a.txt
242 getting a.txt
243 filtering a.txt through tolf
243 filtering a.txt through tolf
244 f: remote is newer -> g
244 f: remote is newer -> g
245 getting f
245 getting f
246 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
246 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
247
247
248 $ touch .hgeol *
248 $ touch .hgeol *
249 $ hg st --debug
249 $ hg st --debug
250 eol: detected change in .hgeol
250 eol: detected change in .hgeol
251 filtering .hgeol through isbinary
251 filtering .hgeol through isbinary
252 filtering a.txt through tolf
252 filtering a.txt through tolf
253 skip updating dirstate: identity mismatch (?)
253 $ hg diff
254 $ hg diff
254
255
255 Things were clean, and updating again will not change anything:
256 Things were clean, and updating again will not change anything:
256
257
257 $ touch .hgeol *
258 $ touch .hgeol *
258 $ hg up -C -r 0 -v --debug
259 $ hg up -C -r 0 -v --debug
259 eol: detected change in .hgeol
260 eol: detected change in .hgeol
260 filtering .hgeol through isbinary
261 filtering .hgeol through isbinary
261 filtering a.txt through tolf
262 filtering a.txt through tolf
262 resolving manifests
263 resolving manifests
263 branchmerge: False, force: True, partial: False
264 branchmerge: False, force: True, partial: False
264 ancestor: 15cbdf8ca3db+, local: 15cbdf8ca3db+, remote: 15cbdf8ca3db
265 ancestor: 15cbdf8ca3db+, local: 15cbdf8ca3db+, remote: 15cbdf8ca3db
265 calling hook preupdate.eol: hgext.eol.preupdate
266 calling hook preupdate.eol: hgext.eol.preupdate
267 starting 4 threads for background file closing (?)
266 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
268 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
267
269
268 $ touch .hgeol *
270 $ touch .hgeol *
269 $ hg st --debug
271 $ hg st --debug
270 eol: detected change in .hgeol
272 eol: detected change in .hgeol
271 filtering .hgeol through isbinary
273 filtering .hgeol through isbinary
272 filtering a.txt through tolf
274 filtering a.txt through tolf
273
275
274 $ cd ..
276 $ cd ..
275
277
276 $ rm -r repo
278 $ rm -r repo
General Comments 0
You need to be logged in to leave comments. Login now