##// END OF EJS Templates
tests: unify test-status-color
Nicolas Dumazet -
r11783:599a7803 default
parent child Browse files
Show More
@@ -1,122 +1,277 b''
1 #!/bin/sh
1 $ echo "[extensions]" >> $HGRCPATH
2 $ echo "color=" >> $HGRCPATH
3 $ echo "[color]" >> $HGRCPATH
4 $ echo "mode=ansi" >> $HGRCPATH
5
6 $ hg init repo1
7 $ cd repo1
8 $ mkdir a b a/1 b/1 b/2
9 $ touch in_root a/in_a b/in_b a/1/in_a_1 b/1/in_b_1 b/2/in_b_2
10
11 hg status in repo root:
2
12
3 echo "[extensions]" >> $HGRCPATH
13 $ hg status --color=always
4 echo "color=" >> $HGRCPATH
14 ? a/1/in_a_1
5 echo "[color]" >> $HGRCPATH
15 ? a/in_a
6 echo "mode=ansi" >> $HGRCPATH
16 ? b/1/in_b_1
17 ? b/2/in_b_2
18 ? b/in_b
19 ? in_root
20
21 hg status . in repo root:
22
23 $ hg status --color=always .
24 ? a/1/in_a_1
25 ? a/in_a
26 ? b/1/in_b_1
27 ? b/2/in_b_2
28 ? b/in_b
29 ? in_root
7
30
8 hg init repo1
31 $ hg status --color=always --cwd a
9 cd repo1
32 ? a/1/in_a_1
10 mkdir a b a/1 b/1 b/2
33 ? a/in_a
11 touch in_root a/in_a b/in_b a/1/in_a_1 b/1/in_b_1 b/2/in_b_2
34 ? b/1/in_b_1
12 echo "hg status in repo root:"
35 ? b/2/in_b_2
13 hg status --color=always
36 ? b/in_b
14 echo "hg status . in repo root:"
37 ? in_root
15 hg status --color=always .
38 $ hg status --color=always --cwd a .
16 for dir in a b a/1 b/1 b/2; do
39 ? 1/in_a_1
17 echo "hg status in $dir:"
40 ? in_a
18 hg status --color=always --cwd "$dir"
41 $ hg status --color=always --cwd a ..
19 echo "hg status . in $dir:"
42 ? 1/in_a_1
20 hg status --color=always --cwd "$dir" .
43 ? in_a
21 echo "hg status .. in $dir:"
44 ? ../b/1/in_b_1
22 hg status --color=always --cwd "$dir" ..
45 ? ../b/2/in_b_2
23 done
46 ? ../b/in_b
24 cd ..
47 ? ../in_root
48
49 $ hg status --color=always --cwd b
50 ? a/1/in_a_1
51 ? a/in_a
52 ? b/1/in_b_1
53 ? b/2/in_b_2
54 ? b/in_b
55 ? in_root
56 $ hg status --color=always --cwd b .
57 ? 1/in_b_1
58 ? 2/in_b_2
59 ? in_b
60 $ hg status --color=always --cwd b ..
61 ? ../a/1/in_a_1
62 ? ../a/in_a
63 ? 1/in_b_1
64 ? 2/in_b_2
65 ? in_b
66 ? ../in_root
67
68 $ hg status --color=always --cwd a/1
69 ? a/1/in_a_1
70 ? a/in_a
71 ? b/1/in_b_1
72 ? b/2/in_b_2
73 ? b/in_b
74 ? in_root
75 $ hg status --color=always --cwd a/1 .
76 ? in_a_1
77 $ hg status --color=always --cwd a/1 ..
78 ? in_a_1
79 ? ../in_a
25
80
26 hg init repo2
81 $ hg status --color=always --cwd b/1
27 cd repo2
82 ? a/1/in_a_1
28 touch modified removed deleted ignored
83 ? a/in_a
29 echo "^ignored$" > .hgignore
84 ? b/1/in_b_1
30 hg ci -A -m 'initial checkin' -d "1000000 0"
85 ? b/2/in_b_2
31 touch modified added unknown ignored
86 ? b/in_b
32 hg add added
87 ? in_root
33 hg remove removed
88 $ hg status --color=always --cwd b/1 .
34 rm deleted
89 ? in_b_1
35 echo "hg status:"
90 $ hg status --color=always --cwd b/1 ..
36 hg status --color=always
91 ? in_b_1
37 echo "hg status modified added removed deleted unknown never-existed ignored:"
92 ? ../2/in_b_2
38 hg status --color=always modified added removed deleted unknown never-existed ignored
93 ? ../in_b
39 hg copy modified copied
94
40 echo "hg status -C:"
95 $ hg status --color=always --cwd b/2
41 hg status --color=always -C
96 ? a/1/in_a_1
42 echo "hg status -A:"
97 ? a/in_a
43 hg status --color=always -A
98 ? b/1/in_b_1
44 echo "^ignoreddir$" > .hgignore
99 ? b/2/in_b_2
45 mkdir ignoreddir
100 ? b/in_b
46 touch ignoreddir/file
101 ? in_root
47 echo "hg status ignoreddir/file:"
102 $ hg status --color=always --cwd b/2 .
48 hg status --color=always ignoreddir/file
103 ? in_b_2
49 echo "hg status -i ignoreddir/file:"
104 $ hg status --color=always --cwd b/2 ..
50 hg status --color=always -i ignoreddir/file
105 ? ../1/in_b_1
51 cd ..
106 ? in_b_2
107 ? ../in_b
108 $ cd ..
109
110 $ hg init repo2
111 $ cd repo2
112 $ touch modified removed deleted ignored
113 $ echo "^ignored$" > .hgignore
114 $ hg ci -A -m 'initial checkin' -d "1000000 0"
115 adding .hgignore
116 adding deleted
117 adding modified
118 adding removed
119 $ touch modified added unknown ignored
120 $ hg add added
121 $ hg remove removed
122 $ rm deleted
123
124 hg status:
125
126 $ hg status --color=always
127 A added
128 R removed
129 ! deleted
130 ? unknown
131
132 hg status modified added removed deleted unknown never-existed ignored:
133
134 $ hg status --color=always modified added removed deleted unknown never-existed ignored
135 never-existed: No such file or directory
136 A added
137 R removed
138 ! deleted
139 ? unknown
140
141 $ hg copy modified copied
142
143 hg status -C:
144
145 $ hg status --color=always -C
146 A added
147 A copied
148  modified
149 R removed
150 ! deleted
151 ? unknown
152
153 hg status -A:
154
155 $ hg status --color=always -A
156 A added
157 A copied
158  modified
159 R removed
160 ! deleted
161 ? unknown
162 I ignored
163 C .hgignore
164 C modified
165
166
167 $ echo "^ignoreddir$" > .hgignore
168 $ mkdir ignoreddir
169 $ touch ignoreddir/file
170
171 hg status ignoreddir/file:
172
173 $ hg status --color=always ignoreddir/file
174
175 hg status -i ignoreddir/file:
176
177 $ hg status --color=always -i ignoreddir/file
178 I ignoreddir/file
179 $ cd ..
52
180
53 # check 'status -q' and some combinations
181 # check 'status -q' and some combinations
54 hg init repo3
55 cd repo3
56 touch modified removed deleted ignored
57 echo "^ignored$" > .hgignore
58 hg commit -A -m 'initial checkin'
59 touch added unknown ignored
60 hg add added
61 echo "test" >> modified
62 hg remove removed
63 rm deleted
64 hg copy modified copied
65
182
66 echo "% test unknown color"
183 $ hg init repo3
67 hg --config color.status.modified=periwinkle status --color=always
184 $ cd repo3
185 $ touch modified removed deleted ignored
186 $ echo "^ignored$" > .hgignore
187 $ hg commit -A -m 'initial checkin'
188 adding .hgignore
189 adding deleted
190 adding modified
191 adding removed
192 $ touch added unknown ignored
193 $ hg add added
194 $ echo "test" >> modified
195 $ hg remove removed
196 $ rm deleted
197 $ hg copy modified copied
198
199 test unknown color
200
201 $ hg --config color.status.modified=periwinkle status --color=always
202 ignoring unknown color/effect 'periwinkle' (configured in color.status.modified)
203 M modified
204 A added
205 A copied
206 R removed
207 ! deleted
208 ? unknown
68
209
69 # Run status with 2 different flags.
210 # Run status with 2 different flags.
70 # Check if result is the same or different.
211 # Check if result is the same or different.
71 # If result is not as expected, raise error
212 # If result is not as expected, raise error
72 assert() {
213 $ assert() {
73 hg status --color=always $1 > ../a
214 > hg status --color=always $1 > ../a
74 hg status --color=always $2 > ../b
215 > hg status --color=always $2 > ../b
75 out=`diff ../a ../b`
216 > out=`diff ../a ../b`
76 if [ $? -ne 0 ]; then
217 > if [ $? -ne 0 ]; then
77 out=1
218 > out=1
78 else
219 > else
79 out=0
220 > out=0
80 fi
221 > fi
81 if [ $3 -eq 0 ]; then
222 > if [ $3 -eq 0 ]; then
82 df="same"
223 > df="same"
83 else
224 > else
84 df="different"
225 > df="different"
85 fi
226 > fi
86 if [ $out -ne $3 ]; then
227 > if [ $out -ne $3 ]; then
87 echo "Error on $1 and $2, should be $df."
228 > echo "Error on $1 and $2, should be $df."
88 fi
229 > fi
89 }
230 > }
90
231
91 # assert flag1 flag2 [0-same | 1-different]
232 # assert flag1 flag2 [0-same | 1-different]
92 assert "-q" "-mard" 0
93 assert "-A" "-marduicC" 0
94 assert "-qA" "-mardcC" 0
95 assert "-qAui" "-A" 0
96 assert "-qAu" "-marducC" 0
97 assert "-qAi" "-mardicC" 0
98 assert "-qu" "-u" 0
99 assert "-q" "-u" 1
100 assert "-m" "-a" 1
101 assert "-r" "-d" 1
102
233
103 cd ..
234 $ assert "-q" "-mard" 0
235 $ assert "-A" "-marduicC" 0
236 $ assert "-qA" "-mardcC" 0
237 $ assert "-qAui" "-A" 0
238 $ assert "-qAu" "-marducC" 0
239 $ assert "-qAi" "-mardicC" 0
240 $ assert "-qu" "-u" 0
241 $ assert "-q" "-u" 1
242 $ assert "-m" "-a" 1
243 $ assert "-r" "-d" 1
244 $ cd ..
104
245
105 # test 'resolve -l'
246 # test 'resolve -l'
106 hg init repo4
247 $ hg init repo4
107 cd repo4
248 $ cd repo4
108 echo "file a" > a
249 $ echo "file a" > a
109 echo "file b" > b
250 $ echo "file b" > b
110 hg add a b
251 $ hg add a b
111 hg commit -m "initial"
252 $ hg commit -m "initial"
112 echo "file a change 1" > a
253 $ echo "file a change 1" > a
113 echo "file b change 1" > b
254 $ echo "file b change 1" > b
114 hg commit -m "head 1"
255 $ hg commit -m "head 1"
115 hg update 0
256 $ hg update 0
116 echo "file a change 2" > a
257 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
117 echo "file b change 2" > b
258 $ echo "file a change 2" > a
118 hg commit -m "head 2"
259 $ echo "file b change 2" > b
119 hg merge
260 $ hg commit -m "head 2"
120 hg resolve -m b
261 created new head
121 echo "hg resolve with one unresolved, one resolved:"
262 $ hg merge
122 hg resolve --color=always -l
263 merging a
264 warning: conflicts during merge.
265 merging a failed!
266 merging b
267 warning: conflicts during merge.
268 merging b failed!
269 0 files updated, 0 files merged, 0 files removed, 2 files unresolved
270 use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon
271 $ hg resolve -m b
272
273 hg resolve with one unresolved, one resolved:
274
275 $ hg resolve --color=always -l
276 U a
277 R b
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now