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