##// END OF EJS Templates
test-removeemptydirs: adjust to Windows behavior for the `histedit` case...
marmoute -
r48380:5f836c10 default
parent child Browse files
Show More
@@ -1,281 +1,284
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 $ DO_RM=--config=experimental.removeemptydirs=1
4 $ DO_RM=--config=experimental.removeemptydirs=1
5 $ isdir() { if [ -d $1 ]; then echo yes; else echo no; fi }
5 $ isdir() { if [ -d $1 ]; then echo yes; else echo no; fi }
6 $ isfile() { if [ -f $1 ]; then echo yes; else echo no; fi }
6 $ isfile() { if [ -f $1 ]; then echo yes; else echo no; fi }
7
7
8 `hg rm` of the last file in a directory:
8 `hg rm` of the last file in a directory:
9 $ hg init hgrm
9 $ hg init hgrm
10 $ cd hgrm
10 $ cd hgrm
11 $ mkdir somedir
11 $ mkdir somedir
12 $ echo hi > somedir/foo
12 $ echo hi > somedir/foo
13 $ hg ci -qAm foo
13 $ hg ci -qAm foo
14 $ isdir somedir
14 $ isdir somedir
15 yes
15 yes
16 $ hg rm somedir/foo
16 $ hg rm somedir/foo
17 $ isdir somedir
17 $ isdir somedir
18 no
18 no
19 $ hg revert -qa
19 $ hg revert -qa
20 $ isdir somedir
20 $ isdir somedir
21 yes
21 yes
22 $ hg $NO_RM rm somedir/foo
22 $ hg $NO_RM rm somedir/foo
23 $ isdir somedir
23 $ isdir somedir
24 yes
24 yes
25 $ ls somedir
25 $ ls somedir
26 $ cd $TESTTMP
26 $ cd $TESTTMP
27
27
28 `hg mv` of the last file in a directory:
28 `hg mv` of the last file in a directory:
29 $ hg init hgmv
29 $ hg init hgmv
30 $ cd hgmv
30 $ cd hgmv
31 $ mkdir somedir
31 $ mkdir somedir
32 $ mkdir destdir
32 $ mkdir destdir
33 $ echo hi > somedir/foo
33 $ echo hi > somedir/foo
34 $ hg ci -qAm foo
34 $ hg ci -qAm foo
35 $ isdir somedir
35 $ isdir somedir
36 yes
36 yes
37 $ hg mv somedir/foo destdir/foo
37 $ hg mv somedir/foo destdir/foo
38 $ isdir somedir
38 $ isdir somedir
39 no
39 no
40 $ hg revert -qa
40 $ hg revert -qa
41 (revert doesn't get rid of destdir/foo?)
41 (revert doesn't get rid of destdir/foo?)
42 $ rm destdir/foo
42 $ rm destdir/foo
43 $ isdir somedir
43 $ isdir somedir
44 yes
44 yes
45 $ hg $NO_RM mv somedir/foo destdir/foo
45 $ hg $NO_RM mv somedir/foo destdir/foo
46 $ isdir somedir
46 $ isdir somedir
47 yes
47 yes
48 $ ls somedir
48 $ ls somedir
49 $ cd $TESTTMP
49 $ cd $TESTTMP
50
50
51 Updating to a commit that doesn't have the directory:
51 Updating to a commit that doesn't have the directory:
52 $ hg init hgupdate
52 $ hg init hgupdate
53 $ cd hgupdate
53 $ cd hgupdate
54 $ echo hi > r0
54 $ echo hi > r0
55 $ hg ci -qAm r0
55 $ hg ci -qAm r0
56 $ mkdir somedir
56 $ mkdir somedir
57 $ echo hi > somedir/foo
57 $ echo hi > somedir/foo
58 $ hg ci -qAm r1
58 $ hg ci -qAm r1
59 $ isdir somedir
59 $ isdir somedir
60 yes
60 yes
61 $ hg co -q -r ".^"
61 $ hg co -q -r ".^"
62 $ isdir somedir
62 $ isdir somedir
63 no
63 no
64 $ hg co -q tip
64 $ hg co -q tip
65 $ isdir somedir
65 $ isdir somedir
66 yes
66 yes
67 $ hg $NO_RM co -q -r ".^"
67 $ hg $NO_RM co -q -r ".^"
68 $ isdir somedir
68 $ isdir somedir
69 yes
69 yes
70 $ ls somedir
70 $ ls somedir
71 $ cd $TESTTMP
71 $ cd $TESTTMP
72
72
73 Rebasing across a commit that doesn't have the directory, from inside the
73 Rebasing across a commit that doesn't have the directory, from inside the
74 directory:
74 directory:
75 $ hg init hgrebase
75 $ hg init hgrebase
76 $ cd hgrebase
76 $ cd hgrebase
77 $ echo hi > r0
77 $ echo hi > r0
78 $ hg ci -qAm r0
78 $ hg ci -qAm r0
79 $ mkdir somedir
79 $ mkdir somedir
80 $ echo hi > somedir/foo
80 $ echo hi > somedir/foo
81 $ hg ci -qAm first_rebase_source
81 $ hg ci -qAm first_rebase_source
82 $ hg $NO_RM co -q -r ".^"
82 $ hg $NO_RM co -q -r ".^"
83 $ echo hi > somedir/bar
83 $ echo hi > somedir/bar
84 $ hg ci -qAm first_rebase_dest
84 $ hg ci -qAm first_rebase_dest
85 $ hg $NO_RM co -q -r ".^"
85 $ hg $NO_RM co -q -r ".^"
86 $ echo hi > somedir/baz
86 $ echo hi > somedir/baz
87 $ hg ci -qAm second_rebase_dest
87 $ hg ci -qAm second_rebase_dest
88 $ hg co -qr 'desc(first_rebase_source)'
88 $ hg co -qr 'desc(first_rebase_source)'
89 $ cd $TESTTMP/hgrebase/somedir
89 $ cd $TESTTMP/hgrebase/somedir
90 $ hg --config extensions.rebase= rebase -qr . -d 'desc(first_rebase_dest)'
90 $ hg --config extensions.rebase= rebase -qr . -d 'desc(first_rebase_dest)'
91 current directory was removed (rmcwd !)
91 current directory was removed (rmcwd !)
92 (consider changing to repo root: $TESTTMP/hgrebase) (rmcwd !)
92 (consider changing to repo root: $TESTTMP/hgrebase) (rmcwd !)
93 $ cd $TESTTMP/hgrebase/somedir
93 $ cd $TESTTMP/hgrebase/somedir
94 (The current node is the rebased first_rebase_source on top of
94 (The current node is the rebased first_rebase_source on top of
95 first_rebase_dest)
95 first_rebase_dest)
96 This should not output anything about current directory being removed:
96 This should not output anything about current directory being removed:
97 $ hg $NO_RM --config extensions.rebase= rebase -qr . -d 'desc(second_rebase_dest)'
97 $ hg $NO_RM --config extensions.rebase= rebase -qr . -d 'desc(second_rebase_dest)'
98 $ cd $TESTTMP
98 $ cd $TESTTMP
99
99
100 Histediting across a commit that doesn't have the directory, from inside the
100 Histediting across a commit that doesn't have the directory, from inside the
101 directory (reordering nodes):
101 directory (reordering nodes):
102
102
103 A directory with the right pass exists at the end of the run, but it is a
103 A directory with the right pass exists at the end of the run, but it is a
104 different directory than the current one.
104 different directory than the current one.
105
105
106 Windows is not affected
107
106 $ hg init hghistedit
108 $ hg init hghistedit
107 $ cd hghistedit
109 $ cd hghistedit
108 $ echo hi > r0
110 $ echo hi > r0
109 $ hg ci -qAm r0
111 $ hg ci -qAm r0
110 $ echo hi > r1
112 $ echo hi > r1
111 $ hg ci -qAm r1
113 $ hg ci -qAm r1
112 $ echo hi > r2
114 $ echo hi > r2
113 $ hg ci -qAm r2
115 $ hg ci -qAm r2
114 $ mkdir somedir
116 $ mkdir somedir
115 $ echo hi > somedir/foo
117 $ echo hi > somedir/foo
116 $ hg ci -qAm migrating_revision
118 $ hg ci -qAm migrating_revision
117 $ cat > histedit_commands <<EOF
119 $ cat > histedit_commands <<EOF
118 > pick 89079fab8aee 0 r0
120 > pick 89079fab8aee 0 r0
119 > pick e6d271df3142 1 r1
121 > pick e6d271df3142 1 r1
120 > pick 89e25aa83f0f 3 migrating_revision
122 > pick 89e25aa83f0f 3 migrating_revision
121 > pick b550aa12d873 2 r2
123 > pick b550aa12d873 2 r2
122 > EOF
124 > EOF
123 $ cd $TESTTMP/hghistedit/somedir
125 $ cd $TESTTMP/hghistedit/somedir
124 $ hg $DO_RM --config extensions.histedit= histedit -q --commands ../histedit_commands
126 $ hg $DO_RM --config extensions.histedit= histedit -q --commands ../histedit_commands
125 current directory was removed
127 current directory was removed (no-windows !)
126 (consider changing to repo root: $TESTTMP/hghistedit)
128 (consider changing to repo root: $TESTTMP/hghistedit) (no-windows !)
127 $ ls -1 $TESTTMP/hghistedit/
129 $ ls -1 $TESTTMP/hghistedit/
128 histedit_commands
130 histedit_commands
129 r0
131 r0
130 r1
132 r1
131 r2
133 r2
132 somedir
134 somedir
133 $ pwd
135 $ pwd
134 $TESTTMP/hghistedit/somedir
136 $TESTTMP/hghistedit/somedir
135 $ ls -1 $TESTTMP/hghistedit/somedir
137 $ ls -1 $TESTTMP/hghistedit/somedir
136 foo
138 foo
137 $ ls -1
139 $ ls -1
140 foo (windows !)
138
141
139 Get out of the doomed directory
142 Get out of the doomed directory
140
143
141 $ cd $TESTTMP/hghistedit
144 $ cd $TESTTMP/hghistedit
142 $ hg files --rev . | grep somedir/
145 $ hg files --rev . | grep somedir/
143 somedir/foo
146 somedir/foo
144
147
145
148
146 $ cat > histedit_commands <<EOF
149 $ cat > histedit_commands <<EOF
147 > pick 89079fab8aee 0 r0
150 > pick 89079fab8aee 0 r0
148 > pick 7c7a22c6009f 3 migrating_revision
151 > pick 7c7a22c6009f 3 migrating_revision
149 > pick e6d271df3142 1 r1
152 > pick e6d271df3142 1 r1
150 > pick 40a53c2d4276 2 r2
153 > pick 40a53c2d4276 2 r2
151 > EOF
154 > EOF
152 $ cd $TESTTMP/hghistedit/somedir
155 $ cd $TESTTMP/hghistedit/somedir
153 $ hg $NO_RM --config extensions.histedit= histedit -q --commands ../histedit_commands
156 $ hg $NO_RM --config extensions.histedit= histedit -q --commands ../histedit_commands
154 Regardless of system, we should always get a 'yes' here.
157 Regardless of system, we should always get a 'yes' here.
155 $ isfile foo
158 $ isfile foo
156 yes
159 yes
157 $ cd $TESTTMP
160 $ cd $TESTTMP
158
161
159 This is essentially the exact test from issue5826, just cleaned up a little:
162 This is essentially the exact test from issue5826, just cleaned up a little:
160
163
161 $ hg init issue5826_withrm
164 $ hg init issue5826_withrm
162 $ cd issue5826_withrm
165 $ cd issue5826_withrm
163
166
164 Let's only turn this on for this repo so that we don't contaminate later tests.
167 Let's only turn this on for this repo so that we don't contaminate later tests.
165 $ cat >> .hg/hgrc <<EOF
168 $ cat >> .hg/hgrc <<EOF
166 > [extensions]
169 > [extensions]
167 > histedit =
170 > histedit =
168 > EOF
171 > EOF
169 Commit three revisions that each create a directory:
172 Commit three revisions that each create a directory:
170
173
171 $ mkdir foo
174 $ mkdir foo
172 $ touch foo/bar
175 $ touch foo/bar
173 $ hg commit -qAm "add foo"
176 $ hg commit -qAm "add foo"
174
177
175 $ mkdir bar
178 $ mkdir bar
176 $ touch bar/bar
179 $ touch bar/bar
177 $ hg commit -qAm "add bar"
180 $ hg commit -qAm "add bar"
178
181
179 $ mkdir baz
182 $ mkdir baz
180 $ touch baz/bar
183 $ touch baz/bar
181 $ hg commit -qAm "add baz"
184 $ hg commit -qAm "add baz"
182
185
183 Enter the first directory:
186 Enter the first directory:
184
187
185 $ cd foo
188 $ cd foo
186
189
187 Histedit doing 'pick, pick, fold':
190 Histedit doing 'pick, pick, fold':
188
191
189 #if rmcwd
192 #if rmcwd
190
193
191 $ hg histedit --commands - <<EOF
194 $ hg histedit --commands - <<EOF
192 > pick 6274c77c93c3 1 add bar
195 > pick 6274c77c93c3 1 add bar
193 > pick ff70a87b588f 0 add foo
196 > pick ff70a87b588f 0 add foo
194 > fold 9992bb0ac0db 2 add baz
197 > fold 9992bb0ac0db 2 add baz
195 > EOF
198 > EOF
196 current directory was removed
199 current directory was removed
197 (consider changing to repo root: $TESTTMP/issue5826_withrm)
200 (consider changing to repo root: $TESTTMP/issue5826_withrm)
198 abort: $ENOENT$
201 abort: $ENOENT$
199 [255]
202 [255]
200
203
201 Go back to the repo root after losing it as part of that operation:
204 Go back to the repo root after losing it as part of that operation:
202 $ cd $TESTTMP/issue5826_withrm
205 $ cd $TESTTMP/issue5826_withrm
203
206
204 Note the lack of a non-zero exit code from this function - it exits
207 Note the lack of a non-zero exit code from this function - it exits
205 successfully, but doesn't really do anything.
208 successfully, but doesn't really do anything.
206 $ hg histedit --continue
209 $ hg histedit --continue
207 9992bb0ac0db: cannot fold - working copy is not a descendant of previous commit 5c806432464a
210 9992bb0ac0db: cannot fold - working copy is not a descendant of previous commit 5c806432464a
208 saved backup bundle to $TESTTMP/issue5826_withrm/.hg/strip-backup/ff70a87b588f-e94f9789-histedit.hg
211 saved backup bundle to $TESTTMP/issue5826_withrm/.hg/strip-backup/ff70a87b588f-e94f9789-histedit.hg
209
212
210 $ hg log -T '{rev}:{node|short} {desc}\n'
213 $ hg log -T '{rev}:{node|short} {desc}\n'
211 2:94e3f9fae1d6 fold-temp-revision 9992bb0ac0db
214 2:94e3f9fae1d6 fold-temp-revision 9992bb0ac0db
212 1:5c806432464a add foo
215 1:5c806432464a add foo
213 0:d17db4b0303a add bar
216 0:d17db4b0303a add bar
214
217
215 #else
218 #else
216
219
217 $ cd $TESTTMP/issue5826_withrm
220 $ cd $TESTTMP/issue5826_withrm
218
221
219 $ hg histedit --commands - <<EOF
222 $ hg histedit --commands - <<EOF
220 > pick 6274c77c93c3 1 add bar
223 > pick 6274c77c93c3 1 add bar
221 > pick ff70a87b588f 0 add foo
224 > pick ff70a87b588f 0 add foo
222 > fold 9992bb0ac0db 2 add baz
225 > fold 9992bb0ac0db 2 add baz
223 > EOF
226 > EOF
224 saved backup bundle to $TESTTMP/issue5826_withrm/.hg/strip-backup/5c806432464a-cd4c8d86-histedit.hg
227 saved backup bundle to $TESTTMP/issue5826_withrm/.hg/strip-backup/5c806432464a-cd4c8d86-histedit.hg
225
228
226 $ hg log -T '{rev}:{node|short} {desc}\n'
229 $ hg log -T '{rev}:{node|short} {desc}\n'
227 1:b9eddaa97cbc add foo
230 1:b9eddaa97cbc add foo
228 ***
231 ***
229 add baz
232 add baz
230 0:d17db4b0303a add bar
233 0:d17db4b0303a add bar
231
234
232 #endif
235 #endif
233
236
234 Now test that again with experimental.removeemptydirs=false:
237 Now test that again with experimental.removeemptydirs=false:
235 $ hg init issue5826_norm
238 $ hg init issue5826_norm
236 $ cd issue5826_norm
239 $ cd issue5826_norm
237
240
238 Let's only turn this on for this repo so that we don't contaminate later tests.
241 Let's only turn this on for this repo so that we don't contaminate later tests.
239 $ cat >> .hg/hgrc <<EOF
242 $ cat >> .hg/hgrc <<EOF
240 > [extensions]
243 > [extensions]
241 > histedit =
244 > histedit =
242 > [experimental]
245 > [experimental]
243 > removeemptydirs = false
246 > removeemptydirs = false
244 > EOF
247 > EOF
245 Commit three revisions that each create a directory:
248 Commit three revisions that each create a directory:
246
249
247 $ mkdir foo
250 $ mkdir foo
248 $ touch foo/bar
251 $ touch foo/bar
249 $ hg commit -qAm "add foo"
252 $ hg commit -qAm "add foo"
250
253
251 $ mkdir bar
254 $ mkdir bar
252 $ touch bar/bar
255 $ touch bar/bar
253 $ hg commit -qAm "add bar"
256 $ hg commit -qAm "add bar"
254
257
255 $ mkdir baz
258 $ mkdir baz
256 $ touch baz/bar
259 $ touch baz/bar
257 $ hg commit -qAm "add baz"
260 $ hg commit -qAm "add baz"
258
261
259 Enter the first directory:
262 Enter the first directory:
260
263
261 $ cd foo
264 $ cd foo
262
265
263 Histedit doing 'pick, pick, fold':
266 Histedit doing 'pick, pick, fold':
264
267
265 $ hg histedit --commands - <<EOF
268 $ hg histedit --commands - <<EOF
266 > pick 6274c77c93c3 1 add bar
269 > pick 6274c77c93c3 1 add bar
267 > pick ff70a87b588f 0 add foo
270 > pick ff70a87b588f 0 add foo
268 > fold 9992bb0ac0db 2 add baz
271 > fold 9992bb0ac0db 2 add baz
269 > EOF
272 > EOF
270 saved backup bundle to $TESTTMP/issue5826_withrm/issue5826_norm/.hg/strip-backup/5c806432464a-cd4c8d86-histedit.hg
273 saved backup bundle to $TESTTMP/issue5826_withrm/issue5826_norm/.hg/strip-backup/5c806432464a-cd4c8d86-histedit.hg
271
274
272 Note the lack of a 'cd' being necessary here, and we don't need to 'histedit
275 Note the lack of a 'cd' being necessary here, and we don't need to 'histedit
273 --continue'
276 --continue'
274
277
275 $ hg log -T '{rev}:{node|short} {desc}\n'
278 $ hg log -T '{rev}:{node|short} {desc}\n'
276 1:b9eddaa97cbc add foo
279 1:b9eddaa97cbc add foo
277 ***
280 ***
278 add baz
281 add baz
279 0:d17db4b0303a add bar
282 0:d17db4b0303a add bar
280
283
281 $ cd $TESTTMP
284 $ cd $TESTTMP
General Comments 0
You need to be logged in to leave comments. Login now