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