##// END OF EJS Templates
tests: unify test-locate
Adrian Buehlmann -
r12206:844d25bf default
parent child Browse files
Show More
@@ -1,56 +1,117 b''
1 #!/bin/sh
1 $ mkdir t
2 $ cd t
3 $ hg init
4 $ echo 0 > a
5 $ echo 0 > b
6 $ echo 0 > t.h
7 $ mkdir t
8 $ echo 0 > t/x
9 $ echo 0 > t/b
10 $ echo 0 > t/e.h
11 $ mkdir dir.h
12 $ echo 0 > dir.h/foo
2 13
3 hglocate()
4 {
5 echo "hg locate $@"
6 hg locate "$@"
7 ret=$?
8 echo
9 return $ret
10 }
14 $ hg ci -A -m m
15 adding a
16 adding b
17 adding dir.h/foo
18 adding t.h
19 adding t/b
20 adding t/e.h
21 adding t/x
22
23 $ touch nottracked
24
25 $ hg locate a && echo locate succeeded || echo locate failed
26 a
27 locate succeeded
28
29 $ hg locate NONEXISTENT && echo locate succeeded || echo locate failed
30 locate failed
31
32 $ hg locate
33 a
34 b
35 dir.h/foo
36 t.h
37 t/b
38 t/e.h
39 t/x
40
41 $ hg rm a
42 $ hg ci -m m
11 43
12 mkdir t
13 cd t
14 hg init
15 echo 0 > a
16 echo 0 > b
17 echo 0 > t.h
18 mkdir t
19 echo 0 > t/x
20 echo 0 > t/b
21 echo 0 > t/e.h
22 mkdir dir.h
23 echo 0 > dir.h/foo
24 hg ci -A -m m
25 touch nottracked
26 hglocate a && echo locate succeeded || echo locate failed
27 hglocate NONEXISTENT && echo locate succeeded || echo locate failed
28 hglocate
29 hg rm a
30 hg ci -m m
31 hglocate a
32 hglocate NONEXISTENT
33 hglocate relpath:NONEXISTENT
34 hglocate
35 hglocate -r 0 a
36 hglocate -r 0 NONEXISTENT
37 hglocate -r 0 relpath:NONEXISTENT
38 hglocate -r 0
39 echo % -I/-X with relative path should work
40 cd t
41 hglocate
42 hglocate -I ../t
43 # test issue294
44 cd ..
45 rm -r t
46 hglocate 't/**'
47 mkdir otherdir
48 cd otherdir
49 hglocate b
50 hglocate '*.h'
51 hglocate path:t/x
52 hglocate 're:.*\.h$'
53 hglocate -r 0 b
54 hglocate -r 0 '*.h'
55 hglocate -r 0 path:t/x
56 hglocate -r 0 're:.*\.h$'
44 $ hg locate a
45 $ hg locate NONEXISTENT
46 $ hg locate relpath:NONEXISTENT
47 $ hg locate
48 b
49 dir.h/foo
50 t.h
51 t/b
52 t/e.h
53 t/x
54 $ hg locate -r 0 a
55 a
56 $ hg locate -r 0 NONEXISTENT
57 $ hg locate -r 0 relpath:NONEXISTENT
58 $ hg locate -r 0
59 a
60 b
61 dir.h/foo
62 t.h
63 t/b
64 t/e.h
65 t/x
66
67 -I/-X with relative path should work:
68
69 $ cd t
70 $ hg locate
71 b
72 dir.h/foo
73 t.h
74 t/b
75 t/e.h
76 t/x
77 $ hg locate -I ../t
78 t/b
79 t/e.h
80 t/x
81
82 Test issue294:
83
84 $ cd ..
85 $ rm -r t
86
87 $ hg locate 't/**'
88 t/b
89 t/e.h
90 t/x
91
92 $ mkdir otherdir
93 $ cd otherdir
94
95 $ hg locate b
96 ../b
97 ../t/b
98 $ hg locate '*.h'
99 ../t.h
100 ../t/e.h
101 $ hg locate path:t/x
102 ../t/x
103 $ hg locate 're:.*\.h$'
104 ../t.h
105 ../t/e.h
106 $ hg locate -r 0 b
107 ../b
108 ../t/b
109 $ hg locate -r 0 '*.h'
110 ../t.h
111 ../t/e.h
112 $ hg locate -r 0 path:t/x
113 ../t/x
114 $ hg locate -r 0 're:.*\.h$'
115 ../t.h
116 ../t/e.h
117
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now