annotate tests/test-walk @ 4190:769bc4af561d

util.*matcher: change default "names" argument names=['.'] means "include (recursively) only files from the current subdir"; the function then did a hack to walk the whole tree. Clean that up. This also fixes a problem where "--include ." works in a subdir, but not on the tree root.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sat, 10 Mar 2007 23:00:51 -0300
parents b1716a1f79c4
children 02de0f98ca33
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
889
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
1 #!/bin/sh
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
2
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
3 mkdir t
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
4 cd t
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
5 hg init
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
6 mkdir -p beans
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
7 for b in kidney navy turtle borlotti black pinto; do
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
8 echo $b > beans/$b
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
9 done
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
10 mkdir -p mammals/Procyonidae
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
11 for m in cacomistle coatimundi raccoon; do
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
12 echo $m > mammals/Procyonidae/$m
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
13 done
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
14 echo skunk > mammals/skunk
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
15 echo fennel > fennel
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
16 echo fenugreek > fenugreek
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
17 echo fiddlehead > fiddlehead
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
18 echo glob:glob > glob:glob
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
19 hg addremove
1933
7544700fd931 Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1568
diff changeset
20 hg commit -m "commit #0" -d "1000000 0"
889
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
21 hg debugwalk
4190
769bc4af561d util.*matcher: change default "names" argument
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4189
diff changeset
22 hg debugwalk -I.
889
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
23 cd mammals
1568
1d7d0c07e8f3 make all commands be repo-wide by default
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1413
diff changeset
24 hg debugwalk .
4190
769bc4af561d util.*matcher: change default "names" argument
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4189
diff changeset
25 hg debugwalk -I.
889
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
26 hg debugwalk Procyonidae
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
27 cd Procyonidae
1568
1d7d0c07e8f3 make all commands be repo-wide by default
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1413
diff changeset
28 hg debugwalk .
889
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
29 hg debugwalk ..
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
30 cd ..
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
31 hg debugwalk ../beans
1568
1d7d0c07e8f3 make all commands be repo-wide by default
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1413
diff changeset
32 hg debugwalk .
1976
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
33 hg debugwalk .hg
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
34 hg debugwalk ../.hg
889
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
35 cd ..
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
36 hg debugwalk -Ibeans
1413
1c64c628d15f Do not use 'glob' expansion by default on OS != 'nt'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 896
diff changeset
37 hg debugwalk 'glob:mammals/../beans/b*'
889
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
38 hg debugwalk '-X*/Procyonidae' mammals
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
39 hg debugwalk path:mammals
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
40 hg debugwalk ..
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
41 hg debugwalk beans/../..
1976
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
42 hg debugwalk .hg
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
43 hg debugwalk beans/../.hg
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
44 hg debugwalk beans/../.hg/data
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
45 hg debugwalk beans/.hg
893
36c991554ebb Turn off testing of absolute paths for now.
Bryan O'Sullivan <bos@serpentine.com>
parents: 889
diff changeset
46 # Don't know how to test absolute paths without always getting a false
36c991554ebb Turn off testing of absolute paths for now.
Bryan O'Sullivan <bos@serpentine.com>
parents: 889
diff changeset
47 # error.
36c991554ebb Turn off testing of absolute paths for now.
Bryan O'Sullivan <bos@serpentine.com>
parents: 889
diff changeset
48 #hg debugwalk `pwd`/beans
36c991554ebb Turn off testing of absolute paths for now.
Bryan O'Sullivan <bos@serpentine.com>
parents: 889
diff changeset
49 #hg debugwalk `pwd`/..
889
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
50 hg debugwalk glob:\*
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
51 hg debugwalk 're:.*[kb]$'
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
52 hg debugwalk path:beans/black
4189
b1716a1f79c4 util._matcher: fix handling of path: patterns
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4188
diff changeset
53 hg debugwalk path:beans//black
4188
ce3ecf99a18b util._matcher: fix handling of relglob: patterns
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4187
diff changeset
54 hg debugwalk relglob:Procyonidae
ce3ecf99a18b util._matcher: fix handling of relglob: patterns
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4187
diff changeset
55 hg debugwalk relglob:Procyonidae/ fennel
1413
1c64c628d15f Do not use 'glob' expansion by default on OS != 'nt'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 896
diff changeset
56 hg debugwalk beans 'glob:beans/*'
4187
01c4ea5e788c A 'glob:foo?bar' pattern determines a root - the tree root
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
57 hg debugwalk 'glob:mamm**'
01c4ea5e788c A 'glob:foo?bar' pattern determines a root - the tree root
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
58 hg debugwalk 'glob:mamm**' fennel
1413
1c64c628d15f Do not use 'glob' expansion by default on OS != 'nt'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 896
diff changeset
59 hg debugwalk 'glob:j*'
889
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
60 hg debugwalk NOEXIST
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
61 mkfifo fifo
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
62 hg debugwalk fifo
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
63 rm fenugreek
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
64 hg debugwalk fenugreek
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
65 hg rm fenugreek
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
66 hg debugwalk fenugreek
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
67 touch new
0a06d9d373c3 Add unit tests for walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
68 hg debugwalk new