##// END OF EJS Templates
tests: add an end-to-end test to show a bug in `visit_children_set`...
Arseniy Alekseyev -
r52458:95c083d2 stable
parent child Browse files
Show More
@@ -1,1039 +1,1053 b''
1 #testcases dirstate-v1 dirstate-v2
1 #testcases dirstate-v1 dirstate-v2
2
2
3 #if dirstate-v2
3 #if dirstate-v2
4 $ cat >> $HGRCPATH << EOF
4 $ cat >> $HGRCPATH << EOF
5 > [format]
5 > [format]
6 > use-dirstate-v2=1
6 > use-dirstate-v2=1
7 > [storage]
7 > [storage]
8 > dirstate-v2.slow-path=allow
8 > dirstate-v2.slow-path=allow
9 > EOF
9 > EOF
10 #endif
10 #endif
11
11
12 $ hg init repo1
12 $ hg init repo1
13 $ cd repo1
13 $ cd repo1
14 $ mkdir a b a/1 b/1 b/2
14 $ mkdir a b a/1 b/1 b/2
15 $ touch in_root a/in_a b/in_b a/1/in_a_1 b/1/in_b_1 b/2/in_b_2
15 $ touch in_root a/in_a b/in_b a/1/in_a_1 b/1/in_b_1 b/2/in_b_2
16
16
17 hg status in repo root:
17 hg status in repo root:
18
18
19 $ hg status
19 $ hg status
20 ? a/1/in_a_1
20 ? a/1/in_a_1
21 ? a/in_a
21 ? a/in_a
22 ? b/1/in_b_1
22 ? b/1/in_b_1
23 ? b/2/in_b_2
23 ? b/2/in_b_2
24 ? b/in_b
24 ? b/in_b
25 ? in_root
25 ? in_root
26
26
27 hg status . in repo root:
27 hg status . in repo root:
28
28
29 $ hg status .
29 $ hg status .
30 ? a/1/in_a_1
30 ? a/1/in_a_1
31 ? a/in_a
31 ? a/in_a
32 ? b/1/in_b_1
32 ? b/1/in_b_1
33 ? b/2/in_b_2
33 ? b/2/in_b_2
34 ? b/in_b
34 ? b/in_b
35 ? in_root
35 ? in_root
36
36
37 $ hg status --cwd a
37 $ hg status --cwd a
38 ? a/1/in_a_1
38 ? a/1/in_a_1
39 ? a/in_a
39 ? a/in_a
40 ? b/1/in_b_1
40 ? b/1/in_b_1
41 ? b/2/in_b_2
41 ? b/2/in_b_2
42 ? b/in_b
42 ? b/in_b
43 ? in_root
43 ? in_root
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 $ hg status --cwd a ..
47 $ hg status --cwd a ..
48 ? 1/in_a_1
48 ? 1/in_a_1
49 ? in_a
49 ? in_a
50 ? ../b/1/in_b_1
50 ? ../b/1/in_b_1
51 ? ../b/2/in_b_2
51 ? ../b/2/in_b_2
52 ? ../b/in_b
52 ? ../b/in_b
53 ? ../in_root
53 ? ../in_root
54
54
55 $ hg status --cwd b
55 $ hg status --cwd b
56 ? a/1/in_a_1
56 ? a/1/in_a_1
57 ? a/in_a
57 ? a/in_a
58 ? b/1/in_b_1
58 ? b/1/in_b_1
59 ? b/2/in_b_2
59 ? b/2/in_b_2
60 ? b/in_b
60 ? b/in_b
61 ? in_root
61 ? in_root
62 $ hg status --cwd b .
62 $ hg status --cwd b .
63 ? 1/in_b_1
63 ? 1/in_b_1
64 ? 2/in_b_2
64 ? 2/in_b_2
65 ? in_b
65 ? in_b
66 $ hg status --cwd b ..
66 $ hg status --cwd b ..
67 ? ../a/1/in_a_1
67 ? ../a/1/in_a_1
68 ? ../a/in_a
68 ? ../a/in_a
69 ? 1/in_b_1
69 ? 1/in_b_1
70 ? 2/in_b_2
70 ? 2/in_b_2
71 ? in_b
71 ? in_b
72 ? ../in_root
72 ? ../in_root
73
73
74 $ hg status --cwd a/1
74 $ hg status --cwd a/1
75 ? a/1/in_a_1
75 ? a/1/in_a_1
76 ? a/in_a
76 ? a/in_a
77 ? b/1/in_b_1
77 ? b/1/in_b_1
78 ? b/2/in_b_2
78 ? b/2/in_b_2
79 ? b/in_b
79 ? b/in_b
80 ? in_root
80 ? in_root
81 $ hg status --cwd a/1 .
81 $ hg status --cwd a/1 .
82 ? in_a_1
82 ? in_a_1
83 $ hg status --cwd a/1 ..
83 $ hg status --cwd a/1 ..
84 ? in_a_1
84 ? in_a_1
85 ? ../in_a
85 ? ../in_a
86
86
87 $ hg status --cwd b/1
87 $ hg status --cwd b/1
88 ? a/1/in_a_1
88 ? a/1/in_a_1
89 ? a/in_a
89 ? a/in_a
90 ? b/1/in_b_1
90 ? b/1/in_b_1
91 ? b/2/in_b_2
91 ? b/2/in_b_2
92 ? b/in_b
92 ? b/in_b
93 ? in_root
93 ? in_root
94 $ hg status --cwd b/1 .
94 $ hg status --cwd b/1 .
95 ? in_b_1
95 ? in_b_1
96 $ hg status --cwd b/1 ..
96 $ hg status --cwd b/1 ..
97 ? in_b_1
97 ? in_b_1
98 ? ../2/in_b_2
98 ? ../2/in_b_2
99 ? ../in_b
99 ? ../in_b
100
100
101 $ hg status --cwd b/2
101 $ hg status --cwd b/2
102 ? a/1/in_a_1
102 ? a/1/in_a_1
103 ? a/in_a
103 ? a/in_a
104 ? b/1/in_b_1
104 ? b/1/in_b_1
105 ? b/2/in_b_2
105 ? b/2/in_b_2
106 ? b/in_b
106 ? b/in_b
107 ? in_root
107 ? in_root
108 $ hg status --cwd b/2 .
108 $ hg status --cwd b/2 .
109 ? in_b_2
109 ? in_b_2
110 $ hg status --cwd b/2 ..
110 $ hg status --cwd b/2 ..
111 ? ../1/in_b_1
111 ? ../1/in_b_1
112 ? in_b_2
112 ? in_b_2
113 ? ../in_b
113 ? ../in_b
114
114
115 combining patterns with root and patterns without a root works
115 combining patterns with root and patterns without a root works
116
116
117 $ hg st a/in_a re:.*b$
117 $ hg st a/in_a re:.*b$
118 ? a/in_a
118 ? a/in_a
119 ? b/in_b
119 ? b/in_b
120
120
121 tweaking defaults works
121 tweaking defaults works
122 $ hg status --cwd a --config ui.tweakdefaults=yes
122 $ hg status --cwd a --config ui.tweakdefaults=yes
123 ? 1/in_a_1
123 ? 1/in_a_1
124 ? in_a
124 ? in_a
125 ? ../b/1/in_b_1
125 ? ../b/1/in_b_1
126 ? ../b/2/in_b_2
126 ? ../b/2/in_b_2
127 ? ../b/in_b
127 ? ../b/in_b
128 ? ../in_root
128 ? ../in_root
129 $ HGPLAIN=1 hg status --cwd a --config ui.tweakdefaults=yes
129 $ HGPLAIN=1 hg status --cwd a --config ui.tweakdefaults=yes
130 ? a/1/in_a_1 (glob)
130 ? a/1/in_a_1 (glob)
131 ? a/in_a (glob)
131 ? a/in_a (glob)
132 ? b/1/in_b_1 (glob)
132 ? b/1/in_b_1 (glob)
133 ? b/2/in_b_2 (glob)
133 ? b/2/in_b_2 (glob)
134 ? b/in_b (glob)
134 ? b/in_b (glob)
135 ? in_root
135 ? in_root
136 $ HGPLAINEXCEPT=tweakdefaults hg status --cwd a --config ui.tweakdefaults=yes
136 $ HGPLAINEXCEPT=tweakdefaults hg status --cwd a --config ui.tweakdefaults=yes
137 ? 1/in_a_1
137 ? 1/in_a_1
138 ? in_a
138 ? in_a
139 ? ../b/1/in_b_1
139 ? ../b/1/in_b_1
140 ? ../b/2/in_b_2
140 ? ../b/2/in_b_2
141 ? ../b/in_b
141 ? ../b/in_b
142 ? ../in_root (glob)
142 ? ../in_root (glob)
143
143
144 relative paths can be requested
144 relative paths can be requested
145
145
146 $ hg status --cwd a --config ui.relative-paths=yes
146 $ hg status --cwd a --config ui.relative-paths=yes
147 ? 1/in_a_1
147 ? 1/in_a_1
148 ? in_a
148 ? in_a
149 ? ../b/1/in_b_1
149 ? ../b/1/in_b_1
150 ? ../b/2/in_b_2
150 ? ../b/2/in_b_2
151 ? ../b/in_b
151 ? ../b/in_b
152 ? ../in_root
152 ? ../in_root
153
153
154 $ hg status --cwd a . --config ui.relative-paths=legacy
154 $ hg status --cwd a . --config ui.relative-paths=legacy
155 ? 1/in_a_1
155 ? 1/in_a_1
156 ? in_a
156 ? in_a
157 $ hg status --cwd a . --config ui.relative-paths=no
157 $ hg status --cwd a . --config ui.relative-paths=no
158 ? a/1/in_a_1
158 ? a/1/in_a_1
159 ? a/in_a
159 ? a/in_a
160
160
161 commands.status.relative overrides ui.relative-paths
161 commands.status.relative overrides ui.relative-paths
162
162
163 $ cat >> $HGRCPATH <<EOF
163 $ cat >> $HGRCPATH <<EOF
164 > [ui]
164 > [ui]
165 > relative-paths = False
165 > relative-paths = False
166 > [commands]
166 > [commands]
167 > status.relative = True
167 > status.relative = True
168 > EOF
168 > EOF
169 $ hg status --cwd a
169 $ hg status --cwd a
170 ? 1/in_a_1
170 ? 1/in_a_1
171 ? in_a
171 ? in_a
172 ? ../b/1/in_b_1
172 ? ../b/1/in_b_1
173 ? ../b/2/in_b_2
173 ? ../b/2/in_b_2
174 ? ../b/in_b
174 ? ../b/in_b
175 ? ../in_root
175 ? ../in_root
176 $ HGPLAIN=1 hg status --cwd a
176 $ HGPLAIN=1 hg status --cwd a
177 ? a/1/in_a_1 (glob)
177 ? a/1/in_a_1 (glob)
178 ? a/in_a (glob)
178 ? a/in_a (glob)
179 ? b/1/in_b_1 (glob)
179 ? b/1/in_b_1 (glob)
180 ? b/2/in_b_2 (glob)
180 ? b/2/in_b_2 (glob)
181 ? b/in_b (glob)
181 ? b/in_b (glob)
182 ? in_root
182 ? in_root
183
183
184 if relative paths are explicitly off, tweakdefaults doesn't change it
184 if relative paths are explicitly off, tweakdefaults doesn't change it
185 $ cat >> $HGRCPATH <<EOF
185 $ cat >> $HGRCPATH <<EOF
186 > [commands]
186 > [commands]
187 > status.relative = False
187 > status.relative = False
188 > EOF
188 > EOF
189 $ hg status --cwd a --config ui.tweakdefaults=yes
189 $ hg status --cwd a --config ui.tweakdefaults=yes
190 ? a/1/in_a_1
190 ? a/1/in_a_1
191 ? a/in_a
191 ? a/in_a
192 ? b/1/in_b_1
192 ? b/1/in_b_1
193 ? b/2/in_b_2
193 ? b/2/in_b_2
194 ? b/in_b
194 ? b/in_b
195 ? in_root
195 ? in_root
196
196
197 $ cd ..
197 $ cd ..
198
198
199 $ hg init repo2
199 $ hg init repo2
200 $ cd repo2
200 $ cd repo2
201 $ touch modified removed deleted ignored
201 $ touch modified removed deleted ignored
202 $ echo "^ignored$" > .hgignore
202 $ echo "^ignored$" > .hgignore
203 $ hg ci -A -m 'initial checkin'
203 $ hg ci -A -m 'initial checkin'
204 adding .hgignore
204 adding .hgignore
205 adding deleted
205 adding deleted
206 adding modified
206 adding modified
207 adding removed
207 adding removed
208 $ touch modified added unknown ignored
208 $ touch modified added unknown ignored
209 $ hg add added
209 $ hg add added
210 $ hg remove removed
210 $ hg remove removed
211 $ rm deleted
211 $ rm deleted
212
212
213 hg status:
213 hg status:
214
214
215 $ hg status
215 $ hg status
216 A added
216 A added
217 R removed
217 R removed
218 ! deleted
218 ! deleted
219 ? unknown
219 ? unknown
220
220
221 hg status -n:
221 hg status -n:
222 $ env RHG_ON_UNSUPPORTED=abort hg status -n
222 $ env RHG_ON_UNSUPPORTED=abort hg status -n
223 added
223 added
224 removed
224 removed
225 deleted
225 deleted
226 unknown
226 unknown
227
227
228 hg status modified added removed deleted unknown never-existed ignored:
228 hg status modified added removed deleted unknown never-existed ignored:
229
229
230 $ hg status modified added removed deleted unknown never-existed ignored
230 $ hg status modified added removed deleted unknown never-existed ignored
231 never-existed: * (glob)
231 never-existed: * (glob)
232 A added
232 A added
233 R removed
233 R removed
234 ! deleted
234 ! deleted
235 ? unknown
235 ? unknown
236
236
237 $ hg copy modified copied
237 $ hg copy modified copied
238
238
239 hg status -C:
239 hg status -C:
240
240
241 $ hg status -C
241 $ hg status -C
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
248
249 hg status -0:
249 hg status -0:
250
250
251 $ hg status -0 --config rhg.on-unsupported=abort
251 $ hg status -0 --config rhg.on-unsupported=abort
252 A added\x00A copied\x00R removed\x00! deleted\x00? unknown\x00 (no-eol) (esc)
252 A added\x00A copied\x00R removed\x00! deleted\x00? unknown\x00 (no-eol) (esc)
253
253
254 hg status -A:
254 hg status -A:
255
255
256 $ hg status -A
256 $ hg status -A
257 A added
257 A added
258 A copied
258 A copied
259 modified
259 modified
260 R removed
260 R removed
261 ! deleted
261 ! deleted
262 ? unknown
262 ? unknown
263 I ignored
263 I ignored
264 C .hgignore
264 C .hgignore
265 C modified
265 C modified
266
266
267 $ hg status -A -T '{status} {path} {node|shortest}\n'
267 $ hg status -A -T '{status} {path} {node|shortest}\n'
268 A added ffff
268 A added ffff
269 A copied ffff
269 A copied ffff
270 R removed ffff
270 R removed ffff
271 ! deleted ffff
271 ! deleted ffff
272 ? unknown ffff
272 ? unknown ffff
273 I ignored ffff
273 I ignored ffff
274 C .hgignore ffff
274 C .hgignore ffff
275 C modified ffff
275 C modified ffff
276
276
277 $ hg status -A -Tjson
277 $ hg status -A -Tjson
278 [
278 [
279 {
279 {
280 "itemtype": "file",
280 "itemtype": "file",
281 "path": "added",
281 "path": "added",
282 "status": "A"
282 "status": "A"
283 },
283 },
284 {
284 {
285 "itemtype": "file",
285 "itemtype": "file",
286 "path": "copied",
286 "path": "copied",
287 "source": "modified",
287 "source": "modified",
288 "status": "A"
288 "status": "A"
289 },
289 },
290 {
290 {
291 "itemtype": "file",
291 "itemtype": "file",
292 "path": "removed",
292 "path": "removed",
293 "status": "R"
293 "status": "R"
294 },
294 },
295 {
295 {
296 "itemtype": "file",
296 "itemtype": "file",
297 "path": "deleted",
297 "path": "deleted",
298 "status": "!"
298 "status": "!"
299 },
299 },
300 {
300 {
301 "itemtype": "file",
301 "itemtype": "file",
302 "path": "unknown",
302 "path": "unknown",
303 "status": "?"
303 "status": "?"
304 },
304 },
305 {
305 {
306 "itemtype": "file",
306 "itemtype": "file",
307 "path": "ignored",
307 "path": "ignored",
308 "status": "I"
308 "status": "I"
309 },
309 },
310 {
310 {
311 "itemtype": "file",
311 "itemtype": "file",
312 "path": ".hgignore",
312 "path": ".hgignore",
313 "status": "C"
313 "status": "C"
314 },
314 },
315 {
315 {
316 "itemtype": "file",
316 "itemtype": "file",
317 "path": "modified",
317 "path": "modified",
318 "status": "C"
318 "status": "C"
319 }
319 }
320 ]
320 ]
321
321
322 $ hg status -A -Tpickle > pickle
322 $ hg status -A -Tpickle > pickle
323 >>> import pickle
323 >>> import pickle
324 >>> from mercurial import util
324 >>> from mercurial import util
325 >>> data = sorted((x[b'status'].decode(), x[b'path'].decode()) for x in pickle.load(open("pickle", r"rb")))
325 >>> data = sorted((x[b'status'].decode(), x[b'path'].decode()) for x in pickle.load(open("pickle", r"rb")))
326 >>> for s, p in data: print("%s %s" % (s, p))
326 >>> for s, p in data: print("%s %s" % (s, p))
327 ! deleted
327 ! deleted
328 ? pickle
328 ? pickle
329 ? unknown
329 ? unknown
330 A added
330 A added
331 A copied
331 A copied
332 C .hgignore
332 C .hgignore
333 C modified
333 C modified
334 I ignored
334 I ignored
335 R removed
335 R removed
336 $ rm pickle
336 $ rm pickle
337
337
338 $ echo "^ignoreddir$" > .hgignore
338 $ echo "^ignoreddir$" > .hgignore
339 $ mkdir ignoreddir
339 $ mkdir ignoreddir
340 $ touch ignoreddir/file
340 $ touch ignoreddir/file
341
341
342 Test templater support:
342 Test templater support:
343
343
344 $ hg status -AT "[{status}]\t{if(source, '{source} -> ')}{path}\n"
344 $ hg status -AT "[{status}]\t{if(source, '{source} -> ')}{path}\n"
345 [M] .hgignore
345 [M] .hgignore
346 [A] added
346 [A] added
347 [A] modified -> copied
347 [A] modified -> copied
348 [R] removed
348 [R] removed
349 [!] deleted
349 [!] deleted
350 [?] ignored
350 [?] ignored
351 [?] unknown
351 [?] unknown
352 [I] ignoreddir/file
352 [I] ignoreddir/file
353 [C] modified
353 [C] modified
354 $ hg status -AT default
354 $ hg status -AT default
355 M .hgignore
355 M .hgignore
356 A added
356 A added
357 A copied
357 A copied
358 modified
358 modified
359 R removed
359 R removed
360 ! deleted
360 ! deleted
361 ? ignored
361 ? ignored
362 ? unknown
362 ? unknown
363 I ignoreddir/file
363 I ignoreddir/file
364 C modified
364 C modified
365 $ hg status -T compact
365 $ hg status -T compact
366 abort: "status" not in template map
366 abort: "status" not in template map
367 [255]
367 [255]
368
368
369 hg status ignoreddir/file:
369 hg status ignoreddir/file:
370
370
371 $ hg status ignoreddir/file
371 $ hg status ignoreddir/file
372
372
373 hg status -i ignoreddir/file:
373 hg status -i ignoreddir/file:
374
374
375 $ hg status -i ignoreddir/file
375 $ hg status -i ignoreddir/file
376 I ignoreddir/file
376 I ignoreddir/file
377 $ cd ..
377 $ cd ..
378
378
379 Check 'status -q' and some combinations
379 Check 'status -q' and some combinations
380
380
381 $ hg init repo3
381 $ hg init repo3
382 $ cd repo3
382 $ cd repo3
383 $ touch modified removed deleted ignored
383 $ touch modified removed deleted ignored
384 $ echo "^ignored$" > .hgignore
384 $ echo "^ignored$" > .hgignore
385 $ hg commit -A -m 'initial checkin'
385 $ hg commit -A -m 'initial checkin'
386 adding .hgignore
386 adding .hgignore
387 adding deleted
387 adding deleted
388 adding modified
388 adding modified
389 adding removed
389 adding removed
390 $ touch added unknown ignored
390 $ touch added unknown ignored
391 $ hg add added
391 $ hg add added
392 $ echo "test" >> modified
392 $ echo "test" >> modified
393 $ hg remove removed
393 $ hg remove removed
394 $ rm deleted
394 $ rm deleted
395 $ hg copy modified copied
395 $ hg copy modified copied
396
396
397 Specify working directory revision explicitly, that should be the same as
397 Specify working directory revision explicitly, that should be the same as
398 "hg status"
398 "hg status"
399
399
400 $ hg status --change "wdir()"
400 $ hg status --change "wdir()"
401 M modified
401 M modified
402 A added
402 A added
403 A copied
403 A copied
404 R removed
404 R removed
405 ! deleted
405 ! deleted
406 ? unknown
406 ? unknown
407
407
408 Run status with 2 different flags.
408 Run status with 2 different flags.
409 Check if result is the same or different.
409 Check if result is the same or different.
410 If result is not as expected, raise error
410 If result is not as expected, raise error
411
411
412 $ assert() {
412 $ assert() {
413 > hg status $1 > ../a
413 > hg status $1 > ../a
414 > hg status $2 > ../b
414 > hg status $2 > ../b
415 > if diff ../a ../b > /dev/null; then
415 > if diff ../a ../b > /dev/null; then
416 > out=0
416 > out=0
417 > else
417 > else
418 > out=1
418 > out=1
419 > fi
419 > fi
420 > if [ $3 -eq 0 ]; then
420 > if [ $3 -eq 0 ]; then
421 > df="same"
421 > df="same"
422 > else
422 > else
423 > df="different"
423 > df="different"
424 > fi
424 > fi
425 > if [ $out -ne $3 ]; then
425 > if [ $out -ne $3 ]; then
426 > echo "Error on $1 and $2, should be $df."
426 > echo "Error on $1 and $2, should be $df."
427 > fi
427 > fi
428 > }
428 > }
429
429
430 Assert flag1 flag2 [0-same | 1-different]
430 Assert flag1 flag2 [0-same | 1-different]
431
431
432 $ assert "-q" "-mard" 0
432 $ assert "-q" "-mard" 0
433 $ assert "-A" "-marduicC" 0
433 $ assert "-A" "-marduicC" 0
434 $ assert "-qA" "-mardcC" 0
434 $ assert "-qA" "-mardcC" 0
435 $ assert "-qAui" "-A" 0
435 $ assert "-qAui" "-A" 0
436 $ assert "-qAu" "-marducC" 0
436 $ assert "-qAu" "-marducC" 0
437 $ assert "-qAi" "-mardicC" 0
437 $ assert "-qAi" "-mardicC" 0
438 $ assert "-qu" "-u" 0
438 $ assert "-qu" "-u" 0
439 $ assert "-q" "-u" 1
439 $ assert "-q" "-u" 1
440 $ assert "-m" "-a" 1
440 $ assert "-m" "-a" 1
441 $ assert "-r" "-d" 1
441 $ assert "-r" "-d" 1
442 $ cd ..
442 $ cd ..
443
443
444 $ hg init repo4
444 $ hg init repo4
445 $ cd repo4
445 $ cd repo4
446 $ touch modified removed deleted
446 $ touch modified removed deleted
447 $ hg ci -q -A -m 'initial checkin'
447 $ hg ci -q -A -m 'initial checkin'
448 $ touch added unknown
448 $ touch added unknown
449 $ hg add added
449 $ hg add added
450 $ hg remove removed
450 $ hg remove removed
451 $ rm deleted
451 $ rm deleted
452 $ echo x > modified
452 $ echo x > modified
453 $ hg copy modified copied
453 $ hg copy modified copied
454 $ hg ci -m 'test checkin' -d "1000001 0"
454 $ hg ci -m 'test checkin' -d "1000001 0"
455 $ rm *
455 $ rm *
456 $ touch unrelated
456 $ touch unrelated
457 $ hg ci -q -A -m 'unrelated checkin' -d "1000002 0"
457 $ hg ci -q -A -m 'unrelated checkin' -d "1000002 0"
458
458
459 hg status --change 1:
459 hg status --change 1:
460
460
461 $ hg status --change 1
461 $ hg status --change 1
462 M modified
462 M modified
463 A added
463 A added
464 A copied
464 A copied
465 R removed
465 R removed
466
466
467 hg status --change 1 unrelated:
467 hg status --change 1 unrelated:
468
468
469 $ hg status --change 1 unrelated
469 $ hg status --change 1 unrelated
470
470
471 hg status -C --change 1 added modified copied removed deleted:
471 hg status -C --change 1 added modified copied removed deleted:
472
472
473 $ hg status -C --change 1 added modified copied removed deleted
473 $ hg status -C --change 1 added modified copied removed deleted
474 M modified
474 M modified
475 A added
475 A added
476 A copied
476 A copied
477 modified
477 modified
478 R removed
478 R removed
479
479
480 hg status -A --change 1 and revset:
480 hg status -A --change 1 and revset:
481
481
482 $ hg status -A --change '1|1'
482 $ hg status -A --change '1|1'
483 M modified
483 M modified
484 A added
484 A added
485 A copied
485 A copied
486 modified
486 modified
487 R removed
487 R removed
488 C deleted
488 C deleted
489
489
490 $ cd ..
490 $ cd ..
491
491
492 hg status with --rev and reverted changes:
492 hg status with --rev and reverted changes:
493
493
494 $ hg init reverted-changes-repo
494 $ hg init reverted-changes-repo
495 $ cd reverted-changes-repo
495 $ cd reverted-changes-repo
496 $ echo a > file
496 $ echo a > file
497 $ hg add file
497 $ hg add file
498 $ hg ci -m a
498 $ hg ci -m a
499 $ echo b > file
499 $ echo b > file
500 $ hg ci -m b
500 $ hg ci -m b
501
501
502 reverted file should appear clean
502 reverted file should appear clean
503
503
504 $ hg revert -r 0 .
504 $ hg revert -r 0 .
505 reverting file
505 reverting file
506 $ hg status -A --rev 0
506 $ hg status -A --rev 0
507 C file
507 C file
508
508
509 #if execbit
509 #if execbit
510 reverted file with changed flag should appear modified
510 reverted file with changed flag should appear modified
511
511
512 $ chmod +x file
512 $ chmod +x file
513 $ hg status -A --rev 0
513 $ hg status -A --rev 0
514 M file
514 M file
515
515
516 $ hg revert -r 0 .
516 $ hg revert -r 0 .
517 reverting file
517 reverting file
518
518
519 reverted and committed file with changed flag should appear modified
519 reverted and committed file with changed flag should appear modified
520
520
521 $ hg co -C .
521 $ hg co -C .
522 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
522 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
523 $ chmod +x file
523 $ chmod +x file
524 $ hg ci -m 'change flag'
524 $ hg ci -m 'change flag'
525 $ hg status -A --rev 1 --rev 2
525 $ hg status -A --rev 1 --rev 2
526 M file
526 M file
527 $ hg diff -r 1 -r 2
527 $ hg diff -r 1 -r 2
528
528
529 #endif
529 #endif
530
530
531 $ cd ..
531 $ cd ..
532
532
533 hg status of binary file starting with '\1\n', a separator for metadata:
533 hg status of binary file starting with '\1\n', a separator for metadata:
534
534
535 $ hg init repo5
535 $ hg init repo5
536 $ cd repo5
536 $ cd repo5
537 >>> open("010a", r"wb").write(b"\1\nfoo") and None
537 >>> open("010a", r"wb").write(b"\1\nfoo") and None
538 $ hg ci -q -A -m 'initial checkin'
538 $ hg ci -q -A -m 'initial checkin'
539 $ hg status -A
539 $ hg status -A
540 C 010a
540 C 010a
541
541
542 >>> open("010a", r"wb").write(b"\1\nbar") and None
542 >>> open("010a", r"wb").write(b"\1\nbar") and None
543 $ hg status -A
543 $ hg status -A
544 M 010a
544 M 010a
545 $ hg ci -q -m 'modify 010a'
545 $ hg ci -q -m 'modify 010a'
546 $ hg status -A --rev 0:1
546 $ hg status -A --rev 0:1
547 M 010a
547 M 010a
548
548
549 $ touch empty
549 $ touch empty
550 $ hg ci -q -A -m 'add another file'
550 $ hg ci -q -A -m 'add another file'
551 $ hg status -A --rev 1:2 010a
551 $ hg status -A --rev 1:2 010a
552 C 010a
552 C 010a
553
553
554 $ cd ..
554 $ cd ..
555
555
556 test "hg status" with "directory pattern" which matches against files
556 test "hg status" with "directory pattern" which matches against files
557 only known on target revision.
557 only known on target revision.
558
558
559 $ hg init repo6
559 $ hg init repo6
560 $ cd repo6
560 $ cd repo6
561
561
562 $ echo a > a.txt
562 $ echo a > a.txt
563 $ hg add a.txt
563 $ hg add a.txt
564 $ hg commit -m '#0'
564 $ hg commit -m '#0'
565 $ mkdir -p 1/2/3/4/5
565 $ mkdir -p 1/2/3/4/5
566 $ echo b > 1/2/3/4/5/b.txt
566 $ echo b > 1/2/3/4/5/b.txt
567 $ hg add 1/2/3/4/5/b.txt
567 $ hg add 1/2/3/4/5/b.txt
568 $ hg commit -m '#1'
568 $ hg commit -m '#1'
569
569
570 $ hg update -C 0 > /dev/null
570 $ hg update -C 0 > /dev/null
571 $ hg status -A
571 $ hg status -A
572 C a.txt
572 C a.txt
573
573
574 the directory matching against specified pattern should be removed,
574 the directory matching against specified pattern should be removed,
575 because directory existence prevents 'dirstate.walk()' from showing
575 because directory existence prevents 'dirstate.walk()' from showing
576 warning message about such pattern.
576 warning message about such pattern.
577
577
578 $ test ! -d 1
578 $ test ! -d 1
579 $ hg status -A --rev 1 1/2/3/4/5/b.txt
579 $ hg status -A --rev 1 1/2/3/4/5/b.txt
580 R 1/2/3/4/5/b.txt
580 R 1/2/3/4/5/b.txt
581 $ hg status -A --rev 1 1/2/3/4/5
581 $ hg status -A --rev 1 1/2/3/4/5
582 R 1/2/3/4/5/b.txt
582 R 1/2/3/4/5/b.txt
583 $ hg status -A --rev 1 1/2/3
583 $ hg status -A --rev 1 1/2/3
584 R 1/2/3/4/5/b.txt
584 R 1/2/3/4/5/b.txt
585 $ hg status -A --rev 1 1
585 $ hg status -A --rev 1 1
586 R 1/2/3/4/5/b.txt
586 R 1/2/3/4/5/b.txt
587
587
588 $ hg status --config ui.formatdebug=True --rev 1 1
588 $ hg status --config ui.formatdebug=True --rev 1 1
589 status = [
589 status = [
590 {
590 {
591 'itemtype': 'file',
591 'itemtype': 'file',
592 'path': '1/2/3/4/5/b.txt',
592 'path': '1/2/3/4/5/b.txt',
593 'status': 'R'
593 'status': 'R'
594 },
594 },
595 ]
595 ]
596
596
597 #if windows
597 #if windows
598 $ hg --config ui.slash=false status -A --rev 1 1
598 $ hg --config ui.slash=false status -A --rev 1 1
599 R 1\2\3\4\5\b.txt
599 R 1\2\3\4\5\b.txt
600 #endif
600 #endif
601
601
602 $ cd ..
602 $ cd ..
603
603
604 Status after move overwriting a file (issue4458)
604 Status after move overwriting a file (issue4458)
605 =================================================
605 =================================================
606
606
607
607
608 $ hg init issue4458
608 $ hg init issue4458
609 $ cd issue4458
609 $ cd issue4458
610 $ echo a > a
610 $ echo a > a
611 $ echo b > b
611 $ echo b > b
612 $ hg commit -Am base
612 $ hg commit -Am base
613 adding a
613 adding a
614 adding b
614 adding b
615
615
616
616
617 with --force
617 with --force
618
618
619 $ hg mv b --force a
619 $ hg mv b --force a
620 $ hg st --copies
620 $ hg st --copies
621 M a
621 M a
622 b
622 b
623 R b
623 R b
624 $ hg revert --all
624 $ hg revert --all
625 reverting a
625 reverting a
626 undeleting b
626 undeleting b
627 $ rm *.orig
627 $ rm *.orig
628
628
629 without force
629 without force
630
630
631 $ hg rm a
631 $ hg rm a
632 $ hg st --copies
632 $ hg st --copies
633 R a
633 R a
634 $ hg mv b a
634 $ hg mv b a
635 $ hg st --copies
635 $ hg st --copies
636 M a
636 M a
637 b
637 b
638 R b
638 R b
639
639
640 using ui.statuscopies setting
640 using ui.statuscopies setting
641 $ hg st --config ui.statuscopies=true
641 $ hg st --config ui.statuscopies=true
642 M a
642 M a
643 b
643 b
644 R b
644 R b
645 $ hg st --config ui.statuscopies=true --no-copies
645 $ hg st --config ui.statuscopies=true --no-copies
646 M a
646 M a
647 R b
647 R b
648 $ hg st --config ui.statuscopies=false
648 $ hg st --config ui.statuscopies=false
649 M a
649 M a
650 R b
650 R b
651 $ hg st --config ui.statuscopies=false --copies
651 $ hg st --config ui.statuscopies=false --copies
652 M a
652 M a
653 b
653 b
654 R b
654 R b
655 $ hg st --config ui.tweakdefaults=yes
655 $ hg st --config ui.tweakdefaults=yes
656 M a
656 M a
657 b
657 b
658 R b
658 R b
659
659
660 using log status template (issue5155)
660 using log status template (issue5155)
661 $ hg log -Tstatus -r 'wdir()' -C
661 $ hg log -Tstatus -r 'wdir()' -C
662 changeset: 2147483647:ffffffffffff
662 changeset: 2147483647:ffffffffffff
663 parent: 0:8c55c58b4c0e
663 parent: 0:8c55c58b4c0e
664 user: test
664 user: test
665 date: * (glob)
665 date: * (glob)
666 files:
666 files:
667 M a
667 M a
668 b
668 b
669 R b
669 R b
670
670
671 $ hg log -GTstatus -r 'wdir()' -C
671 $ hg log -GTstatus -r 'wdir()' -C
672 o changeset: 2147483647:ffffffffffff
672 o changeset: 2147483647:ffffffffffff
673 | parent: 0:8c55c58b4c0e
673 | parent: 0:8c55c58b4c0e
674 ~ user: test
674 ~ user: test
675 date: * (glob)
675 date: * (glob)
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 Other "bug" highlight, the revision status does not report the copy information.
682 Other "bug" highlight, the revision status does not report the copy information.
683 This is buggy behavior.
683 This is buggy behavior.
684
684
685 $ hg commit -m 'blah'
685 $ hg commit -m 'blah'
686 $ hg st --copies --change .
686 $ hg st --copies --change .
687 M a
687 M a
688 R b
688 R b
689
689
690 using log status template, the copy information is displayed correctly.
690 using log status template, the copy information is displayed correctly.
691 $ hg log -Tstatus -r. -C
691 $ hg log -Tstatus -r. -C
692 changeset: 1:6685fde43d21
692 changeset: 1:6685fde43d21
693 tag: tip
693 tag: tip
694 user: test
694 user: test
695 date: * (glob)
695 date: * (glob)
696 summary: blah
696 summary: blah
697 files:
697 files:
698 M a
698 M a
699 b
699 b
700 R b
700 R b
701
701
702
702
703 $ cd ..
703 $ cd ..
704
704
705 Make sure .hg doesn't show up even as a symlink
705 Make sure .hg doesn't show up even as a symlink
706
706
707 $ hg init repo0
707 $ hg init repo0
708 $ mkdir symlink-repo0
708 $ mkdir symlink-repo0
709 $ cd symlink-repo0
709 $ cd symlink-repo0
710 $ ln -s ../repo0/.hg
710 $ ln -s ../repo0/.hg
711 $ hg status
711 $ hg status
712
712
713 If the size hasn’t changed but mtime has, status needs to read the contents
713 If the size hasn’t changed but mtime has, status needs to read the contents
714 of the file to check whether it has changed
714 of the file to check whether it has changed
715
715
716 $ echo 1 > a
716 $ echo 1 > a
717 $ echo 1 > b
717 $ echo 1 > b
718 $ touch -t 200102030000 a b
718 $ touch -t 200102030000 a b
719 $ hg commit -Aqm '#0'
719 $ hg commit -Aqm '#0'
720 $ echo 2 > a
720 $ echo 2 > a
721 $ touch -t 200102040000 a b
721 $ touch -t 200102040000 a b
722 $ hg status
722 $ hg status
723 M a
723 M a
724
724
725 Asking specifically for the status of a deleted/removed file
725 Asking specifically for the status of a deleted/removed file
726
726
727 $ rm a
727 $ rm a
728 $ rm b
728 $ rm b
729 $ hg status a
729 $ hg status a
730 ! a
730 ! a
731 $ hg rm a
731 $ hg rm a
732 $ hg rm b
732 $ hg rm b
733 $ hg status a
733 $ hg status a
734 R a
734 R a
735 $ hg commit -qm '#1'
735 $ hg commit -qm '#1'
736 $ hg status a
736 $ hg status a
737 a: $ENOENT$
737 a: $ENOENT$
738
738
739 Check using include flag with pattern when status does not need to traverse
739 Check using include flag with pattern when status does not need to traverse
740 the working directory (issue6483)
740 the working directory (issue6483)
741
741
742 $ cd ..
742 $ cd ..
743 $ hg init issue6483
743 $ hg init issue6483
744 $ cd issue6483
744 $ cd issue6483
745 $ touch a.py b.rs
745 $ touch a.py b.rs
746 $ hg add a.py b.rs
746 $ hg add a.py b.rs
747 $ hg st -aI "*.py"
747 $ hg st -aI "*.py"
748 A a.py
748 A a.py
749
749
750 Also check exclude pattern
750 Also check exclude pattern
751
751
752 $ hg st -aX "*.rs"
752 $ hg st -aX "*.rs"
753 A a.py
753 A a.py
754
754
755 issue6335
755 issue6335
756 When a directory containing a tracked file gets symlinked, as of 5.8
756 When a directory containing a tracked file gets symlinked, as of 5.8
757 `hg st` only gives the correct answer about clean (or deleted) files
757 `hg st` only gives the correct answer about clean (or deleted) files
758 if also listing unknowns.
758 if also listing unknowns.
759 The tree-based dirstate and status algorithm fix this:
759 The tree-based dirstate and status algorithm fix this:
760
760
761 #if symlink no-dirstate-v1 rust
761 #if symlink no-dirstate-v1 rust
762
762
763 $ cd ..
763 $ cd ..
764 $ hg init issue6335
764 $ hg init issue6335
765 $ cd issue6335
765 $ cd issue6335
766 $ mkdir foo
766 $ mkdir foo
767 $ touch foo/a
767 $ touch foo/a
768 $ hg ci -Ama
768 $ hg ci -Ama
769 adding foo/a
769 adding foo/a
770 $ mv foo bar
770 $ mv foo bar
771 $ ln -s bar foo
771 $ ln -s bar foo
772 $ hg status
772 $ hg status
773 ! foo/a
773 ! foo/a
774 ? bar/a
774 ? bar/a
775 ? foo
775 ? foo
776
776
777 $ hg status -c # incorrect output without the Rust implementation
777 $ hg status -c # incorrect output without the Rust implementation
778 $ hg status -cu
778 $ hg status -cu
779 ? bar/a
779 ? bar/a
780 ? foo
780 ? foo
781 $ hg status -d # incorrect output without the Rust implementation
781 $ hg status -d # incorrect output without the Rust implementation
782 ! foo/a
782 ! foo/a
783 $ hg status -du
783 $ hg status -du
784 ! foo/a
784 ! foo/a
785 ? bar/a
785 ? bar/a
786 ? foo
786 ? foo
787
787
788 #endif
788 #endif
789
789
790
790
791 Create a repo with files in each possible status
791 Create a repo with files in each possible status
792
792
793 $ cd ..
793 $ cd ..
794 $ hg init repo7
794 $ hg init repo7
795 $ cd repo7
795 $ cd repo7
796 $ mkdir subdir
796 $ mkdir subdir
797 $ touch clean modified deleted removed
797 $ touch clean modified deleted removed
798 $ touch subdir/clean subdir/modified subdir/deleted subdir/removed
798 $ touch subdir/clean subdir/modified subdir/deleted subdir/removed
799 $ echo ignored > .hgignore
799 $ echo ignored > .hgignore
800 $ hg ci -Aqm '#0'
800 $ hg ci -Aqm '#0'
801 $ echo 1 > modified
801 $ echo 1 > modified
802 $ echo 1 > subdir/modified
802 $ echo 1 > subdir/modified
803 $ rm deleted
803 $ rm deleted
804 $ rm subdir/deleted
804 $ rm subdir/deleted
805 $ hg rm removed
805 $ hg rm removed
806 $ hg rm subdir/removed
806 $ hg rm subdir/removed
807 $ touch unknown ignored
807 $ touch unknown ignored
808 $ touch subdir/unknown subdir/ignored
808 $ touch subdir/unknown subdir/ignored
809
809
810 Check the output
810 Check the output
811
811
812 $ hg status
812 $ hg status
813 M modified
813 M modified
814 M subdir/modified
814 M subdir/modified
815 R removed
815 R removed
816 R subdir/removed
816 R subdir/removed
817 ! deleted
817 ! deleted
818 ! subdir/deleted
818 ! subdir/deleted
819 ? subdir/unknown
819 ? subdir/unknown
820 ? unknown
820 ? unknown
821
821
822 $ hg status -mard
822 $ hg status -mard
823 M modified
823 M modified
824 M subdir/modified
824 M subdir/modified
825 R removed
825 R removed
826 R subdir/removed
826 R subdir/removed
827 ! deleted
827 ! deleted
828 ! subdir/deleted
828 ! subdir/deleted
829
829
830 $ hg status -A
830 $ hg status -A
831 M modified
831 M modified
832 M subdir/modified
832 M subdir/modified
833 R removed
833 R removed
834 R subdir/removed
834 R subdir/removed
835 ! deleted
835 ! deleted
836 ! subdir/deleted
836 ! subdir/deleted
837 ? subdir/unknown
837 ? subdir/unknown
838 ? unknown
838 ? unknown
839 I ignored
839 I ignored
840 I subdir/ignored
840 I subdir/ignored
841 C .hgignore
841 C .hgignore
842 C clean
842 C clean
843 C subdir/clean
843 C subdir/clean
844
844
845 $ hg status path:subdir
846 M subdir/modified
847 R subdir/removed
848 ! subdir/deleted
849 ? subdir/unknown
850
845 FIXME: it's a bug in rhg that the status below is empty:
851 FIXME: it's a bug in rhg that the status below is empty:
846
852
847 $ hg status 'glob:subdir/*'
853 $ hg status 'glob:subdir/*'
848 M subdir/modified (no-rhg !)
854 M subdir/modified (no-rhg !)
849 R subdir/removed (no-rhg !)
855 R subdir/removed (no-rhg !)
850 ! subdir/deleted (no-rhg !)
856 ! subdir/deleted (no-rhg !)
851 ? subdir/unknown (no-rhg !)
857 ? subdir/unknown (no-rhg !)
852
858
859 FIXME: it's a bug (both in rhg and in Python) that the status below is wrong,
860 in rhg it's empty, in Python it's missing the unknown file:
861
862 $ hg status rootfilesin:subdir
863 M subdir/modified (no-rhg !)
864 R subdir/removed (no-rhg !)
865 ! subdir/deleted (no-rhg !)
866
853 Note: `hg status some-name` creates a patternmatcher which is not supported
867 Note: `hg status some-name` creates a patternmatcher which is not supported
854 yet by the Rust implementation of status, but includematcher is supported.
868 yet by the Rust implementation of status, but includematcher is supported.
855 --include is used below for that reason
869 --include is used below for that reason
856
870
857 #if unix-permissions
871 #if unix-permissions
858
872
859 Not having permission to read a directory that contains tracked files makes
873 Not having permission to read a directory that contains tracked files makes
860 status emit a warning then behave as if the directory was empty or removed
874 status emit a warning then behave as if the directory was empty or removed
861 entirely:
875 entirely:
862
876
863 $ chmod 0 subdir
877 $ chmod 0 subdir
864 $ hg status --include subdir
878 $ hg status --include subdir
865 subdir: $EACCES$
879 subdir: $EACCES$
866 R subdir/removed
880 R subdir/removed
867 ! subdir/clean
881 ! subdir/clean
868 ! subdir/deleted
882 ! subdir/deleted
869 ! subdir/modified
883 ! subdir/modified
870 $ chmod 755 subdir
884 $ chmod 755 subdir
871
885
872 #endif
886 #endif
873
887
874 Remove a directory that contains tracked files
888 Remove a directory that contains tracked files
875
889
876 $ rm -r subdir
890 $ rm -r subdir
877 $ hg status --include subdir
891 $ hg status --include subdir
878 R subdir/removed
892 R subdir/removed
879 ! subdir/clean
893 ! subdir/clean
880 ! subdir/deleted
894 ! subdir/deleted
881 ! subdir/modified
895 ! subdir/modified
882
896
883 … and replace it by a file
897 … and replace it by a file
884
898
885 $ touch subdir
899 $ touch subdir
886 $ hg status --include subdir
900 $ hg status --include subdir
887 R subdir/removed
901 R subdir/removed
888 ! subdir/clean
902 ! subdir/clean
889 ! subdir/deleted
903 ! subdir/deleted
890 ! subdir/modified
904 ! subdir/modified
891 ? subdir
905 ? subdir
892
906
893 Replaced a deleted or removed file with a directory
907 Replaced a deleted or removed file with a directory
894
908
895 $ mkdir deleted removed
909 $ mkdir deleted removed
896 $ touch deleted/1 removed/1
910 $ touch deleted/1 removed/1
897 $ hg status --include deleted --include removed
911 $ hg status --include deleted --include removed
898 R removed
912 R removed
899 ! deleted
913 ! deleted
900 ? deleted/1
914 ? deleted/1
901 ? removed/1
915 ? removed/1
902 $ hg add removed/1
916 $ hg add removed/1
903 $ hg status --include deleted --include removed
917 $ hg status --include deleted --include removed
904 A removed/1
918 A removed/1
905 R removed
919 R removed
906 ! deleted
920 ! deleted
907 ? deleted/1
921 ? deleted/1
908
922
909 Deeply nested files in an ignored directory are still listed on request
923 Deeply nested files in an ignored directory are still listed on request
910
924
911 $ echo ignored-dir >> .hgignore
925 $ echo ignored-dir >> .hgignore
912 $ mkdir ignored-dir
926 $ mkdir ignored-dir
913 $ mkdir ignored-dir/subdir
927 $ mkdir ignored-dir/subdir
914 $ touch ignored-dir/subdir/1
928 $ touch ignored-dir/subdir/1
915 $ hg status --ignored
929 $ hg status --ignored
916 I ignored
930 I ignored
917 I ignored-dir/subdir/1
931 I ignored-dir/subdir/1
918
932
919 Check using include flag while listing ignored composes correctly (issue6514)
933 Check using include flag while listing ignored composes correctly (issue6514)
920
934
921 $ cd ..
935 $ cd ..
922 $ hg init issue6514
936 $ hg init issue6514
923 $ cd issue6514
937 $ cd issue6514
924 $ mkdir ignored-folder
938 $ mkdir ignored-folder
925 $ touch A.hs B.hs C.hs ignored-folder/other.txt ignored-folder/ctest.hs
939 $ touch A.hs B.hs C.hs ignored-folder/other.txt ignored-folder/ctest.hs
926 $ cat >.hgignore <<EOF
940 $ cat >.hgignore <<EOF
927 > A.hs
941 > A.hs
928 > B.hs
942 > B.hs
929 > ignored-folder/
943 > ignored-folder/
930 > EOF
944 > EOF
931 $ hg st -i -I 're:.*\.hs$'
945 $ hg st -i -I 're:.*\.hs$'
932 I A.hs
946 I A.hs
933 I B.hs
947 I B.hs
934 I ignored-folder/ctest.hs
948 I ignored-folder/ctest.hs
935
949
936 #if rust dirstate-v2
950 #if rust dirstate-v2
937
951
938 Check read_dir caching
952 Check read_dir caching
939
953
940 $ cd ..
954 $ cd ..
941 $ hg init repo8
955 $ hg init repo8
942 $ cd repo8
956 $ cd repo8
943 $ mkdir subdir
957 $ mkdir subdir
944 $ touch subdir/a subdir/b
958 $ touch subdir/a subdir/b
945 $ hg ci -Aqm '#0'
959 $ hg ci -Aqm '#0'
946
960
947 The cached mtime is initially unset
961 The cached mtime is initially unset
948
962
949 $ hg debugdirstate --all --no-dates | grep '^ '
963 $ hg debugdirstate --all --no-dates | grep '^ '
950 0 -1 unset subdir
964 0 -1 unset subdir
951
965
952 It is still not set when there are unknown files
966 It is still not set when there are unknown files
953
967
954 $ touch subdir/unknown
968 $ touch subdir/unknown
955 $ hg status
969 $ hg status
956 ? subdir/unknown
970 ? subdir/unknown
957 $ hg debugdirstate --all --no-dates | grep '^ '
971 $ hg debugdirstate --all --no-dates | grep '^ '
958 0 -1 unset subdir
972 0 -1 unset subdir
959
973
960 Now the directory is eligible for caching, so its mtime is saved in the dirstate
974 Now the directory is eligible for caching, so its mtime is saved in the dirstate
961
975
962 $ rm subdir/unknown
976 $ rm subdir/unknown
963 $ sleep 0.1 # ensure the kernel’s internal clock for mtimes has ticked
977 $ sleep 0.1 # ensure the kernel’s internal clock for mtimes has ticked
964 $ hg status
978 $ hg status
965 $ hg debugdirstate --all --no-dates | grep '^ '
979 $ hg debugdirstate --all --no-dates | grep '^ '
966 0 -1 set subdir
980 0 -1 set subdir
967
981
968 This time the command should be ever so slightly faster since it does not need `read_dir("subdir")`
982 This time the command should be ever so slightly faster since it does not need `read_dir("subdir")`
969
983
970 $ hg status
984 $ hg status
971
985
972 Creating a new file changes the directory’s mtime, invalidating the cache
986 Creating a new file changes the directory’s mtime, invalidating the cache
973
987
974 $ touch subdir/unknown
988 $ touch subdir/unknown
975 $ hg status
989 $ hg status
976 ? subdir/unknown
990 ? subdir/unknown
977
991
978 $ rm subdir/unknown
992 $ rm subdir/unknown
979 $ hg status
993 $ hg status
980
994
981 Removing a node from the dirstate resets the cache for its parent directory
995 Removing a node from the dirstate resets the cache for its parent directory
982
996
983 $ hg forget subdir/a
997 $ hg forget subdir/a
984 $ hg debugdirstate --all --no-dates | grep '^ '
998 $ hg debugdirstate --all --no-dates | grep '^ '
985 0 -1 set subdir
999 0 -1 set subdir
986 $ hg ci -qm '#1'
1000 $ hg ci -qm '#1'
987 $ hg debugdirstate --all --no-dates | grep '^ '
1001 $ hg debugdirstate --all --no-dates | grep '^ '
988 0 -1 unset subdir
1002 0 -1 unset subdir
989 $ hg status
1003 $ hg status
990 ? subdir/a
1004 ? subdir/a
991
1005
992 Changing the hgignore rules makes us recompute the status (and rewrite the dirstate).
1006 Changing the hgignore rules makes us recompute the status (and rewrite the dirstate).
993
1007
994 $ rm subdir/a
1008 $ rm subdir/a
995 $ mkdir another-subdir
1009 $ mkdir another-subdir
996 $ touch another-subdir/something-else
1010 $ touch another-subdir/something-else
997
1011
998 $ cat > "$TESTTMP"/extra-hgignore <<EOF
1012 $ cat > "$TESTTMP"/extra-hgignore <<EOF
999 > something-else
1013 > something-else
1000 > EOF
1014 > EOF
1001
1015
1002 $ hg status --config ui.ignore.global="$TESTTMP"/extra-hgignore
1016 $ hg status --config ui.ignore.global="$TESTTMP"/extra-hgignore
1003 $ hg debugdirstate --all --no-dates | grep '^ '
1017 $ hg debugdirstate --all --no-dates | grep '^ '
1004 0 -1 set subdir
1018 0 -1 set subdir
1005
1019
1006 $ hg status
1020 $ hg status
1007 ? another-subdir/something-else
1021 ? another-subdir/something-else
1008
1022
1009 One invocation of status is enough to populate the cache even if it's invalidated
1023 One invocation of status is enough to populate the cache even if it's invalidated
1010 in the same run.
1024 in the same run.
1011
1025
1012 $ hg debugdirstate --all --no-dates | grep '^ '
1026 $ hg debugdirstate --all --no-dates | grep '^ '
1013 0 -1 set subdir
1027 0 -1 set subdir
1014
1028
1015 #endif
1029 #endif
1016
1030
1017
1031
1018 Test copy source formatting.
1032 Test copy source formatting.
1019 $ cd ..
1033 $ cd ..
1020 $ hg init copy-source-repo
1034 $ hg init copy-source-repo
1021 $ cd copy-source-repo
1035 $ cd copy-source-repo
1022 $ mkdir -p foo/bar
1036 $ mkdir -p foo/bar
1023 $ cd foo/bar
1037 $ cd foo/bar
1024 $ touch file
1038 $ touch file
1025 $ hg addremove
1039 $ hg addremove
1026 adding foo/bar/file
1040 adding foo/bar/file
1027 $ hg commit -m 'add file'
1041 $ hg commit -m 'add file'
1028 $ hg mv file copy
1042 $ hg mv file copy
1029
1043
1030 Copy source respects relative path setting.
1044 Copy source respects relative path setting.
1031 $ hg st --config ui.statuscopies=true --config commands.status.relative=true
1045 $ hg st --config ui.statuscopies=true --config commands.status.relative=true
1032 A copy
1046 A copy
1033 file
1047 file
1034 R file
1048 R file
1035
1049
1036 Copy source is not shown when --no-status is passed.
1050 Copy source is not shown when --no-status is passed.
1037 $ hg st --config ui.statuscopies=true --no-status
1051 $ hg st --config ui.statuscopies=true --no-status
1038 foo/bar/copy
1052 foo/bar/copy
1039 foo/bar/file
1053 foo/bar/file
General Comments 0
You need to be logged in to leave comments. Login now