##// END OF EJS Templates
test-sparse: drop unnecessary globs
Matt Harbison -
r33792:cf300c1a default
parent child Browse files
Show More
@@ -1,397 +1,397
1 test sparse
1 test sparse
2
2
3 $ hg init myrepo
3 $ hg init myrepo
4 $ cd myrepo
4 $ cd myrepo
5 $ cat > .hg/hgrc <<EOF
5 $ cat > .hg/hgrc <<EOF
6 > [extensions]
6 > [extensions]
7 > sparse=
7 > sparse=
8 > strip=
8 > strip=
9 > EOF
9 > EOF
10
10
11 $ echo a > show
11 $ echo a > show
12 $ echo x > hide
12 $ echo x > hide
13 $ hg ci -Aqm 'initial'
13 $ hg ci -Aqm 'initial'
14
14
15 $ echo b > show
15 $ echo b > show
16 $ echo y > hide
16 $ echo y > hide
17 $ echo aa > show2
17 $ echo aa > show2
18 $ echo xx > hide2
18 $ echo xx > hide2
19 $ hg ci -Aqm 'two'
19 $ hg ci -Aqm 'two'
20
20
21 Verify basic --include
21 Verify basic --include
22
22
23 $ hg up -q 0
23 $ hg up -q 0
24 $ hg debugsparse --include 'hide'
24 $ hg debugsparse --include 'hide'
25 $ ls
25 $ ls
26 hide
26 hide
27
27
28 Absolute paths outside the repo should just be rejected
28 Absolute paths outside the repo should just be rejected
29
29
30 #if no-windows
30 #if no-windows
31 $ hg debugsparse --include /foo/bar
31 $ hg debugsparse --include /foo/bar
32 abort: paths cannot be absolute
32 abort: paths cannot be absolute
33 [255]
33 [255]
34 $ hg debugsparse --include '$TESTTMP/myrepo/hide'
34 $ hg debugsparse --include '$TESTTMP/myrepo/hide'
35
35
36 $ hg debugsparse --include '/root'
36 $ hg debugsparse --include '/root'
37 abort: paths cannot be absolute
37 abort: paths cannot be absolute
38 [255]
38 [255]
39 #else
39 #else
40 TODO: See if this can be made to fail the same way as on Unix
40 TODO: See if this can be made to fail the same way as on Unix
41 $ hg debugsparse --include /c/foo/bar
41 $ hg debugsparse --include /c/foo/bar
42 abort: paths cannot be absolute
42 abort: paths cannot be absolute
43 [255]
43 [255]
44 $ hg debugsparse --include '$TESTTMP/myrepo/hide'
44 $ hg debugsparse --include '$TESTTMP/myrepo/hide'
45
45
46 $ hg debugsparse --include '/c/root'
46 $ hg debugsparse --include '/c/root'
47 abort: paths cannot be absolute
47 abort: paths cannot be absolute
48 [255]
48 [255]
49 #endif
49 #endif
50
50
51 Paths should be treated as cwd-relative, not repo-root-relative
51 Paths should be treated as cwd-relative, not repo-root-relative
52 $ mkdir subdir && cd subdir
52 $ mkdir subdir && cd subdir
53 $ hg debugsparse --include path
53 $ hg debugsparse --include path
54 $ hg debugsparse
54 $ hg debugsparse
55 [include]
55 [include]
56 $TESTTMP/myrepo/hide
56 $TESTTMP/myrepo/hide
57 hide
57 hide
58 subdir/path (glob)
58 subdir/path
59
59
60 $ cd ..
60 $ cd ..
61 $ echo hello > subdir/file2.ext
61 $ echo hello > subdir/file2.ext
62 $ cd subdir
62 $ cd subdir
63 $ hg debugsparse --include '**.ext' # let us test globs
63 $ hg debugsparse --include '**.ext' # let us test globs
64 $ hg debugsparse --include 'path:abspath' # and a path: pattern
64 $ hg debugsparse --include 'path:abspath' # and a path: pattern
65 $ cd ..
65 $ cd ..
66 $ hg debugsparse
66 $ hg debugsparse
67 [include]
67 [include]
68 $TESTTMP/myrepo/hide
68 $TESTTMP/myrepo/hide
69 hide
69 hide
70 path:abspath
70 path:abspath
71 subdir/**.ext
71 subdir/**.ext
72 subdir/path (glob)
72 subdir/path
73
73
74 $ rm -rf subdir
74 $ rm -rf subdir
75
75
76 Verify commiting while sparse includes other files
76 Verify commiting while sparse includes other files
77
77
78 $ echo z > hide
78 $ echo z > hide
79 $ hg ci -Aqm 'edit hide'
79 $ hg ci -Aqm 'edit hide'
80 $ ls
80 $ ls
81 hide
81 hide
82 $ hg manifest
82 $ hg manifest
83 hide
83 hide
84 show
84 show
85
85
86 Verify --reset brings files back
86 Verify --reset brings files back
87
87
88 $ hg debugsparse --reset
88 $ hg debugsparse --reset
89 $ ls
89 $ ls
90 hide
90 hide
91 show
91 show
92 $ cat hide
92 $ cat hide
93 z
93 z
94 $ cat show
94 $ cat show
95 a
95 a
96
96
97 Verify 'hg debugsparse' default output
97 Verify 'hg debugsparse' default output
98
98
99 $ hg up -q null
99 $ hg up -q null
100 $ hg debugsparse --include 'show*'
100 $ hg debugsparse --include 'show*'
101
101
102 $ hg debugsparse
102 $ hg debugsparse
103 [include]
103 [include]
104 show*
104 show*
105
105
106 Verify update only writes included files
106 Verify update only writes included files
107
107
108 $ hg up -q 0
108 $ hg up -q 0
109 $ ls
109 $ ls
110 show
110 show
111
111
112 $ hg up -q 1
112 $ hg up -q 1
113 $ ls
113 $ ls
114 show
114 show
115 show2
115 show2
116
116
117 Verify status only shows included files
117 Verify status only shows included files
118
118
119 $ touch hide
119 $ touch hide
120 $ touch hide3
120 $ touch hide3
121 $ echo c > show
121 $ echo c > show
122 $ hg status
122 $ hg status
123 M show
123 M show
124
124
125 Adding an excluded file should fail
125 Adding an excluded file should fail
126
126
127 $ hg add hide3
127 $ hg add hide3
128 abort: cannot add 'hide3' - it is outside the sparse checkout
128 abort: cannot add 'hide3' - it is outside the sparse checkout
129 (include file with `hg debugsparse --include <pattern>` or use `hg add -s <file>` to include file directory while adding)
129 (include file with `hg debugsparse --include <pattern>` or use `hg add -s <file>` to include file directory while adding)
130 [255]
130 [255]
131
131
132 Verify deleting sparseness while a file has changes fails
132 Verify deleting sparseness while a file has changes fails
133
133
134 $ hg debugsparse --delete 'show*'
134 $ hg debugsparse --delete 'show*'
135 pending changes to 'hide'
135 pending changes to 'hide'
136 abort: cannot change sparseness due to pending changes (delete the files or use --force to bring them back dirty)
136 abort: cannot change sparseness due to pending changes (delete the files or use --force to bring them back dirty)
137 [255]
137 [255]
138
138
139 Verify deleting sparseness with --force brings back files
139 Verify deleting sparseness with --force brings back files
140
140
141 $ hg debugsparse --delete -f 'show*'
141 $ hg debugsparse --delete -f 'show*'
142 pending changes to 'hide'
142 pending changes to 'hide'
143 $ ls
143 $ ls
144 hide
144 hide
145 hide2
145 hide2
146 hide3
146 hide3
147 show
147 show
148 show2
148 show2
149 $ hg st
149 $ hg st
150 M hide
150 M hide
151 M show
151 M show
152 ? hide3
152 ? hide3
153
153
154 Verify editing sparseness fails if pending changes
154 Verify editing sparseness fails if pending changes
155
155
156 $ hg debugsparse --include 'show*'
156 $ hg debugsparse --include 'show*'
157 pending changes to 'hide'
157 pending changes to 'hide'
158 abort: could not update sparseness due to pending changes
158 abort: could not update sparseness due to pending changes
159 [255]
159 [255]
160
160
161 Verify adding sparseness hides files
161 Verify adding sparseness hides files
162
162
163 $ hg debugsparse --exclude -f 'hide*'
163 $ hg debugsparse --exclude -f 'hide*'
164 pending changes to 'hide'
164 pending changes to 'hide'
165 $ ls
165 $ ls
166 hide
166 hide
167 hide3
167 hide3
168 show
168 show
169 show2
169 show2
170 $ hg st
170 $ hg st
171 M show
171 M show
172
172
173 $ hg up -qC .
173 $ hg up -qC .
174 TODO: add an option to purge to also purge files outside the sparse config?
174 TODO: add an option to purge to also purge files outside the sparse config?
175 $ hg purge --all --config extensions.purge=
175 $ hg purge --all --config extensions.purge=
176 $ ls
176 $ ls
177 hide
177 hide
178 hide3
178 hide3
179 show
179 show
180 show2
180 show2
181 For now, manually remove the files
181 For now, manually remove the files
182 $ rm hide hide3
182 $ rm hide hide3
183
183
184 Verify rebase temporarily includes excluded files
184 Verify rebase temporarily includes excluded files
185
185
186 $ hg rebase -d 1 -r 2 --config extensions.rebase=
186 $ hg rebase -d 1 -r 2 --config extensions.rebase=
187 rebasing 2:b91df4f39e75 "edit hide" (tip)
187 rebasing 2:b91df4f39e75 "edit hide" (tip)
188 temporarily included 1 file(s) in the sparse checkout for merging
188 temporarily included 1 file(s) in the sparse checkout for merging
189 merging hide
189 merging hide
190 warning: conflicts while merging hide! (edit, then use 'hg resolve --mark')
190 warning: conflicts while merging hide! (edit, then use 'hg resolve --mark')
191 unresolved conflicts (see hg resolve, then hg rebase --continue)
191 unresolved conflicts (see hg resolve, then hg rebase --continue)
192 [1]
192 [1]
193
193
194 $ hg debugsparse
194 $ hg debugsparse
195 [exclude]
195 [exclude]
196 hide*
196 hide*
197
197
198 Temporarily Included Files (for merge/rebase):
198 Temporarily Included Files (for merge/rebase):
199 hide
199 hide
200
200
201 $ cat hide
201 $ cat hide
202 <<<<<<< dest: 39278f7c08a9 - test: two
202 <<<<<<< dest: 39278f7c08a9 - test: two
203 y
203 y
204 =======
204 =======
205 z
205 z
206 >>>>>>> source: b91df4f39e75 - test: edit hide
206 >>>>>>> source: b91df4f39e75 - test: edit hide
207
207
208 Verify aborting a rebase cleans up temporary files
208 Verify aborting a rebase cleans up temporary files
209
209
210 $ hg rebase --abort --config extensions.rebase=
210 $ hg rebase --abort --config extensions.rebase=
211 cleaned up 1 temporarily added file(s) from the sparse checkout
211 cleaned up 1 temporarily added file(s) from the sparse checkout
212 rebase aborted
212 rebase aborted
213 $ rm hide.orig
213 $ rm hide.orig
214
214
215 $ ls
215 $ ls
216 show
216 show
217 show2
217 show2
218
218
219 Verify merge fails if merging excluded files
219 Verify merge fails if merging excluded files
220
220
221 $ hg up -q 1
221 $ hg up -q 1
222 $ hg merge -r 2
222 $ hg merge -r 2
223 temporarily included 1 file(s) in the sparse checkout for merging
223 temporarily included 1 file(s) in the sparse checkout for merging
224 merging hide
224 merging hide
225 warning: conflicts while merging hide! (edit, then use 'hg resolve --mark')
225 warning: conflicts while merging hide! (edit, then use 'hg resolve --mark')
226 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
226 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
227 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
227 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
228 [1]
228 [1]
229 $ hg debugsparse
229 $ hg debugsparse
230 [exclude]
230 [exclude]
231 hide*
231 hide*
232
232
233 Temporarily Included Files (for merge/rebase):
233 Temporarily Included Files (for merge/rebase):
234 hide
234 hide
235
235
236 $ hg up -C .
236 $ hg up -C .
237 cleaned up 1 temporarily added file(s) from the sparse checkout
237 cleaned up 1 temporarily added file(s) from the sparse checkout
238 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
238 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
239 $ hg debugsparse
239 $ hg debugsparse
240 [exclude]
240 [exclude]
241 hide*
241 hide*
242
242
243
243
244 Verify strip -k resets dirstate correctly
244 Verify strip -k resets dirstate correctly
245
245
246 $ hg status
246 $ hg status
247 $ hg debugsparse
247 $ hg debugsparse
248 [exclude]
248 [exclude]
249 hide*
249 hide*
250
250
251 $ hg log -r . -T '{rev}\n' --stat
251 $ hg log -r . -T '{rev}\n' --stat
252 1
252 1
253 hide | 2 +-
253 hide | 2 +-
254 hide2 | 1 +
254 hide2 | 1 +
255 show | 2 +-
255 show | 2 +-
256 show2 | 1 +
256 show2 | 1 +
257 4 files changed, 4 insertions(+), 2 deletions(-)
257 4 files changed, 4 insertions(+), 2 deletions(-)
258
258
259 $ hg strip -r . -k
259 $ hg strip -r . -k
260 saved backup bundle to $TESTTMP/myrepo/.hg/strip-backup/39278f7c08a9-ce59e002-backup.hg (glob)
260 saved backup bundle to $TESTTMP/myrepo/.hg/strip-backup/39278f7c08a9-ce59e002-backup.hg (glob)
261 $ hg status
261 $ hg status
262 M show
262 M show
263 ? show2
263 ? show2
264
264
265 Verify rebase succeeds if all changed files are in sparse checkout
265 Verify rebase succeeds if all changed files are in sparse checkout
266
266
267 $ hg commit -Aqm "add show2"
267 $ hg commit -Aqm "add show2"
268 $ hg rebase -d 1 --config extensions.rebase=
268 $ hg rebase -d 1 --config extensions.rebase=
269 rebasing 2:bdde55290160 "add show2" (tip)
269 rebasing 2:bdde55290160 "add show2" (tip)
270 saved backup bundle to $TESTTMP/myrepo/.hg/strip-backup/bdde55290160-216ed9c6-rebase.hg (glob)
270 saved backup bundle to $TESTTMP/myrepo/.hg/strip-backup/bdde55290160-216ed9c6-rebase.hg (glob)
271
271
272 Verify log --sparse only shows commits that affect the sparse checkout
272 Verify log --sparse only shows commits that affect the sparse checkout
273
273
274 $ hg log -T '{rev} '
274 $ hg log -T '{rev} '
275 2 1 0 (no-eol)
275 2 1 0 (no-eol)
276 $ hg log --sparse -T '{rev} '
276 $ hg log --sparse -T '{rev} '
277 2 0 (no-eol)
277 2 0 (no-eol)
278
278
279 Test status on a file in a subdir
279 Test status on a file in a subdir
280
280
281 $ mkdir -p dir1/dir2
281 $ mkdir -p dir1/dir2
282 $ touch dir1/dir2/file
282 $ touch dir1/dir2/file
283 $ hg debugsparse -I dir1/dir2
283 $ hg debugsparse -I dir1/dir2
284 $ hg status
284 $ hg status
285 ? dir1/dir2/file
285 ? dir1/dir2/file
286
286
287 Test that add -s adds dirs to sparse profile
287 Test that add -s adds dirs to sparse profile
288
288
289 $ hg debugsparse --reset
289 $ hg debugsparse --reset
290 $ hg debugsparse --include empty
290 $ hg debugsparse --include empty
291 $ hg debugsparse
291 $ hg debugsparse
292 [include]
292 [include]
293 empty
293 empty
294
294
295
295
296 $ mkdir add
296 $ mkdir add
297 $ touch add/foo
297 $ touch add/foo
298 $ touch add/bar
298 $ touch add/bar
299 $ hg add add/foo
299 $ hg add add/foo
300 abort: cannot add 'add/foo' - it is outside the sparse checkout
300 abort: cannot add 'add/foo' - it is outside the sparse checkout
301 (include file with `hg debugsparse --include <pattern>` or use `hg add -s <file>` to include file directory while adding)
301 (include file with `hg debugsparse --include <pattern>` or use `hg add -s <file>` to include file directory while adding)
302 [255]
302 [255]
303 $ hg add -s add/foo
303 $ hg add -s add/foo
304 $ hg st
304 $ hg st
305 A add/foo
305 A add/foo
306 ? add/bar
306 ? add/bar
307 $ hg debugsparse
307 $ hg debugsparse
308 [include]
308 [include]
309 add
309 add
310 empty
310 empty
311
311
312 $ hg add -s add/*
312 $ hg add -s add/*
313 add/foo already tracked!
313 add/foo already tracked!
314 $ hg st
314 $ hg st
315 A add/bar
315 A add/bar
316 A add/foo
316 A add/foo
317 $ hg debugsparse
317 $ hg debugsparse
318 [include]
318 [include]
319 add
319 add
320 empty
320 empty
321
321
322
322
323 $ cd ..
323 $ cd ..
324
324
325 Test non-sparse repos work while sparse is loaded
325 Test non-sparse repos work while sparse is loaded
326 $ hg init sparserepo
326 $ hg init sparserepo
327 $ hg init nonsparserepo
327 $ hg init nonsparserepo
328 $ cd sparserepo
328 $ cd sparserepo
329 $ cat > .hg/hgrc <<EOF
329 $ cat > .hg/hgrc <<EOF
330 > [extensions]
330 > [extensions]
331 > sparse=
331 > sparse=
332 > EOF
332 > EOF
333 $ cd ../nonsparserepo
333 $ cd ../nonsparserepo
334 $ echo x > x && hg add x && hg commit -qAm x
334 $ echo x > x && hg add x && hg commit -qAm x
335 $ cd ../sparserepo
335 $ cd ../sparserepo
336 $ hg clone ../nonsparserepo ../nonsparserepo2
336 $ hg clone ../nonsparserepo ../nonsparserepo2
337 updating to branch default
337 updating to branch default
338 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
338 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
339
339
340 Test debugrebuilddirstate
340 Test debugrebuilddirstate
341 $ cd ../sparserepo
341 $ cd ../sparserepo
342 $ touch included
342 $ touch included
343 $ touch excluded
343 $ touch excluded
344 $ hg add included excluded
344 $ hg add included excluded
345 $ hg commit -m 'a commit' -q
345 $ hg commit -m 'a commit' -q
346 $ cp .hg/dirstate ../dirstateboth
346 $ cp .hg/dirstate ../dirstateboth
347 $ hg debugsparse -X excluded
347 $ hg debugsparse -X excluded
348 $ cp ../dirstateboth .hg/dirstate
348 $ cp ../dirstateboth .hg/dirstate
349 $ hg debugrebuilddirstate
349 $ hg debugrebuilddirstate
350 $ hg debugdirstate
350 $ hg debugdirstate
351 n 0 -1 unset included
351 n 0 -1 unset included
352
352
353 Test debugdirstate --minimal where file is in the parent manifest but not the
353 Test debugdirstate --minimal where file is in the parent manifest but not the
354 dirstate
354 dirstate
355 $ hg debugsparse -X included
355 $ hg debugsparse -X included
356 $ hg debugdirstate
356 $ hg debugdirstate
357 $ cp .hg/dirstate ../dirstateallexcluded
357 $ cp .hg/dirstate ../dirstateallexcluded
358 $ hg debugsparse --reset
358 $ hg debugsparse --reset
359 $ hg debugsparse -X excluded
359 $ hg debugsparse -X excluded
360 $ cp ../dirstateallexcluded .hg/dirstate
360 $ cp ../dirstateallexcluded .hg/dirstate
361 $ touch includedadded
361 $ touch includedadded
362 $ hg add includedadded
362 $ hg add includedadded
363 $ hg debugdirstate --nodates
363 $ hg debugdirstate --nodates
364 a 0 -1 unset includedadded
364 a 0 -1 unset includedadded
365 $ hg debugrebuilddirstate --minimal
365 $ hg debugrebuilddirstate --minimal
366 $ hg debugdirstate --nodates
366 $ hg debugdirstate --nodates
367 n 0 -1 unset included
367 n 0 -1 unset included
368 a 0 -1 * includedadded (glob)
368 a 0 -1 * includedadded (glob)
369
369
370 Test debugdirstate --minimal where a file is not in parent manifest
370 Test debugdirstate --minimal where a file is not in parent manifest
371 but in the dirstate. This should take into account excluded files in the
371 but in the dirstate. This should take into account excluded files in the
372 manifest
372 manifest
373 $ cp ../dirstateboth .hg/dirstate
373 $ cp ../dirstateboth .hg/dirstate
374 $ touch includedadded
374 $ touch includedadded
375 $ hg add includedadded
375 $ hg add includedadded
376 $ touch excludednomanifest
376 $ touch excludednomanifest
377 $ hg add excludednomanifest
377 $ hg add excludednomanifest
378 $ cp .hg/dirstate ../moreexcluded
378 $ cp .hg/dirstate ../moreexcluded
379 $ hg forget excludednomanifest
379 $ hg forget excludednomanifest
380 $ rm excludednomanifest
380 $ rm excludednomanifest
381 $ hg debugsparse -X excludednomanifest
381 $ hg debugsparse -X excludednomanifest
382 $ cp ../moreexcluded .hg/dirstate
382 $ cp ../moreexcluded .hg/dirstate
383 $ hg manifest
383 $ hg manifest
384 excluded
384 excluded
385 included
385 included
386 We have files in the dirstate that are included and excluded. Some are in the
386 We have files in the dirstate that are included and excluded. Some are in the
387 manifest and some are not.
387 manifest and some are not.
388 $ hg debugdirstate --nodates
388 $ hg debugdirstate --nodates
389 n 644 0 * excluded (glob)
389 n 644 0 * excluded (glob)
390 a 0 -1 * excludednomanifest (glob)
390 a 0 -1 * excludednomanifest (glob)
391 n 644 0 * included (glob)
391 n 644 0 * included (glob)
392 a 0 -1 * includedadded (glob)
392 a 0 -1 * includedadded (glob)
393 $ hg debugrebuilddirstate --minimal
393 $ hg debugrebuilddirstate --minimal
394 $ hg debugdirstate --nodates
394 $ hg debugdirstate --nodates
395 n 644 0 * included (glob)
395 n 644 0 * included (glob)
396 a 0 -1 * includedadded (glob)
396 a 0 -1 * includedadded (glob)
397
397
General Comments 0
You need to be logged in to leave comments. Login now