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