##// END OF EJS Templates
tests: unify test-status
Nicolas Dumazet -
r11782:992506c1 default
parent child Browse files
Show More
@@ -1,117 +1,275 b''
1 #!/bin/sh
1 $ hg init repo1
2 $ cd repo1
3 $ mkdir a b a/1 b/1 b/2
4 $ touch in_root a/in_a b/in_b a/1/in_a_1 b/1/in_b_1 b/2/in_b_2
5
6 hg status in repo root:
7
8 $ hg status
9 ? a/1/in_a_1
10 ? a/in_a
11 ? b/1/in_b_1
12 ? b/2/in_b_2
13 ? b/in_b
14 ? in_root
15
16 hg status . in repo root:
17
18 $ hg status .
19 ? a/1/in_a_1
20 ? a/in_a
21 ? b/1/in_b_1
22 ? b/2/in_b_2
23 ? b/in_b
24 ? in_root
2
25
3 hg init repo1
26 $ hg status --cwd a
4 cd repo1
27 ? a/1/in_a_1
5 mkdir a b a/1 b/1 b/2
28 ? a/in_a
6 touch in_root a/in_a b/in_b a/1/in_a_1 b/1/in_b_1 b/2/in_b_2
29 ? b/1/in_b_1
7 echo "hg status in repo root:"
30 ? b/2/in_b_2
8 hg status
31 ? b/in_b
9 echo "hg status . in repo root:"
32 ? in_root
10 hg status .
33 $ hg status --cwd a .
11 for dir in a b a/1 b/1 b/2; do
34 ? 1/in_a_1
12 echo "hg status in $dir:"
35 ? in_a
13 hg status --cwd "$dir"
36 $ hg status --cwd a ..
14 echo "hg status . in $dir:"
37 ? 1/in_a_1
15 hg status --cwd "$dir" .
38 ? in_a
16 echo "hg status .. in $dir:"
39 ? ../b/1/in_b_1
17 hg status --cwd "$dir" ..
40 ? ../b/2/in_b_2
18 done
41 ? ../b/in_b
19 cd ..
42 ? ../in_root
43
44 $ hg status --cwd b
45 ? a/1/in_a_1
46 ? a/in_a
47 ? b/1/in_b_1
48 ? b/2/in_b_2
49 ? b/in_b
50 ? in_root
51 $ hg status --cwd b .
52 ? 1/in_b_1
53 ? 2/in_b_2
54 ? in_b
55 $ hg status --cwd b ..
56 ? ../a/1/in_a_1
57 ? ../a/in_a
58 ? 1/in_b_1
59 ? 2/in_b_2
60 ? in_b
61 ? ../in_root
62
63 $ hg status --cwd a/1
64 ? a/1/in_a_1
65 ? a/in_a
66 ? b/1/in_b_1
67 ? b/2/in_b_2
68 ? b/in_b
69 ? in_root
70 $ hg status --cwd a/1 .
71 ? in_a_1
72 $ hg status --cwd a/1 ..
73 ? in_a_1
74 ? ../in_a
20
75
21 hg init repo2
76 $ hg status --cwd b/1
22 cd repo2
77 ? a/1/in_a_1
23 touch modified removed deleted ignored
78 ? a/in_a
24 echo "^ignored$" > .hgignore
79 ? b/1/in_b_1
25 hg ci -A -m 'initial checkin' -d "1000000 0"
80 ? b/2/in_b_2
26 touch modified added unknown ignored
81 ? b/in_b
27 hg add added
82 ? in_root
28 hg remove removed
83 $ hg status --cwd b/1 .
29 rm deleted
84 ? in_b_1
30 echo "hg status:"
85 $ hg status --cwd b/1 ..
31 hg status
86 ? in_b_1
32 echo "hg status modified added removed deleted unknown never-existed ignored:"
87 ? ../2/in_b_2
33 hg status modified added removed deleted unknown never-existed ignored
88 ? ../in_b
34 hg copy modified copied
89
35 echo "hg status -C:"
90 $ hg status --cwd b/2
36 hg status -C
91 ? a/1/in_a_1
37 echo "hg status -A:"
92 ? a/in_a
38 hg status -A
93 ? b/1/in_b_1
39 echo "^ignoreddir$" > .hgignore
94 ? b/2/in_b_2
40 mkdir ignoreddir
95 ? b/in_b
41 touch ignoreddir/file
96 ? in_root
42 echo "hg status ignoreddir/file:"
97 $ hg status --cwd b/2 .
43 hg status ignoreddir/file
98 ? in_b_2
44 echo "hg status -i ignoreddir/file:"
99 $ hg status --cwd b/2 ..
45 hg status -i ignoreddir/file
100 ? ../1/in_b_1
46 cd ..
101 ? in_b_2
102 ? ../in_b
103 $ cd ..
104
105 $ hg init repo2
106 $ cd repo2
107 $ touch modified removed deleted ignored
108 $ echo "^ignored$" > .hgignore
109 $ hg ci -A -m 'initial checkin' -d "1000000 0"
110 adding .hgignore
111 adding deleted
112 adding modified
113 adding removed
114 $ touch modified added unknown ignored
115 $ hg add added
116 $ hg remove removed
117 $ rm deleted
118
119 hg status:
120
121 $ hg status
122 A added
123 R removed
124 ! deleted
125 ? unknown
126
127 hg status modified added removed deleted unknown never-existed ignored:
128
129 $ hg status modified added removed deleted unknown never-existed ignored
130 never-existed: No such file or directory
131 A added
132 R removed
133 ! deleted
134 ? unknown
135
136 $ hg copy modified copied
137
138 hg status -C:
139
140 $ hg status -C
141 A added
142 A copied
143 modified
144 R removed
145 ! deleted
146 ? unknown
147
148 hg status -A:
149
150 $ hg status -A
151 A added
152 A copied
153 modified
154 R removed
155 ! deleted
156 ? unknown
157 I ignored
158 C .hgignore
159 C modified
160
161
162 $ echo "^ignoreddir$" > .hgignore
163 $ mkdir ignoreddir
164 $ touch ignoreddir/file
165
166 hg status ignoreddir/file:
167
168 $ hg status ignoreddir/file
169
170 hg status -i ignoreddir/file:
171
172 $ hg status -i ignoreddir/file
173 I ignoreddir/file
174 $ cd ..
47
175
48 # check 'status -q' and some combinations
176 # check 'status -q' and some combinations
49 hg init repo3
177
50 cd repo3
178 $ hg init repo3
51 touch modified removed deleted ignored
179 $ cd repo3
52 echo "^ignored$" > .hgignore
180 $ touch modified removed deleted ignored
53 hg commit -A -m 'initial checkin'
181 $ echo "^ignored$" > .hgignore
54 touch added unknown ignored
182 $ hg commit -A -m 'initial checkin'
55 hg add added
183 adding .hgignore
56 echo "test" >> modified
184 adding deleted
57 hg remove removed
185 adding modified
58 rm deleted
186 adding removed
59 hg copy modified copied
187 $ touch added unknown ignored
188 $ hg add added
189 $ echo "test" >> modified
190 $ hg remove removed
191 $ rm deleted
192 $ hg copy modified copied
60
193
61 # Run status with 2 different flags.
194 # Run status with 2 different flags.
62 # Check if result is the same or different.
195 # Check if result is the same or different.
63 # If result is not as expected, raise error
196 # If result is not as expected, raise error
64 assert() {
197
65 hg status $1 > ../a
198 $ assert() {
66 hg status $2 > ../b
199 > hg status $1 > ../a
67 out=`diff ../a ../b`
200 > hg status $2 > ../b
68 if [ $? -ne 0 ]; then
201 > out=`diff ../a ../b`
69 out=1
202 > if [ $? -ne 0 ]; then
70 else
203 > out=1
71 out=0
204 > else
72 fi
205 > out=0
73 if [ $3 -eq 0 ]; then
206 > fi
74 df="same"
207 > if [ $3 -eq 0 ]; then
75 else
208 > df="same"
76 df="different"
209 > else
77 fi
210 > df="different"
78 if [ $out -ne $3 ]; then
211 > fi
79 echo "Error on $1 and $2, should be $df."
212 > if [ $out -ne $3 ]; then
80 fi
213 > echo "Error on $1 and $2, should be $df."
81 }
214 > fi
215 > }
82
216
83 # assert flag1 flag2 [0-same | 1-different]
217 # assert flag1 flag2 [0-same | 1-different]
84 assert "-q" "-mard" 0
218
85 assert "-A" "-marduicC" 0
219 $ assert "-q" "-mard" 0
86 assert "-qA" "-mardcC" 0
220 $ assert "-A" "-marduicC" 0
87 assert "-qAui" "-A" 0
221 $ assert "-qA" "-mardcC" 0
88 assert "-qAu" "-marducC" 0
222 $ assert "-qAui" "-A" 0
89 assert "-qAi" "-mardicC" 0
223 $ assert "-qAu" "-marducC" 0
90 assert "-qu" "-u" 0
224 $ assert "-qAi" "-mardicC" 0
91 assert "-q" "-u" 1
225 $ assert "-qu" "-u" 0
92 assert "-m" "-a" 1
226 $ assert "-q" "-u" 1
93 assert "-r" "-d" 1
227 $ assert "-m" "-a" 1
94 cd ..
228 $ assert "-r" "-d" 1
229 $ cd ..
230
231 $ hg init repo4
232 $ cd repo4
233 $ touch modified removed deleted
234 $ hg ci -q -A -m 'initial checkin' -d "1000000 0"
235 $ touch added unknown
236 $ hg add added
237 $ hg remove removed
238 $ rm deleted
239 $ echo x > modified
240 $ hg copy modified copied
241 $ hg ci -m 'test checkin' -d "1000001 0"
242 $ rm *
243 $ touch unrelated
244 $ hg ci -q -A -m 'unrelated checkin' -d "1000002 0"
95
245
96 hg init repo4
246 hg status --change 1:
97 cd repo4
247
98 touch modified removed deleted
248 $ hg status --change 1
99 hg ci -q -A -m 'initial checkin' -d "1000000 0"
249 M modified
100 touch added unknown
250 A added
101 hg add added
251 A copied
102 hg remove removed
252 R removed
103 rm deleted
253
104 echo x > modified
254 hg status --change 1 unrelated:
105 hg copy modified copied
255
106 hg ci -m 'test checkin' -d "1000001 0"
256 $ hg status --change 1 unrelated
107 rm *
257
108 touch unrelated
258 hg status -C --change 1 added modified copied removed deleted:
109 hg ci -q -A -m 'unrelated checkin' -d "1000002 0"
259
110 echo "hg status --change 1:"
260 $ hg status -C --change 1 added modified copied removed deleted
111 hg status --change 1
261 M modified
112 echo "hg status --change 1 unrelated:"
262 A added
113 hg status --change 1 unrelated
263 A copied
114 echo "hg status -C --change 1 added modified copied removed deleted:"
264 modified
115 hg status -C --change 1 added modified copied removed deleted
265 R removed
116 echo "hg status -A --change 1"
266
117 hg status -A --change 1
267 hg status -A --change 1:
268
269 $ hg status -A --change 1
270 M modified
271 A added
272 A copied
273 modified
274 R removed
275 C deleted
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