Mercurial > hg > mercurial-source
annotate tests/test-status @ 6200:acc40572da5b
'hg status -q' output skips non-tracked files.
The '-q' flag was ignored in status command. But this flag
can be used to hide non-tracked files in hg status output.
This small correction makes status command more general,
similar to 'svn status', where '-q' flag has the same effect.
The '-u' and '-A' flags have priority over '-q'.
A testcase and doc-string for status was extended to cover
'-q' flag.
author | Zoran Bosnjak <zoran.bosnjak@via.si> |
---|---|
date | Sat, 01 Mar 2008 22:30:03 +0100 |
parents | a1ebd5cd7e55 |
children | 305d4450036a |
rev | line source |
---|---|
1624
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
1 #!/bin/sh |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
2 |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
3 hg init repo1 |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
4 cd repo1 |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
5 mkdir a b a/1 b/1 b/2 |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
6 touch in_root a/in_a b/in_b a/1/in_a_1 b/1/in_b_1 b/2/in_b_2 |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
7 echo "hg status in repo root:" |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
8 hg status |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
9 echo "hg status . in repo root:" |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
10 hg status . |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
11 for dir in a b a/1 b/1 b/2; do |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
12 echo "hg status in $dir:" |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
13 hg status --cwd "$dir" |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
14 echo "hg status . in $dir:" |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
15 hg status --cwd "$dir" . |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
16 echo "hg status .. in $dir:" |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
17 hg status --cwd "$dir" .. |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
18 done |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
19 cd .. |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
20 |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
21 hg init repo2 |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
22 cd repo2 |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
23 touch modified removed deleted ignored |
6046
a1ebd5cd7e55
dirstate.status: avoid putting ignored files in the unknown list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3834
diff
changeset
|
24 echo "^ignored$" > .hgignore |
1933
7544700fd931
Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1624
diff
changeset
|
25 hg ci -A -m 'initial checkin' -d "1000000 0" |
1624
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
26 sleep 1 # make sure mtime is changed |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
27 touch modified added unknown ignored |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
28 hg add added |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
29 hg remove removed |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
30 rm deleted |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
31 echo "hg status:" |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
32 hg status |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
33 echo "hg status modified added removed deleted unknown never-existed ignored:" |
d9e576e55d81
Added test for relative paths and all status flags for 'hg status'
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
34 hg status modified added removed deleted unknown never-existed ignored |
2639
001703ec311d
Add an option '-C|--copies' to hg status to show the source of copied files.
Brendan Cully <brendan@kublai.com>
parents:
1933
diff
changeset
|
35 hg copy modified copied |
001703ec311d
Add an option '-C|--copies' to hg status to show the source of copied files.
Brendan Cully <brendan@kublai.com>
parents:
1933
diff
changeset
|
36 echo "hg status -C:" |
001703ec311d
Add an option '-C|--copies' to hg status to show the source of copied files.
Brendan Cully <brendan@kublai.com>
parents:
1933
diff
changeset
|
37 hg status -C |
2661
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
38 echo "hg status -A:" |
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
39 hg status -A |
6046
a1ebd5cd7e55
dirstate.status: avoid putting ignored files in the unknown list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3834
diff
changeset
|
40 echo "^ignoreddir$" > .hgignore |
a1ebd5cd7e55
dirstate.status: avoid putting ignored files in the unknown list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3834
diff
changeset
|
41 mkdir ignoreddir |
a1ebd5cd7e55
dirstate.status: avoid putting ignored files in the unknown list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3834
diff
changeset
|
42 touch ignoreddir/file |
a1ebd5cd7e55
dirstate.status: avoid putting ignored files in the unknown list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3834
diff
changeset
|
43 echo "hg status ignoreddir/file:" |
a1ebd5cd7e55
dirstate.status: avoid putting ignored files in the unknown list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3834
diff
changeset
|
44 hg status ignoreddir/file |
a1ebd5cd7e55
dirstate.status: avoid putting ignored files in the unknown list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3834
diff
changeset
|
45 echo "hg status -i ignoreddir/file:" |
a1ebd5cd7e55
dirstate.status: avoid putting ignored files in the unknown list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3834
diff
changeset
|
46 hg status -i ignoreddir/file |
6200
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
47 cd .. |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
48 |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
49 # check 'status -q' and some combinations |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
50 hg init repo3 |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
51 cd repo3 |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
52 touch modified removed deleted ignored |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
53 echo "^ignored$" > .hgignore |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
54 hg commit -A -m 'initial checkin' |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
55 touch added unknown ignored |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
56 hg add added |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
57 echo "test" >> modified |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
58 hg remove removed |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
59 rm deleted |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
60 hg copy modified copied |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
61 |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
62 # Run status with 2 different flags. |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
63 # Check if result is the same or different. |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
64 # If result is not as expected, raise error |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
65 function assert { |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
66 hg status $1 > ../a |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
67 hg status $2 > ../b |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
68 out=`diff ../a ../b` |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
69 if [ $? -ne 0 ]; then |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
70 out=1 |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
71 else |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
72 out=0 |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
73 fi |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
74 if [ $3 -eq 0 ]; then |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
75 df="same" |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
76 else |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
77 df="different" |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
78 fi |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
79 if [ $out -ne $3 ]; then |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
80 echo "Error on $1 and $2, should be $df." |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
81 fi |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
82 } |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
83 |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
84 # assert flag1 flag2 [0-same | 1-different] |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
85 assert "-q" "-mard" 0 |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
86 assert "-A" "-mardicCu" 0 |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
87 assert "-qA" "-mardicCu" 0 |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
88 assert "-qAu" "-A" 0 |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
89 assert "-qA" "-A" 0 |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
90 assert "-qu" "-u" 0 |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
91 assert "-q" "-u" 1 |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
92 assert "-m" "-a" 1 |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
93 assert "-r" "-d" 1 |
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6046
diff
changeset
|
94 |