##// END OF EJS Templates
rhg: add test for bug with matchers in rhg status --rev --rev...
Mitchell Kember -
r53291:4e58b549 default
parent child Browse files
Show More
@@ -1,1051 +1,1072
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 Like previous tests but using --rev --rev instead of --change:
491
492 $ hg status --rev 0 --rev 1
493 M modified
494 A added
495 A copied
496 R removed
497
498 $ hg status --rev 0 --rev 1 unrelated
499 M modified (known-bad-output rhg !)
500 A added (known-bad-output rhg !)
501 A copied (known-bad-output rhg !)
502 R removed (known-bad-output rhg !)
503
504 $ hg status -C --rev 0 --rev 1 added modified copied removed deleted
505 M modified
506 A added
507 A copied
508 modified
509 R removed
510
490 $ cd ..
511 $ cd ..
491
512
492 hg status with --rev and reverted changes:
513 hg status with --rev and reverted changes:
493
514
494 $ hg init reverted-changes-repo
515 $ hg init reverted-changes-repo
495 $ cd reverted-changes-repo
516 $ cd reverted-changes-repo
496 $ echo a > file
517 $ echo a > file
497 $ hg add file
518 $ hg add file
498 $ hg ci -m a
519 $ hg ci -m a
499 $ echo b > file
520 $ echo b > file
500 $ hg ci -m b
521 $ hg ci -m b
501
522
502 reverted file should appear clean
523 reverted file should appear clean
503
524
504 $ hg revert -r 0 .
525 $ hg revert -r 0 .
505 reverting file
526 reverting file
506 $ hg status -A --rev 0
527 $ hg status -A --rev 0
507 C file
528 C file
508
529
509 #if execbit
530 #if execbit
510 reverted file with changed flag should appear modified
531 reverted file with changed flag should appear modified
511
532
512 $ chmod +x file
533 $ chmod +x file
513 $ hg status -A --rev 0
534 $ hg status -A --rev 0
514 M file
535 M file
515
536
516 $ hg revert -r 0 .
537 $ hg revert -r 0 .
517 reverting file
538 reverting file
518
539
519 reverted and committed file with changed flag should appear modified
540 reverted and committed file with changed flag should appear modified
520
541
521 $ hg co -C .
542 $ hg co -C .
522 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
543 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
523 $ chmod +x file
544 $ chmod +x file
524 $ hg ci -m 'change flag'
545 $ hg ci -m 'change flag'
525 $ hg status -A --rev 1 --rev 2
546 $ hg status -A --rev 1 --rev 2
526 M file
547 M file
527 $ hg diff -r 1 -r 2
548 $ hg diff -r 1 -r 2
528
549
529 #endif
550 #endif
530
551
531 $ cd ..
552 $ cd ..
532
553
533 hg status of binary file starting with '\1\n', a separator for metadata:
554 hg status of binary file starting with '\1\n', a separator for metadata:
534
555
535 $ hg init repo5
556 $ hg init repo5
536 $ cd repo5
557 $ cd repo5
537 >>> open("010a", r"wb").write(b"\1\nfoo") and None
558 >>> open("010a", r"wb").write(b"\1\nfoo") and None
538 $ hg ci -q -A -m 'initial checkin'
559 $ hg ci -q -A -m 'initial checkin'
539 $ hg status -A
560 $ hg status -A
540 C 010a
561 C 010a
541
562
542 >>> open("010a", r"wb").write(b"\1\nbar") and None
563 >>> open("010a", r"wb").write(b"\1\nbar") and None
543 $ hg status -A
564 $ hg status -A
544 M 010a
565 M 010a
545 $ hg ci -q -m 'modify 010a'
566 $ hg ci -q -m 'modify 010a'
546 $ hg status -A --rev 0:1
567 $ hg status -A --rev 0:1
547 M 010a
568 M 010a
548
569
549 $ touch empty
570 $ touch empty
550 $ hg ci -q -A -m 'add another file'
571 $ hg ci -q -A -m 'add another file'
551 $ hg status -A --rev 1:2 010a
572 $ hg status -A --rev 1:2 010a
552 C 010a
573 C 010a
553
574
554 $ cd ..
575 $ cd ..
555
576
556 test "hg status" with "directory pattern" which matches against files
577 test "hg status" with "directory pattern" which matches against files
557 only known on target revision.
578 only known on target revision.
558
579
559 $ hg init repo6
580 $ hg init repo6
560 $ cd repo6
581 $ cd repo6
561
582
562 $ echo a > a.txt
583 $ echo a > a.txt
563 $ hg add a.txt
584 $ hg add a.txt
564 $ hg commit -m '#0'
585 $ hg commit -m '#0'
565 $ mkdir -p 1/2/3/4/5
586 $ mkdir -p 1/2/3/4/5
566 $ echo b > 1/2/3/4/5/b.txt
587 $ echo b > 1/2/3/4/5/b.txt
567 $ hg add 1/2/3/4/5/b.txt
588 $ hg add 1/2/3/4/5/b.txt
568 $ hg commit -m '#1'
589 $ hg commit -m '#1'
569
590
570 $ hg update -C 0 > /dev/null
591 $ hg update -C 0 > /dev/null
571 $ hg status -A
592 $ hg status -A
572 C a.txt
593 C a.txt
573
594
574 the directory matching against specified pattern should be removed,
595 the directory matching against specified pattern should be removed,
575 because directory existence prevents 'dirstate.walk()' from showing
596 because directory existence prevents 'dirstate.walk()' from showing
576 warning message about such pattern.
597 warning message about such pattern.
577
598
578 $ test ! -d 1
599 $ test ! -d 1
579 $ hg status -A --rev 1 1/2/3/4/5/b.txt
600 $ hg status -A --rev 1 1/2/3/4/5/b.txt
580 R 1/2/3/4/5/b.txt
601 R 1/2/3/4/5/b.txt
581 $ hg status -A --rev 1 1/2/3/4/5
602 $ hg status -A --rev 1 1/2/3/4/5
582 R 1/2/3/4/5/b.txt
603 R 1/2/3/4/5/b.txt
583 $ hg status -A --rev 1 1/2/3
604 $ hg status -A --rev 1 1/2/3
584 R 1/2/3/4/5/b.txt
605 R 1/2/3/4/5/b.txt
585 $ hg status -A --rev 1 1
606 $ hg status -A --rev 1 1
586 R 1/2/3/4/5/b.txt
607 R 1/2/3/4/5/b.txt
587
608
588 $ hg status --config ui.formatdebug=True --rev 1 1
609 $ hg status --config ui.formatdebug=True --rev 1 1
589 status = [
610 status = [
590 {
611 {
591 'itemtype': 'file',
612 'itemtype': 'file',
592 'path': '1/2/3/4/5/b.txt',
613 'path': '1/2/3/4/5/b.txt',
593 'status': 'R'
614 'status': 'R'
594 },
615 },
595 ]
616 ]
596
617
597 #if windows
618 #if windows
598 $ hg --config ui.slash=false status -A --rev 1 1
619 $ hg --config ui.slash=false status -A --rev 1 1
599 R 1\2\3\4\5\b.txt
620 R 1\2\3\4\5\b.txt
600 #endif
621 #endif
601
622
602 $ cd ..
623 $ cd ..
603
624
604 Status after move overwriting a file (issue4458)
625 Status after move overwriting a file (issue4458)
605 =================================================
626 =================================================
606
627
607
628
608 $ hg init issue4458
629 $ hg init issue4458
609 $ cd issue4458
630 $ cd issue4458
610 $ echo a > a
631 $ echo a > a
611 $ echo b > b
632 $ echo b > b
612 $ hg commit -Am base
633 $ hg commit -Am base
613 adding a
634 adding a
614 adding b
635 adding b
615
636
616
637
617 with --force
638 with --force
618
639
619 $ hg mv b --force a
640 $ hg mv b --force a
620 $ hg st --copies
641 $ hg st --copies
621 M a
642 M a
622 b
643 b
623 R b
644 R b
624 $ hg revert --all
645 $ hg revert --all
625 reverting a
646 reverting a
626 undeleting b
647 undeleting b
627 $ rm *.orig
648 $ rm *.orig
628
649
629 without force
650 without force
630
651
631 $ hg rm a
652 $ hg rm a
632 $ hg st --copies
653 $ hg st --copies
633 R a
654 R a
634 $ hg mv b a
655 $ hg mv b a
635 $ hg st --copies
656 $ hg st --copies
636 M a
657 M a
637 b
658 b
638 R b
659 R b
639
660
640 using ui.statuscopies setting
661 using ui.statuscopies setting
641 $ hg st --config ui.statuscopies=true
662 $ hg st --config ui.statuscopies=true
642 M a
663 M a
643 b
664 b
644 R b
665 R b
645 $ hg st --config ui.statuscopies=true --no-copies
666 $ hg st --config ui.statuscopies=true --no-copies
646 M a
667 M a
647 R b
668 R b
648 $ hg st --config ui.statuscopies=false
669 $ hg st --config ui.statuscopies=false
649 M a
670 M a
650 R b
671 R b
651 $ hg st --config ui.statuscopies=false --copies
672 $ hg st --config ui.statuscopies=false --copies
652 M a
673 M a
653 b
674 b
654 R b
675 R b
655 $ hg st --config ui.tweakdefaults=yes
676 $ hg st --config ui.tweakdefaults=yes
656 M a
677 M a
657 b
678 b
658 R b
679 R b
659
680
660 using log status template (issue5155)
681 using log status template (issue5155)
661 $ hg log -Tstatus -r 'wdir()' -C
682 $ hg log -Tstatus -r 'wdir()' -C
662 changeset: 2147483647:ffffffffffff
683 changeset: 2147483647:ffffffffffff
663 parent: 0:8c55c58b4c0e
684 parent: 0:8c55c58b4c0e
664 user: test
685 user: test
665 date: * (glob)
686 date: * (glob)
666 files:
687 files:
667 M a
688 M a
668 b
689 b
669 R b
690 R b
670
691
671 $ hg log -GTstatus -r 'wdir()' -C
692 $ hg log -GTstatus -r 'wdir()' -C
672 o changeset: 2147483647:ffffffffffff
693 o changeset: 2147483647:ffffffffffff
673 | parent: 0:8c55c58b4c0e
694 | parent: 0:8c55c58b4c0e
674 ~ user: test
695 ~ user: test
675 date: * (glob)
696 date: * (glob)
676 files:
697 files:
677 M a
698 M a
678 b
699 b
679 R b
700 R b
680
701
681
702
682 Other "bug" highlight, the revision status does not report the copy information.
703 Other "bug" highlight, the revision status does not report the copy information.
683 This is buggy behavior.
704 This is buggy behavior.
684
705
685 $ hg commit -m 'blah'
706 $ hg commit -m 'blah'
686 $ hg st --copies --change .
707 $ hg st --copies --change .
687 M a
708 M a
688 R b
709 R b
689
710
690 using log status template, the copy information is displayed correctly.
711 using log status template, the copy information is displayed correctly.
691 $ hg log -Tstatus -r. -C
712 $ hg log -Tstatus -r. -C
692 changeset: 1:6685fde43d21
713 changeset: 1:6685fde43d21
693 tag: tip
714 tag: tip
694 user: test
715 user: test
695 date: * (glob)
716 date: * (glob)
696 summary: blah
717 summary: blah
697 files:
718 files:
698 M a
719 M a
699 b
720 b
700 R b
721 R b
701
722
702
723
703 $ cd ..
724 $ cd ..
704
725
705 Make sure .hg doesn't show up even as a symlink
726 Make sure .hg doesn't show up even as a symlink
706
727
707 $ hg init repo0
728 $ hg init repo0
708 $ mkdir symlink-repo0
729 $ mkdir symlink-repo0
709 $ cd symlink-repo0
730 $ cd symlink-repo0
710 $ ln -s ../repo0/.hg
731 $ ln -s ../repo0/.hg
711 $ hg status
732 $ hg status
712
733
713 If the size hasn’t changed but mtime has, status needs to read the contents
734 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
735 of the file to check whether it has changed
715
736
716 $ echo 1 > a
737 $ echo 1 > a
717 $ echo 1 > b
738 $ echo 1 > b
718 $ touch -t 200102030000 a b
739 $ touch -t 200102030000 a b
719 $ hg commit -Aqm '#0'
740 $ hg commit -Aqm '#0'
720 $ echo 2 > a
741 $ echo 2 > a
721 $ touch -t 200102040000 a b
742 $ touch -t 200102040000 a b
722 $ hg status
743 $ hg status
723 M a
744 M a
724
745
725 Asking specifically for the status of a deleted/removed file
746 Asking specifically for the status of a deleted/removed file
726
747
727 $ rm a
748 $ rm a
728 $ rm b
749 $ rm b
729 $ hg status a
750 $ hg status a
730 ! a
751 ! a
731 $ hg rm a
752 $ hg rm a
732 $ hg rm b
753 $ hg rm b
733 $ hg status a
754 $ hg status a
734 R a
755 R a
735 $ hg commit -qm '#1'
756 $ hg commit -qm '#1'
736 $ hg status a
757 $ hg status a
737 a: $ENOENT$
758 a: $ENOENT$
738
759
739 Check using include flag with pattern when status does not need to traverse
760 Check using include flag with pattern when status does not need to traverse
740 the working directory (issue6483)
761 the working directory (issue6483)
741
762
742 $ cd ..
763 $ cd ..
743 $ hg init issue6483
764 $ hg init issue6483
744 $ cd issue6483
765 $ cd issue6483
745 $ touch a.py b.rs
766 $ touch a.py b.rs
746 $ hg add a.py b.rs
767 $ hg add a.py b.rs
747 $ hg st -aI "*.py"
768 $ hg st -aI "*.py"
748 A a.py
769 A a.py
749
770
750 Also check exclude pattern
771 Also check exclude pattern
751
772
752 $ hg st -aX "*.rs"
773 $ hg st -aX "*.rs"
753 A a.py
774 A a.py
754
775
755 issue6335
776 issue6335
756 When a directory containing a tracked file gets symlinked, as of 5.8
777 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
778 `hg st` only gives the correct answer about clean (or deleted) files
758 if also listing unknowns.
779 if also listing unknowns.
759 The tree-based dirstate and status algorithm fix this:
780 The tree-based dirstate and status algorithm fix this:
760
781
761 #if symlink no-dirstate-v1 rust
782 #if symlink no-dirstate-v1 rust
762
783
763 $ cd ..
784 $ cd ..
764 $ hg init issue6335
785 $ hg init issue6335
765 $ cd issue6335
786 $ cd issue6335
766 $ mkdir foo
787 $ mkdir foo
767 $ touch foo/a
788 $ touch foo/a
768 $ hg ci -Ama
789 $ hg ci -Ama
769 adding foo/a
790 adding foo/a
770 $ mv foo bar
791 $ mv foo bar
771 $ ln -s bar foo
792 $ ln -s bar foo
772 $ hg status
793 $ hg status
773 ! foo/a
794 ! foo/a
774 ? bar/a
795 ? bar/a
775 ? foo
796 ? foo
776
797
777 $ hg status -c # incorrect output without the Rust implementation
798 $ hg status -c # incorrect output without the Rust implementation
778 $ hg status -cu
799 $ hg status -cu
779 ? bar/a
800 ? bar/a
780 ? foo
801 ? foo
781 $ hg status -d # incorrect output without the Rust implementation
802 $ hg status -d # incorrect output without the Rust implementation
782 ! foo/a
803 ! foo/a
783 $ hg status -du
804 $ hg status -du
784 ! foo/a
805 ! foo/a
785 ? bar/a
806 ? bar/a
786 ? foo
807 ? foo
787
808
788 #endif
809 #endif
789
810
790
811
791 Create a repo with files in each possible status
812 Create a repo with files in each possible status
792
813
793 $ cd ..
814 $ cd ..
794 $ hg init repo7
815 $ hg init repo7
795 $ cd repo7
816 $ cd repo7
796 $ mkdir subdir
817 $ mkdir subdir
797 $ touch clean modified deleted removed
818 $ touch clean modified deleted removed
798 $ touch subdir/clean subdir/modified subdir/deleted subdir/removed
819 $ touch subdir/clean subdir/modified subdir/deleted subdir/removed
799 $ echo ignored > .hgignore
820 $ echo ignored > .hgignore
800 $ hg ci -Aqm '#0'
821 $ hg ci -Aqm '#0'
801 $ echo 1 > modified
822 $ echo 1 > modified
802 $ echo 1 > subdir/modified
823 $ echo 1 > subdir/modified
803 $ rm deleted
824 $ rm deleted
804 $ rm subdir/deleted
825 $ rm subdir/deleted
805 $ hg rm removed
826 $ hg rm removed
806 $ hg rm subdir/removed
827 $ hg rm subdir/removed
807 $ touch unknown ignored
828 $ touch unknown ignored
808 $ touch subdir/unknown subdir/ignored
829 $ touch subdir/unknown subdir/ignored
809
830
810 Check the output
831 Check the output
811
832
812 $ hg status
833 $ hg status
813 M modified
834 M modified
814 M subdir/modified
835 M subdir/modified
815 R removed
836 R removed
816 R subdir/removed
837 R subdir/removed
817 ! deleted
838 ! deleted
818 ! subdir/deleted
839 ! subdir/deleted
819 ? subdir/unknown
840 ? subdir/unknown
820 ? unknown
841 ? unknown
821
842
822 $ hg status -mard
843 $ hg status -mard
823 M modified
844 M modified
824 M subdir/modified
845 M subdir/modified
825 R removed
846 R removed
826 R subdir/removed
847 R subdir/removed
827 ! deleted
848 ! deleted
828 ! subdir/deleted
849 ! subdir/deleted
829
850
830 $ hg status -A
851 $ hg status -A
831 M modified
852 M modified
832 M subdir/modified
853 M subdir/modified
833 R removed
854 R removed
834 R subdir/removed
855 R subdir/removed
835 ! deleted
856 ! deleted
836 ! subdir/deleted
857 ! subdir/deleted
837 ? subdir/unknown
858 ? subdir/unknown
838 ? unknown
859 ? unknown
839 I ignored
860 I ignored
840 I subdir/ignored
861 I subdir/ignored
841 C .hgignore
862 C .hgignore
842 C clean
863 C clean
843 C subdir/clean
864 C subdir/clean
844
865
845 Test various matchers interatction with dirstate code:
866 Test various matchers interatction with dirstate code:
846
867
847 $ hg status path:subdir
868 $ hg status path:subdir
848 M subdir/modified
869 M subdir/modified
849 R subdir/removed
870 R subdir/removed
850 ! subdir/deleted
871 ! subdir/deleted
851 ? subdir/unknown
872 ? subdir/unknown
852
873
853 $ hg status 'glob:subdir/*'
874 $ hg status 'glob:subdir/*'
854 M subdir/modified
875 M subdir/modified
855 R subdir/removed
876 R subdir/removed
856 ! subdir/deleted
877 ! subdir/deleted
857 ? subdir/unknown
878 ? subdir/unknown
858
879
859 $ hg status rootfilesin:subdir
880 $ hg status rootfilesin:subdir
860 M subdir/modified
881 M subdir/modified
861 R subdir/removed
882 R subdir/removed
862 ! subdir/deleted
883 ! subdir/deleted
863 ? subdir/unknown
884 ? subdir/unknown
864
885
865 Note: `hg status some-name` creates a patternmatcher which is not supported
886 Note: `hg status some-name` creates a patternmatcher which is not supported
866 yet by the Rust implementation of status, but includematcher is supported.
887 yet by the Rust implementation of status, but includematcher is supported.
867 --include is used below for that reason
888 --include is used below for that reason
868
889
869 #if unix-permissions
890 #if unix-permissions
870
891
871 Not having permission to read a directory that contains tracked files makes
892 Not having permission to read a directory that contains tracked files makes
872 status emit a warning then behave as if the directory was empty or removed
893 status emit a warning then behave as if the directory was empty or removed
873 entirely:
894 entirely:
874
895
875 $ chmod 0 subdir
896 $ chmod 0 subdir
876 $ hg status --include subdir
897 $ hg status --include subdir
877 subdir: $EACCES$
898 subdir: $EACCES$
878 R subdir/removed
899 R subdir/removed
879 ! subdir/clean
900 ! subdir/clean
880 ! subdir/deleted
901 ! subdir/deleted
881 ! subdir/modified
902 ! subdir/modified
882 $ chmod 755 subdir
903 $ chmod 755 subdir
883
904
884 #endif
905 #endif
885
906
886 Remove a directory that contains tracked files
907 Remove a directory that contains tracked files
887
908
888 $ rm -r subdir
909 $ rm -r subdir
889 $ hg status --include subdir
910 $ hg status --include subdir
890 R subdir/removed
911 R subdir/removed
891 ! subdir/clean
912 ! subdir/clean
892 ! subdir/deleted
913 ! subdir/deleted
893 ! subdir/modified
914 ! subdir/modified
894
915
895 … and replace it by a file
916 … and replace it by a file
896
917
897 $ touch subdir
918 $ touch subdir
898 $ hg status --include subdir
919 $ hg status --include subdir
899 R subdir/removed
920 R subdir/removed
900 ! subdir/clean
921 ! subdir/clean
901 ! subdir/deleted
922 ! subdir/deleted
902 ! subdir/modified
923 ! subdir/modified
903 ? subdir
924 ? subdir
904
925
905 Replaced a deleted or removed file with a directory
926 Replaced a deleted or removed file with a directory
906
927
907 $ mkdir deleted removed
928 $ mkdir deleted removed
908 $ touch deleted/1 removed/1
929 $ touch deleted/1 removed/1
909 $ hg status --include deleted --include removed
930 $ hg status --include deleted --include removed
910 R removed
931 R removed
911 ! deleted
932 ! deleted
912 ? deleted/1
933 ? deleted/1
913 ? removed/1
934 ? removed/1
914 $ hg add removed/1
935 $ hg add removed/1
915 $ hg status --include deleted --include removed
936 $ hg status --include deleted --include removed
916 A removed/1
937 A removed/1
917 R removed
938 R removed
918 ! deleted
939 ! deleted
919 ? deleted/1
940 ? deleted/1
920
941
921 Deeply nested files in an ignored directory are still listed on request
942 Deeply nested files in an ignored directory are still listed on request
922
943
923 $ echo ignored-dir >> .hgignore
944 $ echo ignored-dir >> .hgignore
924 $ mkdir ignored-dir
945 $ mkdir ignored-dir
925 $ mkdir ignored-dir/subdir
946 $ mkdir ignored-dir/subdir
926 $ touch ignored-dir/subdir/1
947 $ touch ignored-dir/subdir/1
927 $ hg status --ignored
948 $ hg status --ignored
928 I ignored
949 I ignored
929 I ignored-dir/subdir/1
950 I ignored-dir/subdir/1
930
951
931 Check using include flag while listing ignored composes correctly (issue6514)
952 Check using include flag while listing ignored composes correctly (issue6514)
932
953
933 $ cd ..
954 $ cd ..
934 $ hg init issue6514
955 $ hg init issue6514
935 $ cd issue6514
956 $ cd issue6514
936 $ mkdir ignored-folder
957 $ mkdir ignored-folder
937 $ touch A.hs B.hs C.hs ignored-folder/other.txt ignored-folder/ctest.hs
958 $ touch A.hs B.hs C.hs ignored-folder/other.txt ignored-folder/ctest.hs
938 $ cat >.hgignore <<EOF
959 $ cat >.hgignore <<EOF
939 > A.hs
960 > A.hs
940 > B.hs
961 > B.hs
941 > ignored-folder/
962 > ignored-folder/
942 > EOF
963 > EOF
943 $ hg st -i -I 're:.*\.hs$'
964 $ hg st -i -I 're:.*\.hs$'
944 I A.hs
965 I A.hs
945 I B.hs
966 I B.hs
946 I ignored-folder/ctest.hs
967 I ignored-folder/ctest.hs
947
968
948 #if rust dirstate-v2
969 #if rust dirstate-v2
949
970
950 Check read_dir caching
971 Check read_dir caching
951
972
952 $ cd ..
973 $ cd ..
953 $ hg init repo8
974 $ hg init repo8
954 $ cd repo8
975 $ cd repo8
955 $ mkdir subdir
976 $ mkdir subdir
956 $ touch subdir/a subdir/b
977 $ touch subdir/a subdir/b
957 $ hg ci -Aqm '#0'
978 $ hg ci -Aqm '#0'
958
979
959 The cached mtime is initially unset
980 The cached mtime is initially unset
960
981
961 $ hg debugdirstate --all --no-dates | grep '^ '
982 $ hg debugdirstate --all --no-dates | grep '^ '
962 0 -1 unset subdir
983 0 -1 unset subdir
963
984
964 It is still not set when there are unknown files
985 It is still not set when there are unknown files
965
986
966 $ touch subdir/unknown
987 $ touch subdir/unknown
967 $ hg status
988 $ hg status
968 ? subdir/unknown
989 ? subdir/unknown
969 $ hg debugdirstate --all --no-dates | grep '^ '
990 $ hg debugdirstate --all --no-dates | grep '^ '
970 0 -1 unset subdir
991 0 -1 unset subdir
971
992
972 Now the directory is eligible for caching, so its mtime is saved in the dirstate
993 Now the directory is eligible for caching, so its mtime is saved in the dirstate
973
994
974 $ rm subdir/unknown
995 $ rm subdir/unknown
975 $ sleep 0.1 # ensure the kernel’s internal clock for mtimes has ticked
996 $ sleep 0.1 # ensure the kernel’s internal clock for mtimes has ticked
976 $ hg status
997 $ hg status
977 $ hg debugdirstate --all --no-dates | grep '^ '
998 $ hg debugdirstate --all --no-dates | grep '^ '
978 0 -1 set subdir
999 0 -1 set subdir
979
1000
980 This time the command should be ever so slightly faster since it does not need `read_dir("subdir")`
1001 This time the command should be ever so slightly faster since it does not need `read_dir("subdir")`
981
1002
982 $ hg status
1003 $ hg status
983
1004
984 Creating a new file changes the directory’s mtime, invalidating the cache
1005 Creating a new file changes the directory’s mtime, invalidating the cache
985
1006
986 $ touch subdir/unknown
1007 $ touch subdir/unknown
987 $ hg status
1008 $ hg status
988 ? subdir/unknown
1009 ? subdir/unknown
989
1010
990 $ rm subdir/unknown
1011 $ rm subdir/unknown
991 $ hg status
1012 $ hg status
992
1013
993 Removing a node from the dirstate resets the cache for its parent directory
1014 Removing a node from the dirstate resets the cache for its parent directory
994
1015
995 $ hg forget subdir/a
1016 $ hg forget subdir/a
996 $ hg debugdirstate --all --no-dates | grep '^ '
1017 $ hg debugdirstate --all --no-dates | grep '^ '
997 0 -1 set subdir
1018 0 -1 set subdir
998 $ hg ci -qm '#1'
1019 $ hg ci -qm '#1'
999 $ hg debugdirstate --all --no-dates | grep '^ '
1020 $ hg debugdirstate --all --no-dates | grep '^ '
1000 0 -1 unset subdir
1021 0 -1 unset subdir
1001 $ hg status
1022 $ hg status
1002 ? subdir/a
1023 ? subdir/a
1003
1024
1004 Changing the hgignore rules makes us recompute the status (and rewrite the dirstate).
1025 Changing the hgignore rules makes us recompute the status (and rewrite the dirstate).
1005
1026
1006 $ rm subdir/a
1027 $ rm subdir/a
1007 $ mkdir another-subdir
1028 $ mkdir another-subdir
1008 $ touch another-subdir/something-else
1029 $ touch another-subdir/something-else
1009
1030
1010 $ cat > "$TESTTMP"/extra-hgignore <<EOF
1031 $ cat > "$TESTTMP"/extra-hgignore <<EOF
1011 > something-else
1032 > something-else
1012 > EOF
1033 > EOF
1013
1034
1014 $ hg status --config ui.ignore.global="$TESTTMP"/extra-hgignore
1035 $ hg status --config ui.ignore.global="$TESTTMP"/extra-hgignore
1015 $ hg debugdirstate --all --no-dates | grep '^ '
1036 $ hg debugdirstate --all --no-dates | grep '^ '
1016 0 -1 set subdir
1037 0 -1 set subdir
1017
1038
1018 $ hg status
1039 $ hg status
1019 ? another-subdir/something-else
1040 ? another-subdir/something-else
1020
1041
1021 One invocation of status is enough to populate the cache even if it's invalidated
1042 One invocation of status is enough to populate the cache even if it's invalidated
1022 in the same run.
1043 in the same run.
1023
1044
1024 $ hg debugdirstate --all --no-dates | grep '^ '
1045 $ hg debugdirstate --all --no-dates | grep '^ '
1025 0 -1 set subdir
1046 0 -1 set subdir
1026
1047
1027 #endif
1048 #endif
1028
1049
1029
1050
1030 Test copy source formatting.
1051 Test copy source formatting.
1031 $ cd ..
1052 $ cd ..
1032 $ hg init copy-source-repo
1053 $ hg init copy-source-repo
1033 $ cd copy-source-repo
1054 $ cd copy-source-repo
1034 $ mkdir -p foo/bar
1055 $ mkdir -p foo/bar
1035 $ cd foo/bar
1056 $ cd foo/bar
1036 $ touch file
1057 $ touch file
1037 $ hg addremove
1058 $ hg addremove
1038 adding foo/bar/file
1059 adding foo/bar/file
1039 $ hg commit -m 'add file'
1060 $ hg commit -m 'add file'
1040 $ hg mv file copy
1061 $ hg mv file copy
1041
1062
1042 Copy source respects relative path setting.
1063 Copy source respects relative path setting.
1043 $ hg st --config ui.statuscopies=true --config commands.status.relative=true
1064 $ hg st --config ui.statuscopies=true --config commands.status.relative=true
1044 A copy
1065 A copy
1045 file
1066 file
1046 R file
1067 R file
1047
1068
1048 Copy source is not shown when --no-status is passed.
1069 Copy source is not shown when --no-status is passed.
1049 $ hg st --config ui.statuscopies=true --no-status
1070 $ hg st --config ui.statuscopies=true --no-status
1050 foo/bar/copy
1071 foo/bar/copy
1051 foo/bar/file
1072 foo/bar/file
General Comments 0
You need to be logged in to leave comments. Login now