##// END OF EJS Templates
test-status: add test for removed-and-untracked state (BC)...
Yuya Nishihara -
r21942:64fe488b stable
parent child Browse files
Show More
@@ -1,345 +1,352 b''
1 1 $ hg init repo1
2 2 $ cd repo1
3 3 $ mkdir a b a/1 b/1 b/2
4 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 5
6 6 hg status in repo root:
7 7
8 8 $ hg status
9 9 ? a/1/in_a_1
10 10 ? a/in_a
11 11 ? b/1/in_b_1
12 12 ? b/2/in_b_2
13 13 ? b/in_b
14 14 ? in_root
15 15
16 16 hg status . in repo root:
17 17
18 18 $ hg status .
19 19 ? a/1/in_a_1
20 20 ? a/in_a
21 21 ? b/1/in_b_1
22 22 ? b/2/in_b_2
23 23 ? b/in_b
24 24 ? in_root
25 25
26 26 $ hg status --cwd a
27 27 ? a/1/in_a_1
28 28 ? a/in_a
29 29 ? b/1/in_b_1
30 30 ? b/2/in_b_2
31 31 ? b/in_b
32 32 ? in_root
33 33 $ hg status --cwd a .
34 34 ? 1/in_a_1
35 35 ? in_a
36 36 $ hg status --cwd a ..
37 37 ? 1/in_a_1
38 38 ? in_a
39 39 ? ../b/1/in_b_1
40 40 ? ../b/2/in_b_2
41 41 ? ../b/in_b
42 42 ? ../in_root
43 43
44 44 $ hg status --cwd b
45 45 ? a/1/in_a_1
46 46 ? a/in_a
47 47 ? b/1/in_b_1
48 48 ? b/2/in_b_2
49 49 ? b/in_b
50 50 ? in_root
51 51 $ hg status --cwd b .
52 52 ? 1/in_b_1
53 53 ? 2/in_b_2
54 54 ? in_b
55 55 $ hg status --cwd b ..
56 56 ? ../a/1/in_a_1
57 57 ? ../a/in_a
58 58 ? 1/in_b_1
59 59 ? 2/in_b_2
60 60 ? in_b
61 61 ? ../in_root
62 62
63 63 $ hg status --cwd a/1
64 64 ? a/1/in_a_1
65 65 ? a/in_a
66 66 ? b/1/in_b_1
67 67 ? b/2/in_b_2
68 68 ? b/in_b
69 69 ? in_root
70 70 $ hg status --cwd a/1 .
71 71 ? in_a_1
72 72 $ hg status --cwd a/1 ..
73 73 ? in_a_1
74 74 ? ../in_a
75 75
76 76 $ hg status --cwd b/1
77 77 ? a/1/in_a_1
78 78 ? a/in_a
79 79 ? b/1/in_b_1
80 80 ? b/2/in_b_2
81 81 ? b/in_b
82 82 ? in_root
83 83 $ hg status --cwd b/1 .
84 84 ? in_b_1
85 85 $ hg status --cwd b/1 ..
86 86 ? in_b_1
87 87 ? ../2/in_b_2
88 88 ? ../in_b
89 89
90 90 $ hg status --cwd b/2
91 91 ? a/1/in_a_1
92 92 ? a/in_a
93 93 ? b/1/in_b_1
94 94 ? b/2/in_b_2
95 95 ? b/in_b
96 96 ? in_root
97 97 $ hg status --cwd b/2 .
98 98 ? in_b_2
99 99 $ hg status --cwd b/2 ..
100 100 ? ../1/in_b_1
101 101 ? in_b_2
102 102 ? ../in_b
103 103
104 104 combining patterns with root and patterns without a root works
105 105
106 106 $ hg st a/in_a re:.*b$
107 107 ? a/in_a
108 108 ? b/in_b
109 109
110 110 $ cd ..
111 111
112 112 $ hg init repo2
113 113 $ cd repo2
114 114 $ touch modified removed deleted ignored
115 115 $ echo "^ignored$" > .hgignore
116 116 $ hg ci -A -m 'initial checkin'
117 117 adding .hgignore
118 118 adding deleted
119 119 adding modified
120 120 adding removed
121 121 $ touch modified added unknown ignored
122 122 $ hg add added
123 123 $ hg remove removed
124 124 $ rm deleted
125 125
126 126 hg status:
127 127
128 128 $ hg status
129 129 A added
130 130 R removed
131 131 ! deleted
132 132 ? unknown
133 133
134 134 hg status modified added removed deleted unknown never-existed ignored:
135 135
136 136 $ hg status modified added removed deleted unknown never-existed ignored
137 137 never-existed: * (glob)
138 138 A added
139 139 R removed
140 140 ! deleted
141 141 ? unknown
142 142
143 143 $ hg copy modified copied
144 144
145 145 hg status -C:
146 146
147 147 $ hg status -C
148 148 A added
149 149 A copied
150 150 modified
151 151 R removed
152 152 ! deleted
153 153 ? unknown
154 154
155 155 hg status -A:
156 156
157 157 $ hg status -A
158 158 A added
159 159 A copied
160 160 modified
161 161 R removed
162 162 ! deleted
163 163 ? unknown
164 164 I ignored
165 165 C .hgignore
166 166 C modified
167 167
168 168
169 169 $ echo "^ignoreddir$" > .hgignore
170 170 $ mkdir ignoreddir
171 171 $ touch ignoreddir/file
172 172
173 173 hg status ignoreddir/file:
174 174
175 175 $ hg status ignoreddir/file
176 176
177 177 hg status -i ignoreddir/file:
178 178
179 179 $ hg status -i ignoreddir/file
180 180 I ignoreddir/file
181 181 $ cd ..
182 182
183 183 Check 'status -q' and some combinations
184 184
185 185 $ hg init repo3
186 186 $ cd repo3
187 187 $ touch modified removed deleted ignored
188 188 $ echo "^ignored$" > .hgignore
189 189 $ hg commit -A -m 'initial checkin'
190 190 adding .hgignore
191 191 adding deleted
192 192 adding modified
193 193 adding removed
194 194 $ touch added unknown ignored
195 195 $ hg add added
196 196 $ echo "test" >> modified
197 197 $ hg remove removed
198 198 $ rm deleted
199 199 $ hg copy modified copied
200 200
201 201 Run status with 2 different flags.
202 202 Check if result is the same or different.
203 203 If result is not as expected, raise error
204 204
205 205 $ assert() {
206 206 > hg status $1 > ../a
207 207 > hg status $2 > ../b
208 208 > if diff ../a ../b > /dev/null; then
209 209 > out=0
210 210 > else
211 211 > out=1
212 212 > fi
213 213 > if [ $3 -eq 0 ]; then
214 214 > df="same"
215 215 > else
216 216 > df="different"
217 217 > fi
218 218 > if [ $out -ne $3 ]; then
219 219 > echo "Error on $1 and $2, should be $df."
220 220 > fi
221 221 > }
222 222
223 223 Assert flag1 flag2 [0-same | 1-different]
224 224
225 225 $ assert "-q" "-mard" 0
226 226 $ assert "-A" "-marduicC" 0
227 227 $ assert "-qA" "-mardcC" 0
228 228 $ assert "-qAui" "-A" 0
229 229 $ assert "-qAu" "-marducC" 0
230 230 $ assert "-qAi" "-mardicC" 0
231 231 $ assert "-qu" "-u" 0
232 232 $ assert "-q" "-u" 1
233 233 $ assert "-m" "-a" 1
234 234 $ assert "-r" "-d" 1
235 235 $ cd ..
236 236
237 237 $ hg init repo4
238 238 $ cd repo4
239 239 $ touch modified removed deleted
240 240 $ hg ci -q -A -m 'initial checkin'
241 241 $ touch added unknown
242 242 $ hg add added
243 243 $ hg remove removed
244 244 $ rm deleted
245 245 $ echo x > modified
246 246 $ hg copy modified copied
247 247 $ hg ci -m 'test checkin' -d "1000001 0"
248 248 $ rm *
249 249 $ touch unrelated
250 250 $ hg ci -q -A -m 'unrelated checkin' -d "1000002 0"
251 251
252 252 hg status --change 1:
253 253
254 254 $ hg status --change 1
255 255 M modified
256 256 A added
257 257 A copied
258 258 R removed
259 259
260 260 hg status --change 1 unrelated:
261 261
262 262 $ hg status --change 1 unrelated
263 263
264 264 hg status -C --change 1 added modified copied removed deleted:
265 265
266 266 $ hg status -C --change 1 added modified copied removed deleted
267 267 M modified
268 268 A added
269 269 A copied
270 270 modified
271 271 R removed
272 272
273 273 hg status -A --change 1 and revset:
274 274
275 275 $ hg status -A --change '1|1'
276 276 M modified
277 277 A added
278 278 A copied
279 279 modified
280 280 R removed
281 281 C deleted
282 282
283 status of removed but existing in working directory. "? removed" should
284 not be included:
285
286 $ touch removed
287 $ hg status --rev 0 removed
288 R removed
289
283 290 $ cd ..
284 291
285 292 hg status of binary file starting with '\1\n', a separator for metadata:
286 293
287 294 $ hg init repo5
288 295 $ cd repo5
289 296 >>> open("010a", "wb").write("\1\nfoo")
290 297 $ hg ci -q -A -m 'initial checkin'
291 298 $ hg status -A
292 299 C 010a
293 300
294 301 >>> open("010a", "wb").write("\1\nbar")
295 302 $ hg status -A
296 303 M 010a
297 304 $ hg ci -q -m 'modify 010a'
298 305 $ hg status -A --rev 0:1
299 306 M 010a
300 307
301 308 $ touch empty
302 309 $ hg ci -q -A -m 'add another file'
303 310 $ hg status -A --rev 1:2 010a
304 311 C 010a
305 312
306 313 $ cd ..
307 314
308 315 test "hg status" with "directory pattern" which matches against files
309 316 only known on target revision.
310 317
311 318 $ hg init repo6
312 319 $ cd repo6
313 320
314 321 $ echo a > a.txt
315 322 $ hg add a.txt
316 323 $ hg commit -m '#0'
317 324 $ mkdir -p 1/2/3/4/5
318 325 $ echo b > 1/2/3/4/5/b.txt
319 326 $ hg add 1/2/3/4/5/b.txt
320 327 $ hg commit -m '#1'
321 328
322 329 $ hg update -C 0 > /dev/null
323 330 $ hg status -A
324 331 C a.txt
325 332
326 333 the directory matching against specified pattern should be removed,
327 334 because directory existence prevents 'dirstate.walk()' from showing
328 335 warning message about such pattern.
329 336
330 337 $ test ! -d 1
331 338 $ hg status -A --rev 1 1/2/3/4/5/b.txt
332 339 R 1/2/3/4/5/b.txt
333 340 $ hg status -A --rev 1 1/2/3/4/5
334 341 R 1/2/3/4/5/b.txt
335 342 $ hg status -A --rev 1 1/2/3
336 343 R 1/2/3/4/5/b.txt
337 344 $ hg status -A --rev 1 1
338 345 R 1/2/3/4/5/b.txt
339 346
340 347 #if windows
341 348 $ hg --config ui.slash=false status -A --rev 1 1
342 349 R 1\2\3\4\5\b.txt
343 350 #endif
344 351
345 352 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now