##// END OF EJS Templates
add some more tests to hg locate
Alexis S. L. Carvalho -
r4235:eca3277c default
parent child Browse files
Show More
@@ -1,40 +1,52 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 hglocate()
3 hglocate()
4 {
4 {
5 echo "hg locate $@"
5 echo "hg locate $@"
6 hg locate "$@"
6 hg locate "$@"
7 ret=$?
7 ret=$?
8 echo
8 echo
9 return $ret
9 return $ret
10 }
10 }
11
11
12 mkdir t
12 mkdir t
13 cd t
13 cd t
14 hg init
14 hg init
15 echo 0 > a
15 echo 0 > a
16 echo 0 > b
16 echo 0 > b
17 echo 0 > t.h
17 echo 0 > t.h
18 mkdir t
18 mkdir t
19 echo 0 > t/x
19 echo 0 > t/x
20 echo 0 > t/b
21 echo 0 > t/e.h
20 hg ci -A -m m -d "1000000 0"
22 hg ci -A -m m -d "1000000 0"
21 touch nottracked
23 touch nottracked
22 hglocate a && echo locate succeeded || echo locate failed
24 hglocate a && echo locate succeeded || echo locate failed
23 hglocate NONEXISTENT && echo locate succeeded || echo locate failed
25 hglocate NONEXISTENT && echo locate succeeded || echo locate failed
24 hglocate
26 hglocate
25 hg rm a
27 hg rm a
26 hg ci -m m -d "1000000 0"
28 hg ci -m m -d "1000000 0"
27 hglocate a
29 hglocate a
28 hglocate NONEXISTENT
30 hglocate NONEXISTENT
29 hglocate
31 hglocate
30 hglocate -r 0 a
32 hglocate -r 0 a
31 hglocate -r 0 NONEXISTENT
33 hglocate -r 0 NONEXISTENT
32 hglocate -r 0
34 hglocate -r 0
33 echo % -I/-X with relative path should work
35 echo % -I/-X with relative path should work
34 cd t
36 cd t
35 hglocate
37 hglocate
36 hglocate -I ../t
38 hglocate -I ../t
37 # test issue294
39 # test issue294
38 cd ..
40 cd ..
39 rm -r t
41 rm -r t
40 hglocate t
42 hglocate t
43 mkdir otherdir
44 cd otherdir
45 hglocate b
46 hglocate '*.h'
47 hglocate path:t/x
48 hglocate 're:.*\.h'
49 hglocate -r 0 b
50 hglocate -r 0 '*.h'
51 hglocate -r 0 path:t/x
52 hglocate -r 0 're:.*\.h'
@@ -1,49 +1,93 b''
1 adding a
1 adding a
2 adding b
2 adding b
3 adding t.h
3 adding t.h
4 adding t/b
5 adding t/e.h
4 adding t/x
6 adding t/x
5 hg locate a
7 hg locate a
6 a
8 a
7
9
8 locate succeeded
10 locate succeeded
9 hg locate NONEXISTENT
11 hg locate NONEXISTENT
10
12
11 locate failed
13 locate failed
12 hg locate
14 hg locate
13 a
15 a
14 b
16 b
15 t.h
17 t.h
18 t/b
19 t/e.h
16 t/x
20 t/x
17
21
18 hg locate a
22 hg locate a
19
23
20 hg locate NONEXISTENT
24 hg locate NONEXISTENT
21
25
22 hg locate
26 hg locate
23 b
27 b
24 t.h
28 t.h
29 t/b
30 t/e.h
25 t/x
31 t/x
26
32
27 hg locate -r 0 a
33 hg locate -r 0 a
28 a
34 a
29
35
30 hg locate -r 0 NONEXISTENT
36 hg locate -r 0 NONEXISTENT
31
37
32 hg locate -r 0
38 hg locate -r 0
33 a
39 a
34 b
40 b
35 t.h
41 t.h
42 t/b
43 t/e.h
36 t/x
44 t/x
37
45
38 % -I/-X with relative path should work
46 % -I/-X with relative path should work
39 hg locate
47 hg locate
40 b
48 b
41 t.h
49 t.h
50 t/b
51 t/e.h
42 t/x
52 t/x
43
53
44 hg locate -I ../t
54 hg locate -I ../t
55 t/b
56 t/e.h
45 t/x
57 t/x
46
58
47 hg locate t
59 hg locate t
60 t/b
61 t/e.h
48 t/x
62 t/x
49
63
64 hg locate b
65 ../b
66 ../t/b
67
68 hg locate *.h
69 ../t.h
70 ../t/e.h
71
72 hg locate path:t/x
73 ../t/x
74
75 hg locate re:.*\.h
76 ../t.h
77 ../t/e.h
78
79 hg locate -r 0 b
80 ../b
81 ../t/b
82
83 hg locate -r 0 *.h
84 ../t.h
85 ../t/e.h
86
87 hg locate -r 0 path:t/x
88 ../t/x
89
90 hg locate -r 0 re:.*\.h
91 ../t.h
92 ../t/e.h
93
General Comments 0
You need to be logged in to leave comments. Login now