##// END OF EJS Templates
tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison -
r39498:e5449ff2 default
parent child Browse files
Show More
@@ -1,330 +1,355 b''
1 Tests for experimental.removeemptydirs
1 Tests for experimental.removeemptydirs
2
2
3 $ NO_RM=--config=experimental.removeemptydirs=0
3 $ NO_RM=--config=experimental.removeemptydirs=0
4 $ isdir() { if [ -d $1 ]; then echo yes; else echo no; fi }
4 $ isdir() { if [ -d $1 ]; then echo yes; else echo no; fi }
5 $ isfile() { if [ -f $1 ]; then echo yes; else echo no; fi }
5 $ isfile() { if [ -f $1 ]; then echo yes; else echo no; fi }
6
6
7 `hg rm` of the last file in a directory:
7 `hg rm` of the last file in a directory:
8 $ hg init hgrm
8 $ hg init hgrm
9 $ cd hgrm
9 $ cd hgrm
10 $ mkdir somedir
10 $ mkdir somedir
11 $ echo hi > somedir/foo
11 $ echo hi > somedir/foo
12 $ hg ci -qAm foo
12 $ hg ci -qAm foo
13 $ isdir somedir
13 $ isdir somedir
14 yes
14 yes
15 $ hg rm somedir/foo
15 $ hg rm somedir/foo
16 $ isdir somedir
16 $ isdir somedir
17 no
17 no
18 $ hg revert -qa
18 $ hg revert -qa
19 $ isdir somedir
19 $ isdir somedir
20 yes
20 yes
21 $ hg $NO_RM rm somedir/foo
21 $ hg $NO_RM rm somedir/foo
22 $ isdir somedir
22 $ isdir somedir
23 yes
23 yes
24 $ ls somedir
24 $ ls somedir
25 $ cd $TESTTMP
25 $ cd $TESTTMP
26
26
27 `hg mv` of the last file in a directory:
27 `hg mv` of the last file in a directory:
28 $ hg init hgmv
28 $ hg init hgmv
29 $ cd hgmv
29 $ cd hgmv
30 $ mkdir somedir
30 $ mkdir somedir
31 $ mkdir destdir
31 $ mkdir destdir
32 $ echo hi > somedir/foo
32 $ echo hi > somedir/foo
33 $ hg ci -qAm foo
33 $ hg ci -qAm foo
34 $ isdir somedir
34 $ isdir somedir
35 yes
35 yes
36 $ hg mv somedir/foo destdir/foo
36 $ hg mv somedir/foo destdir/foo
37 $ isdir somedir
37 $ isdir somedir
38 no
38 no
39 $ hg revert -qa
39 $ hg revert -qa
40 (revert doesn't get rid of destdir/foo?)
40 (revert doesn't get rid of destdir/foo?)
41 $ rm destdir/foo
41 $ rm destdir/foo
42 $ isdir somedir
42 $ isdir somedir
43 yes
43 yes
44 $ hg $NO_RM mv somedir/foo destdir/foo
44 $ hg $NO_RM mv somedir/foo destdir/foo
45 $ isdir somedir
45 $ isdir somedir
46 yes
46 yes
47 $ ls somedir
47 $ ls somedir
48 $ cd $TESTTMP
48 $ cd $TESTTMP
49
49
50 Updating to a commit that doesn't have the directory:
50 Updating to a commit that doesn't have the directory:
51 $ hg init hgupdate
51 $ hg init hgupdate
52 $ cd hgupdate
52 $ cd hgupdate
53 $ echo hi > r0
53 $ echo hi > r0
54 $ hg ci -qAm r0
54 $ hg ci -qAm r0
55 $ mkdir somedir
55 $ mkdir somedir
56 $ echo hi > somedir/foo
56 $ echo hi > somedir/foo
57 $ hg ci -qAm r1
57 $ hg ci -qAm r1
58 $ isdir somedir
58 $ isdir somedir
59 yes
59 yes
60 $ hg co -q -r ".^"
60 $ hg co -q -r ".^"
61 $ isdir somedir
61 $ isdir somedir
62 no
62 no
63 $ hg co -q tip
63 $ hg co -q tip
64 $ isdir somedir
64 $ isdir somedir
65 yes
65 yes
66 $ hg $NO_RM co -q -r ".^"
66 $ hg $NO_RM co -q -r ".^"
67 $ isdir somedir
67 $ isdir somedir
68 yes
68 yes
69 $ ls somedir
69 $ ls somedir
70 $ cd $TESTTMP
70 $ cd $TESTTMP
71
71
72 Rebasing across a commit that doesn't have the directory, from inside the
72 Rebasing across a commit that doesn't have the directory, from inside the
73 directory:
73 directory:
74 $ hg init hgrebase
74 $ hg init hgrebase
75 $ cd hgrebase
75 $ cd hgrebase
76 $ echo hi > r0
76 $ echo hi > r0
77 $ hg ci -qAm r0
77 $ hg ci -qAm r0
78 $ mkdir somedir
78 $ mkdir somedir
79 $ echo hi > somedir/foo
79 $ echo hi > somedir/foo
80 $ hg ci -qAm first_rebase_source
80 $ hg ci -qAm first_rebase_source
81 $ hg $NO_RM co -q -r ".^"
81 $ hg $NO_RM co -q -r ".^"
82 $ echo hi > somedir/bar
82 $ echo hi > somedir/bar
83 $ hg ci -qAm first_rebase_dest
83 $ hg ci -qAm first_rebase_dest
84 $ hg $NO_RM co -q -r ".^"
84 $ hg $NO_RM co -q -r ".^"
85 $ echo hi > somedir/baz
85 $ echo hi > somedir/baz
86 $ hg ci -qAm second_rebase_dest
86 $ hg ci -qAm second_rebase_dest
87 $ hg co -qr 'desc(first_rebase_source)'
87 $ hg co -qr 'desc(first_rebase_source)'
88 $ cd $TESTTMP/hgrebase/somedir
88 $ cd $TESTTMP/hgrebase/somedir
89 $ hg --config extensions.rebase= rebase -qr . -d 'desc(first_rebase_dest)'
89 $ hg --config extensions.rebase= rebase -qr . -d 'desc(first_rebase_dest)'
90 current directory was removed
90 current directory was removed (rmcwd !)
91 (consider changing to repo root: $TESTTMP/hgrebase)
91 (consider changing to repo root: $TESTTMP/hgrebase) (rmcwd !)
92 $ cd $TESTTMP/hgrebase/somedir
92 $ cd $TESTTMP/hgrebase/somedir
93 (The current node is the rebased first_rebase_source on top of
93 (The current node is the rebased first_rebase_source on top of
94 first_rebase_dest)
94 first_rebase_dest)
95 This should not output anything about current directory being removed:
95 This should not output anything about current directory being removed:
96 $ hg $NO_RM --config extensions.rebase= rebase -qr . -d 'desc(second_rebase_dest)'
96 $ hg $NO_RM --config extensions.rebase= rebase -qr . -d 'desc(second_rebase_dest)'
97 $ cd $TESTTMP
97 $ cd $TESTTMP
98
98
99 Histediting across a commit that doesn't have the directory, from inside the
99 Histediting across a commit that doesn't have the directory, from inside the
100 directory (reordering nodes):
100 directory (reordering nodes):
101 $ hg init hghistedit
101 $ hg init hghistedit
102 $ cd hghistedit
102 $ cd hghistedit
103 $ echo hi > r0
103 $ echo hi > r0
104 $ hg ci -qAm r0
104 $ hg ci -qAm r0
105 $ echo hi > r1
105 $ echo hi > r1
106 $ hg ci -qAm r1
106 $ hg ci -qAm r1
107 $ echo hi > r2
107 $ echo hi > r2
108 $ hg ci -qAm r2
108 $ hg ci -qAm r2
109 $ mkdir somedir
109 $ mkdir somedir
110 $ echo hi > somedir/foo
110 $ echo hi > somedir/foo
111 $ hg ci -qAm migrating_revision
111 $ hg ci -qAm migrating_revision
112 $ cat > histedit_commands <<EOF
112 $ cat > histedit_commands <<EOF
113 > pick 89079fab8aee 0 r0
113 > pick 89079fab8aee 0 r0
114 > pick e6d271df3142 1 r1
114 > pick e6d271df3142 1 r1
115 > pick 89e25aa83f0f 3 migrating_revision
115 > pick 89e25aa83f0f 3 migrating_revision
116 > pick b550aa12d873 2 r2
116 > pick b550aa12d873 2 r2
117 > EOF
117 > EOF
118 $ cd $TESTTMP/hghistedit/somedir
118 $ cd $TESTTMP/hghistedit/somedir
119 $ hg --config extensions.histedit= histedit -q --commands ../histedit_commands
119 $ hg --config extensions.histedit= histedit -q --commands ../histedit_commands
120
120
121 histedit doesn't output anything when the current diretory is removed. We rely
121 histedit doesn't output anything when the current diretory is removed. We rely
122 on the tests being commonly run on machines where the current directory
122 on the tests being commonly run on machines where the current directory
123 disappearing from underneath us actually has an observable effect, such as an
123 disappearing from underneath us actually has an observable effect, such as an
124 error or no files listed
124 error or no files listed
125 #if linuxormacos
125 #if linuxormacos
126 $ isfile foo
126 $ isfile foo
127 no
127 no
128 #endif
128 #endif
129 $ cd $TESTTMP/hghistedit/somedir
129 $ cd $TESTTMP/hghistedit/somedir
130 $ isfile foo
130 $ isfile foo
131 yes
131 yes
132
132
133 $ cd $TESTTMP/hghistedit
133 $ cd $TESTTMP/hghistedit
134 $ cat > histedit_commands <<EOF
134 $ cat > histedit_commands <<EOF
135 > pick 89079fab8aee 0 r0
135 > pick 89079fab8aee 0 r0
136 > pick 7c7a22c6009f 3 migrating_revision
136 > pick 7c7a22c6009f 3 migrating_revision
137 > pick e6d271df3142 1 r1
137 > pick e6d271df3142 1 r1
138 > pick 40a53c2d4276 2 r2
138 > pick 40a53c2d4276 2 r2
139 > EOF
139 > EOF
140 $ cd $TESTTMP/hghistedit/somedir
140 $ cd $TESTTMP/hghistedit/somedir
141 $ hg $NO_RM --config extensions.histedit= histedit -q --commands ../histedit_commands
141 $ hg $NO_RM --config extensions.histedit= histedit -q --commands ../histedit_commands
142 Regardless of system, we should always get a 'yes' here.
142 Regardless of system, we should always get a 'yes' here.
143 $ isfile foo
143 $ isfile foo
144 yes
144 yes
145 $ cd $TESTTMP
145 $ cd $TESTTMP
146
146
147 This is essentially the exact test from issue5826, just cleaned up a little:
147 This is essentially the exact test from issue5826, just cleaned up a little:
148
148
149 $ hg init issue5826_withrm
149 $ hg init issue5826_withrm
150 $ cd issue5826_withrm
150 $ cd issue5826_withrm
151
151
152 Let's only turn this on for this repo so that we don't contaminate later tests.
152 Let's only turn this on for this repo so that we don't contaminate later tests.
153 $ cat >> .hg/hgrc <<EOF
153 $ cat >> .hg/hgrc <<EOF
154 > [extensions]
154 > [extensions]
155 > histedit =
155 > histedit =
156 > EOF
156 > EOF
157 Commit three revisions that each create a directory:
157 Commit three revisions that each create a directory:
158
158
159 $ mkdir foo
159 $ mkdir foo
160 $ touch foo/bar
160 $ touch foo/bar
161 $ hg commit -qAm "add foo"
161 $ hg commit -qAm "add foo"
162
162
163 $ mkdir bar
163 $ mkdir bar
164 $ touch bar/bar
164 $ touch bar/bar
165 $ hg commit -qAm "add bar"
165 $ hg commit -qAm "add bar"
166
166
167 $ mkdir baz
167 $ mkdir baz
168 $ touch baz/bar
168 $ touch baz/bar
169 $ hg commit -qAm "add baz"
169 $ hg commit -qAm "add baz"
170
170
171 Enter the first directory:
171 Enter the first directory:
172
172
173 $ cd foo
173 $ cd foo
174
174
175 Histedit doing 'pick, pick, fold':
175 Histedit doing 'pick, pick, fold':
176
176
177 $ hg histedit --commands /dev/stdin <<EOF
177 #if rmcwd
178
179 $ hg histedit --commands - <<EOF
178 > pick 6274c77c93c3 1 add bar
180 > pick 6274c77c93c3 1 add bar
179 > pick ff70a87b588f 0 add foo
181 > pick ff70a87b588f 0 add foo
180 > fold 9992bb0ac0db 2 add baz
182 > fold 9992bb0ac0db 2 add baz
181 > EOF
183 > EOF
182 abort: $ENOENT$
184 abort: $ENOENT$
183 [255]
185 [255]
184
186
185 Go back to the repo root after losing it as part of that operation:
187 Go back to the repo root after losing it as part of that operation:
186 $ cd $TESTTMP/issue5826_withrm
188 $ cd $TESTTMP/issue5826_withrm
187
189
188 Note the lack of a non-zero exit code from this function - it exits
190 Note the lack of a non-zero exit code from this function - it exits
189 successfully, but doesn't really do anything.
191 successfully, but doesn't really do anything.
190 $ hg histedit --continue
192 $ hg histedit --continue
191 9992bb0ac0db: cannot fold - working copy is not a descendant of previous commit 5c806432464a
193 9992bb0ac0db: cannot fold - working copy is not a descendant of previous commit 5c806432464a
192 saved backup bundle to $TESTTMP/issue5826_withrm/.hg/strip-backup/ff70a87b588f-e94f9789-histedit.hg
194 saved backup bundle to $TESTTMP/issue5826_withrm/.hg/strip-backup/ff70a87b588f-e94f9789-histedit.hg
193
195
194 $ hg log -T '{rev}:{node|short} {desc}\n'
196 $ hg log -T '{rev}:{node|short} {desc}\n'
195 2:94e3f9fae1d6 fold-temp-revision 9992bb0ac0db
197 2:94e3f9fae1d6 fold-temp-revision 9992bb0ac0db
196 1:5c806432464a add foo
198 1:5c806432464a add foo
197 0:d17db4b0303a add bar
199 0:d17db4b0303a add bar
198
200
201 #else
202
203 $ cd $TESTTMP/issue5826_withrm
204
205 $ hg histedit --commands - <<EOF
206 > pick 6274c77c93c3 1 add bar
207 > pick ff70a87b588f 0 add foo
208 > fold 9992bb0ac0db 2 add baz
209 > EOF
210 saved backup bundle to $TESTTMP/issue5826_withrm/.hg/strip-backup/5c806432464a-cd4c8d86-histedit.hg
211
212 $ hg log -T '{rev}:{node|short} {desc}\n'
213 1:b9eddaa97cbc add foo
214 ***
215 add baz
216 0:d17db4b0303a add bar
217
218 #endif
219
199 Now test that again with experimental.removeemptydirs=false:
220 Now test that again with experimental.removeemptydirs=false:
200 $ hg init issue5826_norm
221 $ hg init issue5826_norm
201 $ cd issue5826_norm
222 $ cd issue5826_norm
202
223
203 Let's only turn this on for this repo so that we don't contaminate later tests.
224 Let's only turn this on for this repo so that we don't contaminate later tests.
204 $ cat >> .hg/hgrc <<EOF
225 $ cat >> .hg/hgrc <<EOF
205 > [extensions]
226 > [extensions]
206 > histedit =
227 > histedit =
207 > [experimental]
228 > [experimental]
208 > removeemptydirs = false
229 > removeemptydirs = false
209 > EOF
230 > EOF
210 Commit three revisions that each create a directory:
231 Commit three revisions that each create a directory:
211
232
212 $ mkdir foo
233 $ mkdir foo
213 $ touch foo/bar
234 $ touch foo/bar
214 $ hg commit -qAm "add foo"
235 $ hg commit -qAm "add foo"
215
236
216 $ mkdir bar
237 $ mkdir bar
217 $ touch bar/bar
238 $ touch bar/bar
218 $ hg commit -qAm "add bar"
239 $ hg commit -qAm "add bar"
219
240
220 $ mkdir baz
241 $ mkdir baz
221 $ touch baz/bar
242 $ touch baz/bar
222 $ hg commit -qAm "add baz"
243 $ hg commit -qAm "add baz"
223
244
224 Enter the first directory:
245 Enter the first directory:
225
246
226 $ cd foo
247 $ cd foo
227
248
228 Histedit doing 'pick, pick, fold':
249 Histedit doing 'pick, pick, fold':
229
250
230 $ hg histedit --commands /dev/stdin <<EOF
251 $ hg histedit --commands - <<EOF
231 > pick 6274c77c93c3 1 add bar
252 > pick 6274c77c93c3 1 add bar
232 > pick ff70a87b588f 0 add foo
253 > pick ff70a87b588f 0 add foo
233 > fold 9992bb0ac0db 2 add baz
254 > fold 9992bb0ac0db 2 add baz
234 > EOF
255 > EOF
235 saved backup bundle to $TESTTMP/issue5826_withrm/issue5826_norm/.hg/strip-backup/5c806432464a-cd4c8d86-histedit.hg
256 saved backup bundle to $TESTTMP/issue5826_withrm/issue5826_norm/.hg/strip-backup/5c806432464a-cd4c8d86-histedit.hg
236
257
237 Note the lack of a 'cd' being necessary here, and we don't need to 'histedit
258 Note the lack of a 'cd' being necessary here, and we don't need to 'histedit
238 --continue'
259 --continue'
239
260
240 $ hg log -T '{rev}:{node|short} {desc}\n'
261 $ hg log -T '{rev}:{node|short} {desc}\n'
241 1:b9eddaa97cbc add foo
262 1:b9eddaa97cbc add foo
242 ***
263 ***
243 add baz
264 add baz
244 0:d17db4b0303a add bar
265 0:d17db4b0303a add bar
245
266
246 $ cd $TESTTMP
267 $ cd $TESTTMP
247
268
248 Testing `hg split` being run from inside of a directory that was created in the
269 Testing `hg split` being run from inside of a directory that was created in the
249 commit being split:
270 commit being split:
250
271
251 $ hg init hgsplit
272 $ hg init hgsplit
252 $ cd hgsplit
273 $ cd hgsplit
253 $ cat >> .hg/hgrc << EOF
274 $ cat >> .hg/hgrc << EOF
254 > [ui]
275 > [ui]
255 > interactive = 1
276 > interactive = 1
256 > [extensions]
277 > [extensions]
257 > split =
278 > split =
258 > EOF
279 > EOF
259 $ echo anchor > anchor.txt
280 $ echo anchor > anchor.txt
260 $ hg ci -qAm anchor
281 $ hg ci -qAm anchor
261
282
262 Create a changeset with '/otherfile_in_root' and 'somedir/foo', then try to
283 Create a changeset with '/otherfile_in_root' and 'somedir/foo', then try to
263 split it.
284 split it.
264 $ echo otherfile > otherfile_in_root
285 $ echo otherfile > otherfile_in_root
265 $ mkdir somedir
286 $ mkdir somedir
266 $ cd somedir
287 $ cd somedir
267 $ echo hi > foo
288 $ echo hi > foo
268 $ hg ci -qAm split_me
289 $ hg ci -qAm split_me
269 (Note: need to make this file not in this directory, or else the bug doesn't
290 (Note: need to make this file not in this directory, or else the bug doesn't
270 reproduce; we're using a separate file due to concerns of portability on
291 reproduce; we're using a separate file due to concerns of portability on
271 `echo -e`)
292 `echo -e`)
272 $ cat > ../split_commands << EOF
293 $ cat > ../split_commands << EOF
273 > n
294 > n
274 > y
295 > y
275 > y
296 > y
276 > a
297 > a
277 > EOF
298 > EOF
299
300 The split succeeds on no-rmcwd platforms, which alters the rest of the tests
301 #if rmcwd
278 $ cat ../split_commands | hg split
302 $ cat ../split_commands | hg split
279 current directory was removed
303 current directory was removed
280 (consider changing to repo root: $TESTTMP/hgsplit)
304 (consider changing to repo root: $TESTTMP/hgsplit)
281 diff --git a/otherfile_in_root b/otherfile_in_root
305 diff --git a/otherfile_in_root b/otherfile_in_root
282 new file mode 100644
306 new file mode 100644
283 examine changes to 'otherfile_in_root'? [Ynesfdaq?] n
307 examine changes to 'otherfile_in_root'? [Ynesfdaq?] n
284
308
285 diff --git a/somedir/foo b/somedir/foo
309 diff --git a/somedir/foo b/somedir/foo
286 new file mode 100644
310 new file mode 100644
287 examine changes to 'somedir/foo'? [Ynesfdaq?] y
311 examine changes to 'somedir/foo'? [Ynesfdaq?] y
288
312
289 @@ -0,0 +1,1 @@
313 @@ -0,0 +1,1 @@
290 +hi
314 +hi
291 record change 2/2 to 'somedir/foo'? [Ynesfdaq?] y
315 record change 2/2 to 'somedir/foo'? [Ynesfdaq?] y
292
316
293 abort: $ENOENT$
317 abort: $ENOENT$
294 [255]
318 [255]
319 #endif
295
320
296 Let's try that again without the rmdir
321 Let's try that again without the rmdir
297 $ cd $TESTTMP/hgsplit/somedir
322 $ cd $TESTTMP/hgsplit/somedir
298 Show that the previous split didn't do anything
323 Show that the previous split didn't do anything
299 $ hg log -T '{rev}:{node|short} {desc}\n'
324 $ hg log -T '{rev}:{node|short} {desc}\n'
300 1:e26b22a4f0b7 split_me
325 1:e26b22a4f0b7 split_me
301 0:7e53273730c0 anchor
326 0:7e53273730c0 anchor
302 $ hg status
327 $ hg status
303 ? split_commands
328 ? split_commands
304 Try again
329 Try again
305 $ cat ../split_commands | hg $NO_RM split
330 $ cat ../split_commands | hg $NO_RM split
306 diff --git a/otherfile_in_root b/otherfile_in_root
331 diff --git a/otherfile_in_root b/otherfile_in_root
307 new file mode 100644
332 new file mode 100644
308 examine changes to 'otherfile_in_root'? [Ynesfdaq?] n
333 examine changes to 'otherfile_in_root'? [Ynesfdaq?] n
309
334
310 diff --git a/somedir/foo b/somedir/foo
335 diff --git a/somedir/foo b/somedir/foo
311 new file mode 100644
336 new file mode 100644
312 examine changes to 'somedir/foo'? [Ynesfdaq?] y
337 examine changes to 'somedir/foo'? [Ynesfdaq?] y
313
338
314 @@ -0,0 +1,1 @@
339 @@ -0,0 +1,1 @@
315 +hi
340 +hi
316 record change 2/2 to 'somedir/foo'? [Ynesfdaq?] y
341 record change 2/2 to 'somedir/foo'? [Ynesfdaq?] y
317
342
318 created new head
343 created new head
319 diff --git a/otherfile_in_root b/otherfile_in_root
344 diff --git a/otherfile_in_root b/otherfile_in_root
320 new file mode 100644
345 new file mode 100644
321 examine changes to 'otherfile_in_root'? [Ynesfdaq?] a
346 examine changes to 'otherfile_in_root'? [Ynesfdaq?] a
322
347
323 saved backup bundle to $TESTTMP/hgsplit/.hg/strip-backup/*-split.hg (glob)
348 saved backup bundle to $TESTTMP/hgsplit/.hg/strip-backup/*-split.hg (glob)
324 Show that this split did something
349 Show that this split did something
325 $ hg log -T '{rev}:{node|short} {desc}\n'
350 $ hg log -T '{rev}:{node|short} {desc}\n'
326 2:a440f24fca4f split_me
351 2:a440f24fca4f split_me
327 1:c994f20276ab split_me
352 1:c994f20276ab split_me
328 0:7e53273730c0 anchor
353 0:7e53273730c0 anchor
329 $ hg status
354 $ hg status
330 ? split_commands
355 ? split_commands
General Comments 0
You need to be logged in to leave comments. Login now