Mercurial > hg
comparison tests/test-revert.t @ 12106:969176bec217
tests: unify test-revert
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Mon, 30 Aug 2010 13:32:37 +0900 |
parents | tests/test-revert@81e20e01d465 |
children | 4c94b6d0fb1c |
comparison
equal
deleted
inserted
replaced
12105:6f58430dfdd0 | 12106:969176bec217 |
---|---|
1 $ hg init repo | |
2 $ cd repo | |
3 $ echo 123 > a | |
4 $ echo 123 > c | |
5 $ echo 123 > e | |
6 $ hg add a c e | |
7 $ hg commit -m "first" -d "1000000 0" a c e | |
8 $ echo 123 > b | |
9 | |
10 should show b unknown | |
11 | |
12 $ hg status | |
13 ? b | |
14 $ echo 12 > c | |
15 | |
16 should show b unknown and c modified | |
17 | |
18 $ hg status | |
19 M c | |
20 ? b | |
21 $ hg add b | |
22 | |
23 should show b added and c modified | |
24 | |
25 $ hg status | |
26 M c | |
27 A b | |
28 $ hg rm a | |
29 | |
30 should show a removed, b added and c modified | |
31 | |
32 $ hg status | |
33 M c | |
34 A b | |
35 R a | |
36 $ hg revert a | |
37 | |
38 should show b added, copy saved, and c modified | |
39 | |
40 $ hg status | |
41 M c | |
42 A b | |
43 $ hg revert b | |
44 | |
45 should show b unknown, and c modified | |
46 | |
47 $ hg status | |
48 M c | |
49 ? b | |
50 $ hg revert --no-backup c | |
51 | |
52 should show unknown: b | |
53 | |
54 $ hg status | |
55 ? b | |
56 $ hg add b | |
57 | |
58 should show b added | |
59 | |
60 $ hg status b | |
61 A b | |
62 $ rm b | |
63 | |
64 should show b deleted | |
65 | |
66 $ hg status b | |
67 ! b | |
68 $ hg revert -v b | |
69 forgetting b | |
70 | |
71 should not find b | |
72 | |
73 $ hg status b | |
74 b: No such file or directory | |
75 | |
76 should show a c e | |
77 | |
78 $ ls | |
79 a | |
80 c | |
81 e | |
82 | |
83 should verbosely save backup to e.orig | |
84 | |
85 $ echo z > e | |
86 $ hg revert --all -v | |
87 saving current version of e as e.orig | |
88 reverting e | |
89 | |
90 should say no changes needed | |
91 | |
92 $ hg revert a | |
93 no changes needed to a | |
94 | |
95 should say file not managed | |
96 | |
97 $ echo q > q | |
98 $ hg revert q | |
99 file not managed: q | |
100 $ rm q | |
101 | |
102 should say file not found | |
103 | |
104 $ hg revert notfound | |
105 notfound: no such file in rev 095eacd0c0d7 | |
106 $ touch d | |
107 $ hg add d | |
108 $ hg rm a | |
109 $ hg commit -m "second" -d "1000000 0" | |
110 $ echo z > z | |
111 $ hg add z | |
112 $ hg st | |
113 A z | |
114 ? e.orig | |
115 | |
116 should add a, remove d, forget z | |
117 | |
118 $ hg revert --all -r0 | |
119 adding a | |
120 removing d | |
121 forgetting z | |
122 | |
123 should forget a, undelete d | |
124 | |
125 $ hg revert --all -rtip | |
126 forgetting a | |
127 undeleting d | |
128 $ rm a *.orig | |
129 | |
130 should silently add a | |
131 | |
132 $ hg revert -r0 a | |
133 $ hg st a | |
134 A a | |
135 $ hg rm d | |
136 $ hg st d | |
137 R d | |
138 | |
139 should silently keep d removed | |
140 | |
141 $ hg revert -r0 d | |
142 $ hg st d | |
143 R d | |
144 | |
145 $ hg update -C | |
146 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
147 $ chmod +x c | |
148 $ hg revert --all | |
149 reverting c | |
150 | |
151 should print non-executable | |
152 | |
153 $ test -x c || echo non-executable | |
154 non-executable | |
155 | |
156 $ chmod +x c | |
157 $ hg commit -d '1000001 0' -m exe | |
158 | |
159 $ chmod -x c | |
160 $ hg revert --all | |
161 reverting c | |
162 | |
163 should print executable | |
164 | |
165 $ test -x c && echo executable | |
166 executable | |
167 | |
168 $ cd .. | |
169 | |
170 | |
171 issue 241 | |
172 | |
173 $ hg init a | |
174 $ cd a | |
175 $ echo a >> a | |
176 $ hg commit -A -d '1 0' -m a | |
177 adding a | |
178 $ echo a >> a | |
179 $ hg commit -d '2 0' -m a | |
180 $ hg update 0 | |
181 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
182 $ mkdir b | |
183 $ echo b > b/b | |
184 | |
185 should fail - no arguments | |
186 | |
187 $ hg revert -rtip | |
188 abort: no files or directories specified; use --all to revert the whole repo | |
189 | |
190 should succeed | |
191 | |
192 $ hg revert --all -rtip | |
193 reverting a | |
194 | |
195 | |
196 issue332 | |
197 | |
198 $ hg ci -A -m b -d '1000001 0' | |
199 adding b/b | |
200 created new head | |
201 $ echo foobar > b/b | |
202 $ mkdir newdir | |
203 $ echo foo > newdir/newfile | |
204 $ hg add newdir/newfile | |
205 $ hg revert b newdir | |
206 reverting b/b | |
207 forgetting newdir/newfile | |
208 $ echo foobar > b/b | |
209 $ hg revert . | |
210 reverting b/b | |
211 | |
212 | |
213 reverting a rename target should revert the source | |
214 | |
215 $ hg mv a newa | |
216 $ hg revert newa | |
217 $ hg st a newa | |
218 ? newa | |
219 | |
220 $ cd .. | |
221 | |
222 $ hg init ignored | |
223 $ cd ignored | |
224 $ echo '^ignored$' > .hgignore | |
225 $ echo '^ignoreddir$' >> .hgignore | |
226 $ echo '^removed$' >> .hgignore | |
227 | |
228 $ mkdir ignoreddir | |
229 $ touch ignoreddir/file | |
230 $ touch ignoreddir/removed | |
231 $ touch ignored | |
232 $ touch removed | |
233 | |
234 4 ignored files (we will add/commit everything) | |
235 | |
236 $ hg st -A -X .hgignore | |
237 I ignored | |
238 I ignoreddir/file | |
239 I ignoreddir/removed | |
240 I removed | |
241 $ hg ci -qAm 'add files' ignored ignoreddir/file ignoreddir/removed removed | |
242 | |
243 $ echo >> ignored | |
244 $ echo >> ignoreddir/file | |
245 $ hg rm removed ignoreddir/removed | |
246 | |
247 should revert ignored* and undelete *removed | |
248 | |
249 $ hg revert -a --no-backup | |
250 reverting ignored | |
251 reverting ignoreddir/file | |
252 undeleting ignoreddir/removed | |
253 undeleting removed | |
254 $ hg st -mardi | |
255 | |
256 $ hg up -qC | |
257 $ echo >> ignored | |
258 $ hg rm removed | |
259 | |
260 should silently revert the named files | |
261 | |
262 $ hg revert --no-backup ignored removed | |
263 $ hg st -mardi |