Mercurial > hg
comparison tests/test-terse-status.t @ 33548:4cd4344a53c4
status: add a flag to terse the output (issue4119)
This adds an experimental flag -t/--terse which will terse the output. The terse flag
will respect other flags which filters the output. The flag takes a string
whose value can be a subsequence of "marduic" (the order does not matter here.)
Ignored files are not considered while tersing unless -i flag is passed or 'i'
is there is the terse flag value.
The flag is experimental for testing as there may be cases which will produce
strange results with the flag. We can set the terse on by default by simply
passing 'u' to the cmdutil.tersestatus().
This patch also adds a test file with tests covering the new feature.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sat, 17 Jun 2017 20:10:22 +0530 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
33547:a6af8560494e | 33548:4cd4344a53c4 |
---|---|
1 $ mkdir folder | |
2 $ cd folder | |
3 $ hg init | |
4 $ mkdir x x/l x/m x/n x/l/u x/l/u/a | |
5 $ touch a b x/aa.o x/bb.o | |
6 $ hg status | |
7 ? a | |
8 ? b | |
9 ? x/aa.o | |
10 ? x/bb.o | |
11 | |
12 $ hg status --terse u | |
13 ? a | |
14 ? b | |
15 ? x/ | |
16 $ hg status --terse maudric | |
17 ? a | |
18 ? b | |
19 ? x/ | |
20 $ hg status --terse madric | |
21 ? a | |
22 ? b | |
23 ? x/aa.o | |
24 ? x/bb.o | |
25 $ hg status --terse f | |
26 abort: 'f' not recognized | |
27 [255] | |
28 | |
29 Add a .hgignore so that we can also have ignored files | |
30 | |
31 $ echo ".*\.o" > .hgignore | |
32 $ hg status | |
33 ? .hgignore | |
34 ? a | |
35 ? b | |
36 $ hg status -i | |
37 I x/aa.o | |
38 I x/bb.o | |
39 | |
40 Tersing ignored files | |
41 $ hg status -t i --ignored | |
42 I x/ | |
43 | |
44 Adding more files | |
45 $ mkdir y | |
46 $ touch x/aa x/bb y/l y/m y/l.o y/m.o | |
47 $ touch x/l/aa x/m/aa x/n/aa x/l/u/bb x/l/u/a/bb | |
48 | |
49 $ hg status | |
50 ? .hgignore | |
51 ? a | |
52 ? b | |
53 ? x/aa | |
54 ? x/bb | |
55 ? x/l/aa | |
56 ? x/l/u/a/bb | |
57 ? x/l/u/bb | |
58 ? x/m/aa | |
59 ? x/n/aa | |
60 ? y/l | |
61 ? y/m | |
62 | |
63 $ hg status --terse u | |
64 ? .hgignore | |
65 ? a | |
66 ? b | |
67 ? x/ | |
68 ? y/ | |
69 | |
70 $ hg add x/aa x/bb .hgignore | |
71 $ hg status --terse au | |
72 A .hgignore | |
73 A x/aa | |
74 A x/bb | |
75 ? a | |
76 ? b | |
77 ? x/l/ | |
78 ? x/m/ | |
79 ? x/n/ | |
80 ? y/ | |
81 | |
82 Including ignored files | |
83 | |
84 $ hg status --terse aui | |
85 A .hgignore | |
86 A x/aa | |
87 A x/bb | |
88 ? a | |
89 ? b | |
90 ? x/l/ | |
91 ? x/m/ | |
92 ? x/n/ | |
93 ? y/l | |
94 ? y/m | |
95 $ hg status --terse au -i | |
96 I x/aa.o | |
97 I x/bb.o | |
98 I y/l.o | |
99 I y/m.o | |
100 | |
101 Committing some of the files | |
102 | |
103 $ hg commit x/aa x/bb .hgignore -m "First commit" | |
104 $ hg status | |
105 ? a | |
106 ? b | |
107 ? x/l/aa | |
108 ? x/l/u/a/bb | |
109 ? x/l/u/bb | |
110 ? x/m/aa | |
111 ? x/n/aa | |
112 ? y/l | |
113 ? y/m | |
114 $ hg status --terse mardu | |
115 ? a | |
116 ? b | |
117 ? x/l/ | |
118 ? x/m/ | |
119 ? x/n/ | |
120 ? y/ | |
121 | |
122 Modifying already committed files | |
123 | |
124 $ echo "Hello" >> x/aa | |
125 $ echo "World" >> x/bb | |
126 $ hg status --terse maurdc | |
127 M x/aa | |
128 M x/bb | |
129 ? a | |
130 ? b | |
131 ? x/l/ | |
132 ? x/m/ | |
133 ? x/n/ | |
134 ? y/ | |
135 | |
136 Respecting other flags | |
137 | |
138 $ hg status --terse marduic --all | |
139 M x/aa | |
140 M x/bb | |
141 ? a | |
142 ? b | |
143 ? x/l/ | |
144 ? x/m/ | |
145 ? x/n/ | |
146 ? y/l | |
147 ? y/m | |
148 I x/aa.o | |
149 I x/bb.o | |
150 I y/l.o | |
151 I y/m.o | |
152 C .hgignore | |
153 $ hg status --terse marduic -a | |
154 $ hg status --terse marduic -c | |
155 C .hgignore | |
156 $ hg status --terse marduic -m | |
157 M x/aa | |
158 M x/bb | |
159 | |
160 Passing 'i' in terse value will consider the ignored files while tersing | |
161 | |
162 $ hg status --terse marduic -u | |
163 ? a | |
164 ? b | |
165 ? x/l/ | |
166 ? x/m/ | |
167 ? x/n/ | |
168 ? y/l | |
169 ? y/m | |
170 | |
171 Omitting 'i' in terse value does not consider ignored files while tersing | |
172 | |
173 $ hg status --terse marduc -u | |
174 ? a | |
175 ? b | |
176 ? x/l/ | |
177 ? x/m/ | |
178 ? x/n/ | |
179 ? y/ | |
180 | |
181 Trying with --rev | |
182 | |
183 $ hg status --terse marduic --rev 0 --rev 1 | |
184 abort: cannot use --terse with --rev | |
185 [255] |