##// END OF EJS Templates
test-sparse: make the '.hg' exclusion filter Windows compatible
Matt Harbison -
r35788:0aafeded default
parent child Browse files
Show More
@@ -1,418 +1,418
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
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
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 merge --abort' to abandon
227 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' 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
260 saved backup bundle to $TESTTMP/myrepo/.hg/strip-backup/39278f7c08a9-ce59e002-backup.hg
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
270 saved backup bundle to $TESTTMP/myrepo/.hg/strip-backup/bdde55290160-216ed9c6-rebase.hg
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 Mix files and subdirectories, both "glob:" and unprefixed
287 Mix files and subdirectories, both "glob:" and unprefixed
288
288
289 $ hg debugsparse --reset
289 $ hg debugsparse --reset
290 $ touch dir1/notshown
290 $ touch dir1/notshown
291 $ hg commit -A dir1/notshown -m "notshown"
291 $ hg commit -A dir1/notshown -m "notshown"
292 $ hg debugsparse --include 'dir1/dir2'
292 $ hg debugsparse --include 'dir1/dir2'
293 $ $PYTHON $TESTDIR/list-tree.py . | grep -v ./.hg
293 $ $PYTHON $TESTDIR/list-tree.py . | egrep -v '\.[\/]\.hg'
294 ./
294 ./
295 ./dir1/
295 ./dir1/
296 ./dir1/dir2/
296 ./dir1/dir2/
297 ./dir1/dir2/file
297 ./dir1/dir2/file
298 ./hide.orig
298 ./hide.orig
299 $ hg debugsparse --delete 'dir1/dir2'
299 $ hg debugsparse --delete 'dir1/dir2'
300 $ hg debugsparse --include 'glob:dir1/dir2'
300 $ hg debugsparse --include 'glob:dir1/dir2'
301 $ $PYTHON $TESTDIR/list-tree.py . | grep -v ./.hg
301 $ $PYTHON $TESTDIR/list-tree.py . | egrep -v '\.[\/]\.hg'
302 ./
302 ./
303 ./dir1/
303 ./dir1/
304 ./dir1/dir2/
304 ./dir1/dir2/
305 ./dir1/dir2/file
305 ./dir1/dir2/file
306 ./hide.orig
306 ./hide.orig
307
307
308 Test that add -s adds dirs to sparse profile
308 Test that add -s adds dirs to sparse profile
309
309
310 $ hg debugsparse --reset
310 $ hg debugsparse --reset
311 $ hg debugsparse --include empty
311 $ hg debugsparse --include empty
312 $ hg debugsparse
312 $ hg debugsparse
313 [include]
313 [include]
314 empty
314 empty
315
315
316
316
317 $ mkdir add
317 $ mkdir add
318 $ touch add/foo
318 $ touch add/foo
319 $ touch add/bar
319 $ touch add/bar
320 $ hg add add/foo
320 $ hg add add/foo
321 abort: cannot add 'add/foo' - it is outside the sparse checkout
321 abort: cannot add 'add/foo' - it is outside the sparse checkout
322 (include file with `hg debugsparse --include <pattern>` or use `hg add -s <file>` to include file directory while adding)
322 (include file with `hg debugsparse --include <pattern>` or use `hg add -s <file>` to include file directory while adding)
323 [255]
323 [255]
324 $ hg add -s add/foo
324 $ hg add -s add/foo
325 $ hg st
325 $ hg st
326 A add/foo
326 A add/foo
327 ? add/bar
327 ? add/bar
328 $ hg debugsparse
328 $ hg debugsparse
329 [include]
329 [include]
330 add
330 add
331 empty
331 empty
332
332
333 $ hg add -s add/*
333 $ hg add -s add/*
334 add/foo already tracked!
334 add/foo already tracked!
335 $ hg st
335 $ hg st
336 A add/bar
336 A add/bar
337 A add/foo
337 A add/foo
338 $ hg debugsparse
338 $ hg debugsparse
339 [include]
339 [include]
340 add
340 add
341 empty
341 empty
342
342
343
343
344 $ cd ..
344 $ cd ..
345
345
346 Test non-sparse repos work while sparse is loaded
346 Test non-sparse repos work while sparse is loaded
347 $ hg init sparserepo
347 $ hg init sparserepo
348 $ hg init nonsparserepo
348 $ hg init nonsparserepo
349 $ cd sparserepo
349 $ cd sparserepo
350 $ cat > .hg/hgrc <<EOF
350 $ cat > .hg/hgrc <<EOF
351 > [extensions]
351 > [extensions]
352 > sparse=
352 > sparse=
353 > EOF
353 > EOF
354 $ cd ../nonsparserepo
354 $ cd ../nonsparserepo
355 $ echo x > x && hg add x && hg commit -qAm x
355 $ echo x > x && hg add x && hg commit -qAm x
356 $ cd ../sparserepo
356 $ cd ../sparserepo
357 $ hg clone ../nonsparserepo ../nonsparserepo2
357 $ hg clone ../nonsparserepo ../nonsparserepo2
358 updating to branch default
358 updating to branch default
359 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
359 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
360
360
361 Test debugrebuilddirstate
361 Test debugrebuilddirstate
362 $ cd ../sparserepo
362 $ cd ../sparserepo
363 $ touch included
363 $ touch included
364 $ touch excluded
364 $ touch excluded
365 $ hg add included excluded
365 $ hg add included excluded
366 $ hg commit -m 'a commit' -q
366 $ hg commit -m 'a commit' -q
367 $ cp .hg/dirstate ../dirstateboth
367 $ cp .hg/dirstate ../dirstateboth
368 $ hg debugsparse -X excluded
368 $ hg debugsparse -X excluded
369 $ cp ../dirstateboth .hg/dirstate
369 $ cp ../dirstateboth .hg/dirstate
370 $ hg debugrebuilddirstate
370 $ hg debugrebuilddirstate
371 $ hg debugdirstate
371 $ hg debugdirstate
372 n 0 -1 unset included
372 n 0 -1 unset included
373
373
374 Test debugdirstate --minimal where file is in the parent manifest but not the
374 Test debugdirstate --minimal where file is in the parent manifest but not the
375 dirstate
375 dirstate
376 $ hg debugsparse -X included
376 $ hg debugsparse -X included
377 $ hg debugdirstate
377 $ hg debugdirstate
378 $ cp .hg/dirstate ../dirstateallexcluded
378 $ cp .hg/dirstate ../dirstateallexcluded
379 $ hg debugsparse --reset
379 $ hg debugsparse --reset
380 $ hg debugsparse -X excluded
380 $ hg debugsparse -X excluded
381 $ cp ../dirstateallexcluded .hg/dirstate
381 $ cp ../dirstateallexcluded .hg/dirstate
382 $ touch includedadded
382 $ touch includedadded
383 $ hg add includedadded
383 $ hg add includedadded
384 $ hg debugdirstate --nodates
384 $ hg debugdirstate --nodates
385 a 0 -1 unset includedadded
385 a 0 -1 unset includedadded
386 $ hg debugrebuilddirstate --minimal
386 $ hg debugrebuilddirstate --minimal
387 $ hg debugdirstate --nodates
387 $ hg debugdirstate --nodates
388 n 0 -1 unset included
388 n 0 -1 unset included
389 a 0 -1 * includedadded (glob)
389 a 0 -1 * includedadded (glob)
390
390
391 Test debugdirstate --minimal where a file is not in parent manifest
391 Test debugdirstate --minimal where a file is not in parent manifest
392 but in the dirstate. This should take into account excluded files in the
392 but in the dirstate. This should take into account excluded files in the
393 manifest
393 manifest
394 $ cp ../dirstateboth .hg/dirstate
394 $ cp ../dirstateboth .hg/dirstate
395 $ touch includedadded
395 $ touch includedadded
396 $ hg add includedadded
396 $ hg add includedadded
397 $ touch excludednomanifest
397 $ touch excludednomanifest
398 $ hg add excludednomanifest
398 $ hg add excludednomanifest
399 $ cp .hg/dirstate ../moreexcluded
399 $ cp .hg/dirstate ../moreexcluded
400 $ hg forget excludednomanifest
400 $ hg forget excludednomanifest
401 $ rm excludednomanifest
401 $ rm excludednomanifest
402 $ hg debugsparse -X excludednomanifest
402 $ hg debugsparse -X excludednomanifest
403 $ cp ../moreexcluded .hg/dirstate
403 $ cp ../moreexcluded .hg/dirstate
404 $ hg manifest
404 $ hg manifest
405 excluded
405 excluded
406 included
406 included
407 We have files in the dirstate that are included and excluded. Some are in the
407 We have files in the dirstate that are included and excluded. Some are in the
408 manifest and some are not.
408 manifest and some are not.
409 $ hg debugdirstate --nodates
409 $ hg debugdirstate --nodates
410 n 644 0 * excluded (glob)
410 n 644 0 * excluded (glob)
411 a 0 -1 * excludednomanifest (glob)
411 a 0 -1 * excludednomanifest (glob)
412 n 644 0 * included (glob)
412 n 644 0 * included (glob)
413 a 0 -1 * includedadded (glob)
413 a 0 -1 * includedadded (glob)
414 $ hg debugrebuilddirstate --minimal
414 $ hg debugrebuilddirstate --minimal
415 $ hg debugdirstate --nodates
415 $ hg debugdirstate --nodates
416 n 644 0 * included (glob)
416 n 644 0 * included (glob)
417 a 0 -1 * includedadded (glob)
417 a 0 -1 * includedadded (glob)
418
418
General Comments 0
You need to be logged in to leave comments. Login now