Mercurial > hg
comparison tests/test-treemanifest.t @ 25362:20ad936ac5d2
treemanifest: visit directory 'foo' when given e.g. '-X foo/ba?'
For globs like 'foo/ba?', match._roots() will return 'foo'. Since
visitdir(), excludes directories in the excluded roots, it would skip
the entire foo directory. This is incorrect, since 'foo/ba?' doesn't
mean that everything in foo/ should be exluded. Note that visitdir()
is called only from the treemanifest class, so this only affects tree
manifests. Fix by adding roots to the set of excluded roots only if
there are no excluded patterns.
Since 'glob' is the default pattern type for globs, we also need to
update some -X patterns in the tests to be of 'path' type to take
advantage of the visitdir tricks. For consistency, also update the -I
patterns.
It seems a little unfortunate that 'foo' in 'hg files -X foo' is
considered a pattern because of the implied 'glob' type, but improving
that is left for another day.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 27 May 2015 10:44:04 -0700 |
parents | 4f07fb1d7fbb |
children | 633d07045494 |
comparison
equal
deleted
inserted
replaced
25361:1635579f9baf | 25362:20ad936ac5d2 |
---|---|
320 b/bar/orange/fly/housefly.txt (glob) | 320 b/bar/orange/fly/housefly.txt (glob) |
321 b/foo/apple/bees/flower.py (glob) | 321 b/foo/apple/bees/flower.py (glob) |
322 c.txt | 322 c.txt |
323 d.py | 323 d.py |
324 | 324 |
325 Excludes with a glob should not exclude everything from the glob's root | |
326 | |
327 $ hg files -r . -X 'b/fo?' b | |
328 b/bar/fruits.txt | |
329 b/bar/orange/fly/gnat.py | |
330 b/bar/orange/fly/housefly.txt | |
331 | |
325 Test files for a subdirectory. | 332 Test files for a subdirectory. |
326 | 333 |
327 $ mv .hg/store/meta/a oldmf | 334 $ mv .hg/store/meta/a oldmf |
328 $ hg files -r . b | 335 $ hg files -r . b |
329 b/bar/fruits.txt (glob) | 336 b/bar/fruits.txt (glob) |
335 Test files with just includes and excludes. | 342 Test files with just includes and excludes. |
336 | 343 |
337 $ mv .hg/store/meta/a oldmf | 344 $ mv .hg/store/meta/a oldmf |
338 $ mv .hg/store/meta/b/bar/orange/fly oldmf2 | 345 $ mv .hg/store/meta/b/bar/orange/fly oldmf2 |
339 $ mv .hg/store/meta/b/foo/apple/bees oldmf3 | 346 $ mv .hg/store/meta/b/foo/apple/bees oldmf3 |
340 $ hg files -r . -I b/bar -X b/bar/orange/fly -I b/foo -X b/foo/apple/bees | 347 $ hg files -r . -I path:b/bar -X path:b/bar/orange/fly -I path:b/foo -X path:b/foo/apple/bees |
341 b/bar/fruits.txt (glob) | 348 b/bar/fruits.txt (glob) |
342 $ mv oldmf .hg/store/meta/a | 349 $ mv oldmf .hg/store/meta/a |
343 $ mv oldmf2 .hg/store/meta/b/bar/orange/fly | 350 $ mv oldmf2 .hg/store/meta/b/bar/orange/fly |
344 $ mv oldmf3 .hg/store/meta/b/foo/apple/bees | 351 $ mv oldmf3 .hg/store/meta/b/foo/apple/bees |
345 | 352 |
346 Test files for a subdirectory, excluding a directory within it. | 353 Test files for a subdirectory, excluding a directory within it. |
347 | 354 |
348 $ mv .hg/store/meta/a oldmf | 355 $ mv .hg/store/meta/a oldmf |
349 $ mv .hg/store/meta/b/foo oldmf2 | 356 $ mv .hg/store/meta/b/foo oldmf2 |
350 $ hg files -r . -X b/foo b | 357 $ hg files -r . -X path:b/foo b |
351 b/bar/fruits.txt (glob) | 358 b/bar/fruits.txt (glob) |
352 b/bar/orange/fly/gnat.py (glob) | 359 b/bar/orange/fly/gnat.py (glob) |
353 b/bar/orange/fly/housefly.txt (glob) | 360 b/bar/orange/fly/housefly.txt (glob) |
354 $ mv oldmf .hg/store/meta/a | 361 $ mv oldmf .hg/store/meta/a |
355 $ mv oldmf2 .hg/store/meta/b/foo | 362 $ mv oldmf2 .hg/store/meta/b/foo |
357 Test files for a sub directory, including only a directory within it, and | 364 Test files for a sub directory, including only a directory within it, and |
358 including an unrelated directory. | 365 including an unrelated directory. |
359 | 366 |
360 $ mv .hg/store/meta/a oldmf | 367 $ mv .hg/store/meta/a oldmf |
361 $ mv .hg/store/meta/b/foo oldmf2 | 368 $ mv .hg/store/meta/b/foo oldmf2 |
362 $ hg files -r . -I b/bar/orange -I a b | 369 $ hg files -r . -I path:b/bar/orange -I path:a b |
363 b/bar/orange/fly/gnat.py (glob) | 370 b/bar/orange/fly/gnat.py (glob) |
364 b/bar/orange/fly/housefly.txt (glob) | 371 b/bar/orange/fly/housefly.txt (glob) |
365 $ mv oldmf .hg/store/meta/a | 372 $ mv oldmf .hg/store/meta/a |
366 $ mv oldmf2 .hg/store/meta/b/foo | 373 $ mv oldmf2 .hg/store/meta/b/foo |
367 | 374 |
369 within that. | 376 within that. |
370 | 377 |
371 $ mv .hg/store/meta/a oldmf | 378 $ mv .hg/store/meta/a oldmf |
372 $ mv .hg/store/meta/b/foo oldmf2 | 379 $ mv .hg/store/meta/b/foo oldmf2 |
373 $ mv .hg/store/meta/b/bar/orange oldmf3 | 380 $ mv .hg/store/meta/b/bar/orange oldmf3 |
374 $ hg files -r . glob:**.txt -I b/bar -X b/bar/orange | 381 $ hg files -r . glob:**.txt -I path:b/bar -X path:b/bar/orange |
375 b/bar/fruits.txt (glob) | 382 b/bar/fruits.txt (glob) |
376 $ mv oldmf .hg/store/meta/a | 383 $ mv oldmf .hg/store/meta/a |
377 $ mv oldmf2 .hg/store/meta/b/foo | 384 $ mv oldmf2 .hg/store/meta/b/foo |
378 $ mv oldmf3 .hg/store/meta/b/bar/orange | 385 $ mv oldmf3 .hg/store/meta/b/bar/orange |
379 | 386 |