##// 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()
14 $ hg ci -A -m m
4 {
15 adding a
5 echo "hg locate $@"
16 adding b
6 hg locate "$@"
17 adding dir.h/foo
7 ret=$?
18 adding t.h
8 echo
19 adding t/b
9 return $ret
20 adding t/e.h
10 }
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
44 $ hg locate a
13 cd t
45 $ hg locate NONEXISTENT
14 hg init
46 $ hg locate relpath:NONEXISTENT
15 echo 0 > a
47 $ hg locate
16 echo 0 > b
48 b
17 echo 0 > t.h
49 dir.h/foo
18 mkdir t
50 t.h
19 echo 0 > t/x
51 t/b
20 echo 0 > t/b
52 t/e.h
21 echo 0 > t/e.h
53 t/x
22 mkdir dir.h
54 $ hg locate -r 0 a
23 echo 0 > dir.h/foo
55 a
24 hg ci -A -m m
56 $ hg locate -r 0 NONEXISTENT
25 touch nottracked
57 $ hg locate -r 0 relpath:NONEXISTENT
26 hglocate a && echo locate succeeded || echo locate failed
58 $ hg locate -r 0
27 hglocate NONEXISTENT && echo locate succeeded || echo locate failed
59 a
28 hglocate
60 b
29 hg rm a
61 dir.h/foo
30 hg ci -m m
62 t.h
31 hglocate a
63 t/b
32 hglocate NONEXISTENT
64 t/e.h
33 hglocate relpath:NONEXISTENT
65 t/x
34 hglocate
66
35 hglocate -r 0 a
67 -I/-X with relative path should work:
36 hglocate -r 0 NONEXISTENT
68
37 hglocate -r 0 relpath:NONEXISTENT
69 $ cd t
38 hglocate -r 0
70 $ hg locate
39 echo % -I/-X with relative path should work
71 b
40 cd t
72 dir.h/foo
41 hglocate
73 t.h
42 hglocate -I ../t
74 t/b
43 # test issue294
75 t/e.h
44 cd ..
76 t/x
45 rm -r t
77 $ hg locate -I ../t
46 hglocate 't/**'
78 t/b
47 mkdir otherdir
79 t/e.h
48 cd otherdir
80 t/x
49 hglocate b
81
50 hglocate '*.h'
82 Test issue294:
51 hglocate path:t/x
83
52 hglocate 're:.*\.h$'
84 $ cd ..
53 hglocate -r 0 b
85 $ rm -r t
54 hglocate -r 0 '*.h'
86
55 hglocate -r 0 path:t/x
87 $ hg locate 't/**'
56 hglocate -r 0 're:.*\.h$'
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
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now