Show More
@@ -1,764 +1,868 b'' | |||
|
1 | 1 | #testcases dirstate-v1 dirstate-v1-tree |
|
2 | 2 | |
|
3 | 3 | #if dirstate-v1-tree |
|
4 | 4 | #require rust |
|
5 | 5 | $ echo '[experimental]' >> $HGRCPATH |
|
6 | 6 | $ echo 'dirstate-tree.in-memory=1' >> $HGRCPATH |
|
7 | 7 | #endif |
|
8 | 8 | |
|
9 | 9 | $ hg init repo1 |
|
10 | 10 | $ cd repo1 |
|
11 | 11 | $ mkdir a b a/1 b/1 b/2 |
|
12 | 12 | $ touch in_root a/in_a b/in_b a/1/in_a_1 b/1/in_b_1 b/2/in_b_2 |
|
13 | 13 | |
|
14 | 14 | hg status in repo root: |
|
15 | 15 | |
|
16 | 16 | $ hg status |
|
17 | 17 | ? a/1/in_a_1 |
|
18 | 18 | ? a/in_a |
|
19 | 19 | ? b/1/in_b_1 |
|
20 | 20 | ? b/2/in_b_2 |
|
21 | 21 | ? b/in_b |
|
22 | 22 | ? in_root |
|
23 | 23 | |
|
24 | 24 | hg status . in repo root: |
|
25 | 25 | |
|
26 | 26 | $ hg status . |
|
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 | |
|
34 | 34 | $ hg status --cwd a |
|
35 | 35 | ? a/1/in_a_1 |
|
36 | 36 | ? a/in_a |
|
37 | 37 | ? b/1/in_b_1 |
|
38 | 38 | ? b/2/in_b_2 |
|
39 | 39 | ? b/in_b |
|
40 | 40 | ? in_root |
|
41 | 41 | $ hg status --cwd a . |
|
42 | 42 | ? 1/in_a_1 |
|
43 | 43 | ? in_a |
|
44 | 44 | $ hg status --cwd a .. |
|
45 | 45 | ? 1/in_a_1 |
|
46 | 46 | ? 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 | |
|
52 | 52 | $ hg status --cwd b |
|
53 | 53 | ? a/1/in_a_1 |
|
54 | 54 | ? a/in_a |
|
55 | 55 | ? b/1/in_b_1 |
|
56 | 56 | ? b/2/in_b_2 |
|
57 | 57 | ? b/in_b |
|
58 | 58 | ? in_root |
|
59 | 59 | $ hg status --cwd b . |
|
60 | 60 | ? 1/in_b_1 |
|
61 | 61 | ? 2/in_b_2 |
|
62 | 62 | ? in_b |
|
63 | 63 | $ hg status --cwd b .. |
|
64 | 64 | ? ../a/1/in_a_1 |
|
65 | 65 | ? ../a/in_a |
|
66 | 66 | ? 1/in_b_1 |
|
67 | 67 | ? 2/in_b_2 |
|
68 | 68 | ? in_b |
|
69 | 69 | ? ../in_root |
|
70 | 70 | |
|
71 | 71 | $ hg status --cwd a/1 |
|
72 | 72 | ? a/1/in_a_1 |
|
73 | 73 | ? a/in_a |
|
74 | 74 | ? b/1/in_b_1 |
|
75 | 75 | ? b/2/in_b_2 |
|
76 | 76 | ? b/in_b |
|
77 | 77 | ? in_root |
|
78 | 78 | $ hg status --cwd a/1 . |
|
79 | 79 | ? in_a_1 |
|
80 | 80 | $ hg status --cwd a/1 .. |
|
81 | 81 | ? in_a_1 |
|
82 | 82 | ? ../in_a |
|
83 | 83 | |
|
84 | 84 | $ hg status --cwd b/1 |
|
85 | 85 | ? a/1/in_a_1 |
|
86 | 86 | ? a/in_a |
|
87 | 87 | ? b/1/in_b_1 |
|
88 | 88 | ? b/2/in_b_2 |
|
89 | 89 | ? b/in_b |
|
90 | 90 | ? in_root |
|
91 | 91 | $ hg status --cwd b/1 . |
|
92 | 92 | ? in_b_1 |
|
93 | 93 | $ hg status --cwd b/1 .. |
|
94 | 94 | ? in_b_1 |
|
95 | 95 | ? ../2/in_b_2 |
|
96 | 96 | ? ../in_b |
|
97 | 97 | |
|
98 | 98 | $ hg status --cwd b/2 |
|
99 | 99 | ? a/1/in_a_1 |
|
100 | 100 | ? a/in_a |
|
101 | 101 | ? b/1/in_b_1 |
|
102 | 102 | ? b/2/in_b_2 |
|
103 | 103 | ? b/in_b |
|
104 | 104 | ? in_root |
|
105 | 105 | $ hg status --cwd b/2 . |
|
106 | 106 | ? in_b_2 |
|
107 | 107 | $ hg status --cwd b/2 .. |
|
108 | 108 | ? ../1/in_b_1 |
|
109 | 109 | ? in_b_2 |
|
110 | 110 | ? ../in_b |
|
111 | 111 | |
|
112 | 112 | combining patterns with root and patterns without a root works |
|
113 | 113 | |
|
114 | 114 | $ hg st a/in_a re:.*b$ |
|
115 | 115 | ? a/in_a |
|
116 | 116 | ? b/in_b |
|
117 | 117 | |
|
118 | 118 | tweaking defaults works |
|
119 | 119 | $ hg status --cwd a --config ui.tweakdefaults=yes |
|
120 | 120 | ? 1/in_a_1 |
|
121 | 121 | ? in_a |
|
122 | 122 | ? ../b/1/in_b_1 |
|
123 | 123 | ? ../b/2/in_b_2 |
|
124 | 124 | ? ../b/in_b |
|
125 | 125 | ? ../in_root |
|
126 | 126 | $ HGPLAIN=1 hg status --cwd a --config ui.tweakdefaults=yes |
|
127 | 127 | ? a/1/in_a_1 (glob) |
|
128 | 128 | ? a/in_a (glob) |
|
129 | 129 | ? b/1/in_b_1 (glob) |
|
130 | 130 | ? b/2/in_b_2 (glob) |
|
131 | 131 | ? b/in_b (glob) |
|
132 | 132 | ? in_root |
|
133 | 133 | $ HGPLAINEXCEPT=tweakdefaults hg status --cwd a --config ui.tweakdefaults=yes |
|
134 | 134 | ? 1/in_a_1 |
|
135 | 135 | ? in_a |
|
136 | 136 | ? ../b/1/in_b_1 |
|
137 | 137 | ? ../b/2/in_b_2 |
|
138 | 138 | ? ../b/in_b |
|
139 | 139 | ? ../in_root (glob) |
|
140 | 140 | |
|
141 | 141 | relative paths can be requested |
|
142 | 142 | |
|
143 | 143 | $ hg status --cwd a --config ui.relative-paths=yes |
|
144 | 144 | ? 1/in_a_1 |
|
145 | 145 | ? in_a |
|
146 | 146 | ? ../b/1/in_b_1 |
|
147 | 147 | ? ../b/2/in_b_2 |
|
148 | 148 | ? ../b/in_b |
|
149 | 149 | ? ../in_root |
|
150 | 150 | |
|
151 | 151 | $ hg status --cwd a . --config ui.relative-paths=legacy |
|
152 | 152 | ? 1/in_a_1 |
|
153 | 153 | ? in_a |
|
154 | 154 | $ hg status --cwd a . --config ui.relative-paths=no |
|
155 | 155 | ? a/1/in_a_1 |
|
156 | 156 | ? a/in_a |
|
157 | 157 | |
|
158 | 158 | commands.status.relative overrides ui.relative-paths |
|
159 | 159 | |
|
160 | 160 | $ cat >> $HGRCPATH <<EOF |
|
161 | 161 | > [ui] |
|
162 | 162 | > relative-paths = False |
|
163 | 163 | > [commands] |
|
164 | 164 | > status.relative = True |
|
165 | 165 | > EOF |
|
166 | 166 | $ hg status --cwd a |
|
167 | 167 | ? 1/in_a_1 |
|
168 | 168 | ? in_a |
|
169 | 169 | ? ../b/1/in_b_1 |
|
170 | 170 | ? ../b/2/in_b_2 |
|
171 | 171 | ? ../b/in_b |
|
172 | 172 | ? ../in_root |
|
173 | 173 | $ HGPLAIN=1 hg status --cwd a |
|
174 | 174 | ? a/1/in_a_1 (glob) |
|
175 | 175 | ? a/in_a (glob) |
|
176 | 176 | ? b/1/in_b_1 (glob) |
|
177 | 177 | ? b/2/in_b_2 (glob) |
|
178 | 178 | ? b/in_b (glob) |
|
179 | 179 | ? in_root |
|
180 | 180 | |
|
181 | 181 | if relative paths are explicitly off, tweakdefaults doesn't change it |
|
182 | 182 | $ cat >> $HGRCPATH <<EOF |
|
183 | 183 | > [commands] |
|
184 | 184 | > status.relative = False |
|
185 | 185 | > EOF |
|
186 | 186 | $ hg status --cwd a --config ui.tweakdefaults=yes |
|
187 | 187 | ? a/1/in_a_1 |
|
188 | 188 | ? a/in_a |
|
189 | 189 | ? b/1/in_b_1 |
|
190 | 190 | ? b/2/in_b_2 |
|
191 | 191 | ? b/in_b |
|
192 | 192 | ? in_root |
|
193 | 193 | |
|
194 | 194 | $ cd .. |
|
195 | 195 | |
|
196 | 196 | $ hg init repo2 |
|
197 | 197 | $ cd repo2 |
|
198 | 198 | $ touch modified removed deleted ignored |
|
199 | 199 | $ echo "^ignored$" > .hgignore |
|
200 | 200 | $ hg ci -A -m 'initial checkin' |
|
201 | 201 | adding .hgignore |
|
202 | 202 | adding deleted |
|
203 | 203 | adding modified |
|
204 | 204 | adding removed |
|
205 | 205 | $ touch modified added unknown ignored |
|
206 | 206 | $ hg add added |
|
207 | 207 | $ hg remove removed |
|
208 | 208 | $ rm deleted |
|
209 | 209 | |
|
210 | 210 | hg status: |
|
211 | 211 | |
|
212 | 212 | $ hg status |
|
213 | 213 | A added |
|
214 | 214 | R removed |
|
215 | 215 | ! deleted |
|
216 | 216 | ? unknown |
|
217 | 217 | |
|
218 | 218 | hg status modified added removed deleted unknown never-existed ignored: |
|
219 | 219 | |
|
220 | 220 | $ hg status modified added removed deleted unknown never-existed ignored |
|
221 | 221 | never-existed: * (glob) |
|
222 | 222 | A added |
|
223 | 223 | R removed |
|
224 | 224 | ! deleted |
|
225 | 225 | ? unknown |
|
226 | 226 | |
|
227 | 227 | $ hg copy modified copied |
|
228 | 228 | |
|
229 | 229 | hg status -C: |
|
230 | 230 | |
|
231 | 231 | $ hg status -C |
|
232 | 232 | A added |
|
233 | 233 | A copied |
|
234 | 234 | modified |
|
235 | 235 | R removed |
|
236 | 236 | ! deleted |
|
237 | 237 | ? unknown |
|
238 | 238 | |
|
239 | 239 | hg status -A: |
|
240 | 240 | |
|
241 | 241 | $ hg status -A |
|
242 | 242 | A added |
|
243 | 243 | A copied |
|
244 | 244 | modified |
|
245 | 245 | R removed |
|
246 | 246 | ! deleted |
|
247 | 247 | ? unknown |
|
248 | 248 | I ignored |
|
249 | 249 | C .hgignore |
|
250 | 250 | C modified |
|
251 | 251 | |
|
252 | 252 | $ hg status -A -T '{status} {path} {node|shortest}\n' |
|
253 | 253 | A added ffff |
|
254 | 254 | A copied ffff |
|
255 | 255 | R removed ffff |
|
256 | 256 | ! deleted ffff |
|
257 | 257 | ? unknown ffff |
|
258 | 258 | I ignored ffff |
|
259 | 259 | C .hgignore ffff |
|
260 | 260 | C modified ffff |
|
261 | 261 | |
|
262 | 262 | $ hg status -A -Tjson |
|
263 | 263 | [ |
|
264 | 264 | { |
|
265 | 265 | "itemtype": "file", |
|
266 | 266 | "path": "added", |
|
267 | 267 | "status": "A" |
|
268 | 268 | }, |
|
269 | 269 | { |
|
270 | 270 | "itemtype": "file", |
|
271 | 271 | "path": "copied", |
|
272 | 272 | "source": "modified", |
|
273 | 273 | "status": "A" |
|
274 | 274 | }, |
|
275 | 275 | { |
|
276 | 276 | "itemtype": "file", |
|
277 | 277 | "path": "removed", |
|
278 | 278 | "status": "R" |
|
279 | 279 | }, |
|
280 | 280 | { |
|
281 | 281 | "itemtype": "file", |
|
282 | 282 | "path": "deleted", |
|
283 | 283 | "status": "!" |
|
284 | 284 | }, |
|
285 | 285 | { |
|
286 | 286 | "itemtype": "file", |
|
287 | 287 | "path": "unknown", |
|
288 | 288 | "status": "?" |
|
289 | 289 | }, |
|
290 | 290 | { |
|
291 | 291 | "itemtype": "file", |
|
292 | 292 | "path": "ignored", |
|
293 | 293 | "status": "I" |
|
294 | 294 | }, |
|
295 | 295 | { |
|
296 | 296 | "itemtype": "file", |
|
297 | 297 | "path": ".hgignore", |
|
298 | 298 | "status": "C" |
|
299 | 299 | }, |
|
300 | 300 | { |
|
301 | 301 | "itemtype": "file", |
|
302 | 302 | "path": "modified", |
|
303 | 303 | "status": "C" |
|
304 | 304 | } |
|
305 | 305 | ] |
|
306 | 306 | |
|
307 | 307 | $ hg status -A -Tpickle > pickle |
|
308 | 308 | >>> from __future__ import print_function |
|
309 | 309 | >>> from mercurial import util |
|
310 | 310 | >>> pickle = util.pickle |
|
311 | 311 | >>> data = sorted((x[b'status'].decode(), x[b'path'].decode()) for x in pickle.load(open("pickle", r"rb"))) |
|
312 | 312 | >>> for s, p in data: print("%s %s" % (s, p)) |
|
313 | 313 | ! deleted |
|
314 | 314 | ? pickle |
|
315 | 315 | ? unknown |
|
316 | 316 | A added |
|
317 | 317 | A copied |
|
318 | 318 | C .hgignore |
|
319 | 319 | C modified |
|
320 | 320 | I ignored |
|
321 | 321 | R removed |
|
322 | 322 | $ rm pickle |
|
323 | 323 | |
|
324 | 324 | $ echo "^ignoreddir$" > .hgignore |
|
325 | 325 | $ mkdir ignoreddir |
|
326 | 326 | $ touch ignoreddir/file |
|
327 | 327 | |
|
328 | 328 | Test templater support: |
|
329 | 329 | |
|
330 | 330 | $ hg status -AT "[{status}]\t{if(source, '{source} -> ')}{path}\n" |
|
331 | 331 | [M] .hgignore |
|
332 | 332 | [A] added |
|
333 | 333 | [A] modified -> copied |
|
334 | 334 | [R] removed |
|
335 | 335 | [!] deleted |
|
336 | 336 | [?] ignored |
|
337 | 337 | [?] unknown |
|
338 | 338 | [I] ignoreddir/file |
|
339 | 339 | [C] modified |
|
340 | 340 | $ hg status -AT default |
|
341 | 341 | M .hgignore |
|
342 | 342 | A added |
|
343 | 343 | A copied |
|
344 | 344 | modified |
|
345 | 345 | R removed |
|
346 | 346 | ! deleted |
|
347 | 347 | ? ignored |
|
348 | 348 | ? unknown |
|
349 | 349 | I ignoreddir/file |
|
350 | 350 | C modified |
|
351 | 351 | $ hg status -T compact |
|
352 | 352 | abort: "status" not in template map |
|
353 | 353 | [255] |
|
354 | 354 | |
|
355 | 355 | hg status ignoreddir/file: |
|
356 | 356 | |
|
357 | 357 | $ hg status ignoreddir/file |
|
358 | 358 | |
|
359 | 359 | hg status -i ignoreddir/file: |
|
360 | 360 | |
|
361 | 361 | $ hg status -i ignoreddir/file |
|
362 | 362 | I ignoreddir/file |
|
363 | 363 | $ cd .. |
|
364 | 364 | |
|
365 | 365 | Check 'status -q' and some combinations |
|
366 | 366 | |
|
367 | 367 | $ hg init repo3 |
|
368 | 368 | $ cd repo3 |
|
369 | 369 | $ touch modified removed deleted ignored |
|
370 | 370 | $ echo "^ignored$" > .hgignore |
|
371 | 371 | $ hg commit -A -m 'initial checkin' |
|
372 | 372 | adding .hgignore |
|
373 | 373 | adding deleted |
|
374 | 374 | adding modified |
|
375 | 375 | adding removed |
|
376 | 376 | $ touch added unknown ignored |
|
377 | 377 | $ hg add added |
|
378 | 378 | $ echo "test" >> modified |
|
379 | 379 | $ hg remove removed |
|
380 | 380 | $ rm deleted |
|
381 | 381 | $ hg copy modified copied |
|
382 | 382 | |
|
383 | 383 | Specify working directory revision explicitly, that should be the same as |
|
384 | 384 | "hg status" |
|
385 | 385 | |
|
386 | 386 | $ hg status --change "wdir()" |
|
387 | 387 | M modified |
|
388 | 388 | A added |
|
389 | 389 | A copied |
|
390 | 390 | R removed |
|
391 | 391 | ! deleted |
|
392 | 392 | ? unknown |
|
393 | 393 | |
|
394 | 394 | Run status with 2 different flags. |
|
395 | 395 | Check if result is the same or different. |
|
396 | 396 | If result is not as expected, raise error |
|
397 | 397 | |
|
398 | 398 | $ assert() { |
|
399 | 399 | > hg status $1 > ../a |
|
400 | 400 | > hg status $2 > ../b |
|
401 | 401 | > if diff ../a ../b > /dev/null; then |
|
402 | 402 | > out=0 |
|
403 | 403 | > else |
|
404 | 404 | > out=1 |
|
405 | 405 | > fi |
|
406 | 406 | > if [ $3 -eq 0 ]; then |
|
407 | 407 | > df="same" |
|
408 | 408 | > else |
|
409 | 409 | > df="different" |
|
410 | 410 | > fi |
|
411 | 411 | > if [ $out -ne $3 ]; then |
|
412 | 412 | > echo "Error on $1 and $2, should be $df." |
|
413 | 413 | > fi |
|
414 | 414 | > } |
|
415 | 415 | |
|
416 | 416 | Assert flag1 flag2 [0-same | 1-different] |
|
417 | 417 | |
|
418 | 418 | $ assert "-q" "-mard" 0 |
|
419 | 419 | $ assert "-A" "-marduicC" 0 |
|
420 | 420 | $ assert "-qA" "-mardcC" 0 |
|
421 | 421 | $ assert "-qAui" "-A" 0 |
|
422 | 422 | $ assert "-qAu" "-marducC" 0 |
|
423 | 423 | $ assert "-qAi" "-mardicC" 0 |
|
424 | 424 | $ assert "-qu" "-u" 0 |
|
425 | 425 | $ assert "-q" "-u" 1 |
|
426 | 426 | $ assert "-m" "-a" 1 |
|
427 | 427 | $ assert "-r" "-d" 1 |
|
428 | 428 | $ cd .. |
|
429 | 429 | |
|
430 | 430 | $ hg init repo4 |
|
431 | 431 | $ cd repo4 |
|
432 | 432 | $ touch modified removed deleted |
|
433 | 433 | $ hg ci -q -A -m 'initial checkin' |
|
434 | 434 | $ touch added unknown |
|
435 | 435 | $ hg add added |
|
436 | 436 | $ hg remove removed |
|
437 | 437 | $ rm deleted |
|
438 | 438 | $ echo x > modified |
|
439 | 439 | $ hg copy modified copied |
|
440 | 440 | $ hg ci -m 'test checkin' -d "1000001 0" |
|
441 | 441 | $ rm * |
|
442 | 442 | $ touch unrelated |
|
443 | 443 | $ hg ci -q -A -m 'unrelated checkin' -d "1000002 0" |
|
444 | 444 | |
|
445 | 445 | hg status --change 1: |
|
446 | 446 | |
|
447 | 447 | $ hg status --change 1 |
|
448 | 448 | M modified |
|
449 | 449 | A added |
|
450 | 450 | A copied |
|
451 | 451 | R removed |
|
452 | 452 | |
|
453 | 453 | hg status --change 1 unrelated: |
|
454 | 454 | |
|
455 | 455 | $ hg status --change 1 unrelated |
|
456 | 456 | |
|
457 | 457 | hg status -C --change 1 added modified copied removed deleted: |
|
458 | 458 | |
|
459 | 459 | $ hg status -C --change 1 added modified copied removed deleted |
|
460 | 460 | M modified |
|
461 | 461 | A added |
|
462 | 462 | A copied |
|
463 | 463 | modified |
|
464 | 464 | R removed |
|
465 | 465 | |
|
466 | 466 | hg status -A --change 1 and revset: |
|
467 | 467 | |
|
468 | 468 | $ hg status -A --change '1|1' |
|
469 | 469 | M modified |
|
470 | 470 | A added |
|
471 | 471 | A copied |
|
472 | 472 | modified |
|
473 | 473 | R removed |
|
474 | 474 | C deleted |
|
475 | 475 | |
|
476 | 476 | $ cd .. |
|
477 | 477 | |
|
478 | 478 | hg status with --rev and reverted changes: |
|
479 | 479 | |
|
480 | 480 | $ hg init reverted-changes-repo |
|
481 | 481 | $ cd reverted-changes-repo |
|
482 | 482 | $ echo a > file |
|
483 | 483 | $ hg add file |
|
484 | 484 | $ hg ci -m a |
|
485 | 485 | $ echo b > file |
|
486 | 486 | $ hg ci -m b |
|
487 | 487 | |
|
488 | 488 | reverted file should appear clean |
|
489 | 489 | |
|
490 | 490 | $ hg revert -r 0 . |
|
491 | 491 | reverting file |
|
492 | 492 | $ hg status -A --rev 0 |
|
493 | 493 | C file |
|
494 | 494 | |
|
495 | 495 | #if execbit |
|
496 | 496 | reverted file with changed flag should appear modified |
|
497 | 497 | |
|
498 | 498 | $ chmod +x file |
|
499 | 499 | $ hg status -A --rev 0 |
|
500 | 500 | M file |
|
501 | 501 | |
|
502 | 502 | $ hg revert -r 0 . |
|
503 | 503 | reverting file |
|
504 | 504 | |
|
505 | 505 | reverted and committed file with changed flag should appear modified |
|
506 | 506 | |
|
507 | 507 | $ hg co -C . |
|
508 | 508 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
509 | 509 | $ chmod +x file |
|
510 | 510 | $ hg ci -m 'change flag' |
|
511 | 511 | $ hg status -A --rev 1 --rev 2 |
|
512 | 512 | M file |
|
513 | 513 | $ hg diff -r 1 -r 2 |
|
514 | 514 | |
|
515 | 515 | #endif |
|
516 | 516 | |
|
517 | 517 | $ cd .. |
|
518 | 518 | |
|
519 | 519 | hg status of binary file starting with '\1\n', a separator for metadata: |
|
520 | 520 | |
|
521 | 521 | $ hg init repo5 |
|
522 | 522 | $ cd repo5 |
|
523 | 523 | >>> open("010a", r"wb").write(b"\1\nfoo") and None |
|
524 | 524 | $ hg ci -q -A -m 'initial checkin' |
|
525 | 525 | $ hg status -A |
|
526 | 526 | C 010a |
|
527 | 527 | |
|
528 | 528 | >>> open("010a", r"wb").write(b"\1\nbar") and None |
|
529 | 529 | $ hg status -A |
|
530 | 530 | M 010a |
|
531 | 531 | $ hg ci -q -m 'modify 010a' |
|
532 | 532 | $ hg status -A --rev 0:1 |
|
533 | 533 | M 010a |
|
534 | 534 | |
|
535 | 535 | $ touch empty |
|
536 | 536 | $ hg ci -q -A -m 'add another file' |
|
537 | 537 | $ hg status -A --rev 1:2 010a |
|
538 | 538 | C 010a |
|
539 | 539 | |
|
540 | 540 | $ cd .. |
|
541 | 541 | |
|
542 | 542 | test "hg status" with "directory pattern" which matches against files |
|
543 | 543 | only known on target revision. |
|
544 | 544 | |
|
545 | 545 | $ hg init repo6 |
|
546 | 546 | $ cd repo6 |
|
547 | 547 | |
|
548 | 548 | $ echo a > a.txt |
|
549 | 549 | $ hg add a.txt |
|
550 | 550 | $ hg commit -m '#0' |
|
551 | 551 | $ mkdir -p 1/2/3/4/5 |
|
552 | 552 | $ echo b > 1/2/3/4/5/b.txt |
|
553 | 553 | $ hg add 1/2/3/4/5/b.txt |
|
554 | 554 | $ hg commit -m '#1' |
|
555 | 555 | |
|
556 | 556 | $ hg update -C 0 > /dev/null |
|
557 | 557 | $ hg status -A |
|
558 | 558 | C a.txt |
|
559 | 559 | |
|
560 | 560 | the directory matching against specified pattern should be removed, |
|
561 | 561 | because directory existence prevents 'dirstate.walk()' from showing |
|
562 | 562 | warning message about such pattern. |
|
563 | 563 | |
|
564 | 564 | $ test ! -d 1 |
|
565 | 565 | $ hg status -A --rev 1 1/2/3/4/5/b.txt |
|
566 | 566 | R 1/2/3/4/5/b.txt |
|
567 | 567 | $ hg status -A --rev 1 1/2/3/4/5 |
|
568 | 568 | R 1/2/3/4/5/b.txt |
|
569 | 569 | $ hg status -A --rev 1 1/2/3 |
|
570 | 570 | R 1/2/3/4/5/b.txt |
|
571 | 571 | $ hg status -A --rev 1 1 |
|
572 | 572 | R 1/2/3/4/5/b.txt |
|
573 | 573 | |
|
574 | 574 | $ hg status --config ui.formatdebug=True --rev 1 1 |
|
575 | 575 | status = [ |
|
576 | 576 | { |
|
577 | 577 | 'itemtype': 'file', |
|
578 | 578 | 'path': '1/2/3/4/5/b.txt', |
|
579 | 579 | 'status': 'R' |
|
580 | 580 | }, |
|
581 | 581 | ] |
|
582 | 582 | |
|
583 | 583 | #if windows |
|
584 | 584 | $ hg --config ui.slash=false status -A --rev 1 1 |
|
585 | 585 | R 1\2\3\4\5\b.txt |
|
586 | 586 | #endif |
|
587 | 587 | |
|
588 | 588 | $ cd .. |
|
589 | 589 | |
|
590 | 590 | Status after move overwriting a file (issue4458) |
|
591 | 591 | ================================================= |
|
592 | 592 | |
|
593 | 593 | |
|
594 | 594 | $ hg init issue4458 |
|
595 | 595 | $ cd issue4458 |
|
596 | 596 | $ echo a > a |
|
597 | 597 | $ echo b > b |
|
598 | 598 | $ hg commit -Am base |
|
599 | 599 | adding a |
|
600 | 600 | adding b |
|
601 | 601 | |
|
602 | 602 | |
|
603 | 603 | with --force |
|
604 | 604 | |
|
605 | 605 | $ hg mv b --force a |
|
606 | 606 | $ hg st --copies |
|
607 | 607 | M a |
|
608 | 608 | b |
|
609 | 609 | R b |
|
610 | 610 | $ hg revert --all |
|
611 | 611 | reverting a |
|
612 | 612 | undeleting b |
|
613 | 613 | $ rm *.orig |
|
614 | 614 | |
|
615 | 615 | without force |
|
616 | 616 | |
|
617 | 617 | $ hg rm a |
|
618 | 618 | $ hg st --copies |
|
619 | 619 | R a |
|
620 | 620 | $ hg mv b a |
|
621 | 621 | $ hg st --copies |
|
622 | 622 | M a |
|
623 | 623 | b |
|
624 | 624 | R b |
|
625 | 625 | |
|
626 | 626 | using ui.statuscopies setting |
|
627 | 627 | $ hg st --config ui.statuscopies=true |
|
628 | 628 | M a |
|
629 | 629 | b |
|
630 | 630 | R b |
|
631 | 631 | $ hg st --config ui.statuscopies=false |
|
632 | 632 | M a |
|
633 | 633 | R b |
|
634 | 634 | $ hg st --config ui.tweakdefaults=yes |
|
635 | 635 | M a |
|
636 | 636 | b |
|
637 | 637 | R b |
|
638 | 638 | |
|
639 | 639 | using log status template (issue5155) |
|
640 | 640 | $ hg log -Tstatus -r 'wdir()' -C |
|
641 | 641 | changeset: 2147483647:ffffffffffff |
|
642 | 642 | parent: 0:8c55c58b4c0e |
|
643 | 643 | user: test |
|
644 | 644 | date: * (glob) |
|
645 | 645 | files: |
|
646 | 646 | M a |
|
647 | 647 | b |
|
648 | 648 | R b |
|
649 | 649 | |
|
650 | 650 | $ hg log -GTstatus -r 'wdir()' -C |
|
651 | 651 | o changeset: 2147483647:ffffffffffff |
|
652 | 652 | | parent: 0:8c55c58b4c0e |
|
653 | 653 | ~ user: test |
|
654 | 654 | date: * (glob) |
|
655 | 655 | files: |
|
656 | 656 | M a |
|
657 | 657 | b |
|
658 | 658 | R b |
|
659 | 659 | |
|
660 | 660 | |
|
661 | 661 | Other "bug" highlight, the revision status does not report the copy information. |
|
662 | 662 | This is buggy behavior. |
|
663 | 663 | |
|
664 | 664 | $ hg commit -m 'blah' |
|
665 | 665 | $ hg st --copies --change . |
|
666 | 666 | M a |
|
667 | 667 | R b |
|
668 | 668 | |
|
669 | 669 | using log status template, the copy information is displayed correctly. |
|
670 | 670 | $ hg log -Tstatus -r. -C |
|
671 | 671 | changeset: 1:6685fde43d21 |
|
672 | 672 | tag: tip |
|
673 | 673 | user: test |
|
674 | 674 | date: * (glob) |
|
675 | 675 | summary: blah |
|
676 | 676 | files: |
|
677 | 677 | M a |
|
678 | 678 | b |
|
679 | 679 | R b |
|
680 | 680 | |
|
681 | 681 | |
|
682 | 682 | $ cd .. |
|
683 | 683 | |
|
684 | 684 | Make sure .hg doesn't show up even as a symlink |
|
685 | 685 | |
|
686 | 686 | $ hg init repo0 |
|
687 | 687 | $ mkdir symlink-repo0 |
|
688 | 688 | $ cd symlink-repo0 |
|
689 | 689 | $ ln -s ../repo0/.hg |
|
690 | 690 | $ hg status |
|
691 | 691 | |
|
692 | 692 | If the size hasn’t changed but mtime has, status needs to read the contents |
|
693 | 693 | of the file to check whether it has changed |
|
694 | 694 | |
|
695 | 695 | $ echo 1 > a |
|
696 | 696 | $ echo 1 > b |
|
697 | 697 | $ touch -t 200102030000 a b |
|
698 | 698 | $ hg commit -Aqm '#0' |
|
699 | 699 | $ echo 2 > a |
|
700 | 700 | $ touch -t 200102040000 a b |
|
701 | 701 | $ hg status |
|
702 | 702 | M a |
|
703 | 703 | |
|
704 | 704 | Asking specifically for the status of a deleted/removed file |
|
705 | 705 | |
|
706 | 706 | $ rm a |
|
707 | 707 | $ rm b |
|
708 | 708 | $ hg status a |
|
709 | 709 | ! a |
|
710 | 710 | $ hg rm a |
|
711 | 711 | $ hg rm b |
|
712 | 712 | $ hg status a |
|
713 | 713 | R a |
|
714 | 714 | |
|
715 | 715 | Check using include flag with pattern when status does not need to traverse |
|
716 | 716 | the working directory (issue6483) |
|
717 | 717 | |
|
718 | 718 | $ cd .. |
|
719 | 719 | $ hg init issue6483 |
|
720 | 720 | $ cd issue6483 |
|
721 | 721 | $ touch a.py b.rs |
|
722 | 722 | $ hg add a.py b.rs |
|
723 | 723 | $ hg st -aI "*.py" |
|
724 | 724 | A a.py |
|
725 | 725 | |
|
726 | 726 | Also check exclude pattern |
|
727 | 727 | |
|
728 | 728 | $ hg st -aX "*.rs" |
|
729 | 729 | A a.py |
|
730 | 730 | |
|
731 | 731 | issue6335 |
|
732 | 732 | When a directory containing a tracked file gets symlinked, as of 5.8 |
|
733 | 733 | `hg st` only gives the correct answer about clean (or deleted) files |
|
734 | 734 | if also listing unknowns. |
|
735 | 735 | The tree-based dirstate and status algorithm fix this: |
|
736 | 736 | |
|
737 | 737 | #if symlink no-dirstate-v1 |
|
738 | 738 | |
|
739 | 739 | $ cd .. |
|
740 | 740 | $ hg init issue6335 |
|
741 | 741 | $ cd issue6335 |
|
742 | 742 | $ mkdir foo |
|
743 | 743 | $ touch foo/a |
|
744 | 744 | $ hg ci -Ama |
|
745 | 745 | adding foo/a |
|
746 | 746 | $ mv foo bar |
|
747 | 747 | $ ln -s bar foo |
|
748 | 748 | $ hg status |
|
749 | 749 | ! foo/a |
|
750 | 750 | ? bar/a |
|
751 | 751 | ? foo |
|
752 | 752 | |
|
753 | 753 | $ hg status -c # incorrect output with `dirstate-v1` |
|
754 | 754 | $ hg status -cu |
|
755 | 755 | ? bar/a |
|
756 | 756 | ? foo |
|
757 | 757 | $ hg status -d # incorrect output with `dirstate-v1` |
|
758 | 758 | ! foo/a |
|
759 | 759 | $ hg status -du |
|
760 | 760 | ! foo/a |
|
761 | 761 | ? bar/a |
|
762 | 762 | ? foo |
|
763 | 763 | |
|
764 | 764 | #endif |
|
765 | ||
|
766 | ||
|
767 | Create a repo with files in each possible status | |
|
768 | ||
|
769 | $ cd .. | |
|
770 | $ hg init repo7 | |
|
771 | $ cd repo7 | |
|
772 | $ mkdir subdir | |
|
773 | $ touch clean modified deleted removed | |
|
774 | $ touch subdir/clean subdir/modified subdir/deleted subdir/removed | |
|
775 | $ echo ignored > .hgignore | |
|
776 | $ hg ci -Aqm '#0' | |
|
777 | $ echo 1 > modified | |
|
778 | $ echo 1 > subdir/modified | |
|
779 | $ rm deleted | |
|
780 | $ rm subdir/deleted | |
|
781 | $ hg rm removed | |
|
782 | $ hg rm subdir/removed | |
|
783 | $ touch unknown ignored | |
|
784 | $ touch subdir/unknown subdir/ignored | |
|
785 | ||
|
786 | Check the output | |
|
787 | ||
|
788 | $ hg status | |
|
789 | M modified | |
|
790 | M subdir/modified | |
|
791 | R removed | |
|
792 | R subdir/removed | |
|
793 | ! deleted | |
|
794 | ! subdir/deleted | |
|
795 | ? subdir/unknown | |
|
796 | ? unknown | |
|
797 | ||
|
798 | $ hg status -mard | |
|
799 | M modified | |
|
800 | M subdir/modified | |
|
801 | R removed | |
|
802 | R subdir/removed | |
|
803 | ! deleted | |
|
804 | ! subdir/deleted | |
|
805 | ||
|
806 | $ hg status -A | |
|
807 | M modified | |
|
808 | M subdir/modified | |
|
809 | R removed | |
|
810 | R subdir/removed | |
|
811 | ! deleted | |
|
812 | ! subdir/deleted | |
|
813 | ? subdir/unknown | |
|
814 | ? unknown | |
|
815 | I ignored | |
|
816 | I subdir/ignored | |
|
817 | C .hgignore | |
|
818 | C clean | |
|
819 | C subdir/clean | |
|
820 | ||
|
821 | Note: `hg status some-name` creates a patternmatcher which is not supported | |
|
822 | yet by the Rust implementation of status, but includematcher is supported. | |
|
823 | --include is used below for that reason | |
|
824 | ||
|
825 | Remove a directory that contains tracked files | |
|
826 | ||
|
827 | $ rm -r subdir | |
|
828 | $ hg status --include subdir | |
|
829 | R subdir/removed | |
|
830 | ! subdir/clean | |
|
831 | ! subdir/deleted | |
|
832 | ! subdir/modified | |
|
833 | ||
|
834 | … and replace it by a file | |
|
835 | ||
|
836 | $ touch subdir | |
|
837 | $ hg status --include subdir | |
|
838 | R subdir/removed | |
|
839 | ! subdir/clean | |
|
840 | ! subdir/deleted | |
|
841 | ! subdir/modified | |
|
842 | ? subdir | |
|
843 | ||
|
844 | Replaced a deleted or removed file with a directory | |
|
845 | ||
|
846 | $ mkdir deleted removed | |
|
847 | $ touch deleted/1 removed/1 | |
|
848 | $ hg status --include deleted --include removed | |
|
849 | R removed | |
|
850 | ! deleted | |
|
851 | ? deleted/1 | |
|
852 | ? removed/1 | |
|
853 | $ hg add removed/1 | |
|
854 | $ hg status --include deleted --include removed | |
|
855 | A removed/1 | |
|
856 | R removed | |
|
857 | ! deleted | |
|
858 | ? deleted/1 | |
|
859 | ||
|
860 | Deeply nested files in an ignored directory are still listed on request | |
|
861 | ||
|
862 | $ echo ignored-dir >> .hgignore | |
|
863 | $ mkdir ignored-dir | |
|
864 | $ mkdir ignored-dir/subdir | |
|
865 | $ touch ignored-dir/subdir/1 | |
|
866 | $ hg status --ignored | |
|
867 | I ignored | |
|
868 | I ignored-dir/subdir/1 |
General Comments 0
You need to be logged in to leave comments.
Login now