Show More
@@ -1,870 +1,933 b'' | |||||
1 | $ hg init repo |
|
1 | $ hg init repo | |
2 | $ cd repo |
|
2 | $ cd repo | |
3 | $ echo 123 > a |
|
3 | $ echo 123 > a | |
4 | $ echo 123 > c |
|
4 | $ echo 123 > c | |
5 | $ echo 123 > e |
|
5 | $ echo 123 > e | |
6 | $ hg add a c e |
|
6 | $ hg add a c e | |
7 | $ hg commit -m "first" a c e |
|
7 | $ hg commit -m "first" a c e | |
8 |
|
8 | |||
9 | nothing changed |
|
9 | nothing changed | |
10 |
|
10 | |||
11 | $ hg revert |
|
11 | $ hg revert | |
12 | abort: no files or directories specified |
|
12 | abort: no files or directories specified | |
13 | (use --all to revert all files) |
|
13 | (use --all to revert all files) | |
14 | [255] |
|
14 | [255] | |
15 | $ hg revert --all |
|
15 | $ hg revert --all | |
16 |
|
16 | |||
17 | Introduce some changes and revert them |
|
17 | Introduce some changes and revert them | |
18 | -------------------------------------- |
|
18 | -------------------------------------- | |
19 |
|
19 | |||
20 | $ echo 123 > b |
|
20 | $ echo 123 > b | |
21 |
|
21 | |||
22 | $ hg status |
|
22 | $ hg status | |
23 | ? b |
|
23 | ? b | |
24 | $ echo 12 > c |
|
24 | $ echo 12 > c | |
25 |
|
25 | |||
26 | $ hg status |
|
26 | $ hg status | |
27 | M c |
|
27 | M c | |
28 | ? b |
|
28 | ? b | |
29 | $ hg add b |
|
29 | $ hg add b | |
30 |
|
30 | |||
31 | $ hg status |
|
31 | $ hg status | |
32 | M c |
|
32 | M c | |
33 | A b |
|
33 | A b | |
34 | $ hg rm a |
|
34 | $ hg rm a | |
35 |
|
35 | |||
36 | $ hg status |
|
36 | $ hg status | |
37 | M c |
|
37 | M c | |
38 | A b |
|
38 | A b | |
39 | R a |
|
39 | R a | |
40 |
|
40 | |||
41 | revert removal of a file |
|
41 | revert removal of a file | |
42 |
|
42 | |||
43 | $ hg revert a |
|
43 | $ hg revert a | |
44 | $ hg status |
|
44 | $ hg status | |
45 | M c |
|
45 | M c | |
46 | A b |
|
46 | A b | |
47 |
|
47 | |||
48 | revert addition of a file |
|
48 | revert addition of a file | |
49 |
|
49 | |||
50 | $ hg revert b |
|
50 | $ hg revert b | |
51 | $ hg status |
|
51 | $ hg status | |
52 | M c |
|
52 | M c | |
53 | ? b |
|
53 | ? b | |
54 |
|
54 | |||
55 | revert modification of a file (--no-backup) |
|
55 | revert modification of a file (--no-backup) | |
56 |
|
56 | |||
57 | $ hg revert --no-backup c |
|
57 | $ hg revert --no-backup c | |
58 | $ hg status |
|
58 | $ hg status | |
59 | ? b |
|
59 | ? b | |
60 |
|
60 | |||
61 | revert deletion (! status) of a added file |
|
61 | revert deletion (! status) of a added file | |
62 | ------------------------------------------ |
|
62 | ------------------------------------------ | |
63 |
|
63 | |||
64 | $ hg add b |
|
64 | $ hg add b | |
65 |
|
65 | |||
66 | $ hg status b |
|
66 | $ hg status b | |
67 | A b |
|
67 | A b | |
68 | $ rm b |
|
68 | $ rm b | |
69 | $ hg status b |
|
69 | $ hg status b | |
70 | ! b |
|
70 | ! b | |
71 | $ hg revert -v b |
|
71 | $ hg revert -v b | |
72 | forgetting b |
|
72 | forgetting b | |
73 | $ hg status b |
|
73 | $ hg status b | |
74 | b: * (glob) |
|
74 | b: * (glob) | |
75 |
|
75 | |||
76 | $ ls |
|
76 | $ ls | |
77 | a |
|
77 | a | |
78 | c |
|
78 | c | |
79 | e |
|
79 | e | |
80 |
|
80 | |||
81 | Test creation of backup (.orig) files |
|
81 | Test creation of backup (.orig) files | |
82 | ------------------------------------- |
|
82 | ------------------------------------- | |
83 |
|
83 | |||
84 | $ echo z > e |
|
84 | $ echo z > e | |
85 | $ hg revert --all -v |
|
85 | $ hg revert --all -v | |
86 | saving current version of e as e.orig |
|
86 | saving current version of e as e.orig | |
87 | reverting e |
|
87 | reverting e | |
88 |
|
88 | |||
89 | revert on clean file (no change) |
|
89 | revert on clean file (no change) | |
90 | -------------------------------- |
|
90 | -------------------------------- | |
91 |
|
91 | |||
92 | $ hg revert a |
|
92 | $ hg revert a | |
93 | no changes needed to a |
|
93 | no changes needed to a | |
94 |
|
94 | |||
95 | revert on an untracked file |
|
95 | revert on an untracked file | |
96 | --------------------------- |
|
96 | --------------------------- | |
97 |
|
97 | |||
98 | $ echo q > q |
|
98 | $ echo q > q | |
99 | $ hg revert q |
|
99 | $ hg revert q | |
100 | file not managed: q |
|
100 | file not managed: q | |
101 | $ rm q |
|
101 | $ rm q | |
102 |
|
102 | |||
103 | revert on file that does not exists |
|
103 | revert on file that does not exists | |
104 | ----------------------------------- |
|
104 | ----------------------------------- | |
105 |
|
105 | |||
106 | $ hg revert notfound |
|
106 | $ hg revert notfound | |
107 | notfound: no such file in rev 334a9e57682c |
|
107 | notfound: no such file in rev 334a9e57682c | |
108 | $ touch d |
|
108 | $ touch d | |
109 | $ hg add d |
|
109 | $ hg add d | |
110 | $ hg rm a |
|
110 | $ hg rm a | |
111 | $ hg commit -m "second" |
|
111 | $ hg commit -m "second" | |
112 | $ echo z > z |
|
112 | $ echo z > z | |
113 | $ hg add z |
|
113 | $ hg add z | |
114 | $ hg st |
|
114 | $ hg st | |
115 | A z |
|
115 | A z | |
116 | ? e.orig |
|
116 | ? e.orig | |
117 |
|
117 | |||
118 | revert to another revision (--rev) |
|
118 | revert to another revision (--rev) | |
119 | ---------------------------------- |
|
119 | ---------------------------------- | |
120 |
|
120 | |||
121 | $ hg revert --all -r0 |
|
121 | $ hg revert --all -r0 | |
122 | adding a |
|
122 | adding a | |
123 | removing d |
|
123 | removing d | |
124 | forgetting z |
|
124 | forgetting z | |
125 |
|
125 | |||
126 | revert explicitly to parent (--rev) |
|
126 | revert explicitly to parent (--rev) | |
127 | ----------------------------------- |
|
127 | ----------------------------------- | |
128 |
|
128 | |||
129 | $ hg revert --all -rtip |
|
129 | $ hg revert --all -rtip | |
130 | forgetting a |
|
130 | forgetting a | |
131 | undeleting d |
|
131 | undeleting d | |
132 | $ rm a *.orig |
|
132 | $ rm a *.orig | |
133 |
|
133 | |||
134 | revert to another revision (--rev) and exact match |
|
134 | revert to another revision (--rev) and exact match | |
135 | -------------------------------------------------- |
|
135 | -------------------------------------------------- | |
136 |
|
136 | |||
137 | exact match are more silent |
|
137 | exact match are more silent | |
138 |
|
138 | |||
139 | $ hg revert -r0 a |
|
139 | $ hg revert -r0 a | |
140 | $ hg st a |
|
140 | $ hg st a | |
141 | A a |
|
141 | A a | |
142 | $ hg rm d |
|
142 | $ hg rm d | |
143 | $ hg st d |
|
143 | $ hg st d | |
144 | R d |
|
144 | R d | |
145 |
|
145 | |||
146 | should silently keep d removed |
|
146 | should silently keep d removed | |
147 |
|
147 | |||
148 | $ hg revert -r0 d |
|
148 | $ hg revert -r0 d | |
149 | $ hg st d |
|
149 | $ hg st d | |
150 | R d |
|
150 | R d | |
151 |
|
151 | |||
152 | $ hg update -C |
|
152 | $ hg update -C | |
153 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
153 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
154 |
|
154 | |||
155 | revert of exec bit |
|
155 | revert of exec bit | |
156 | ------------------ |
|
156 | ------------------ | |
157 |
|
157 | |||
158 | #if execbit |
|
158 | #if execbit | |
159 | $ chmod +x c |
|
159 | $ chmod +x c | |
160 | $ hg revert --all |
|
160 | $ hg revert --all | |
161 | reverting c |
|
161 | reverting c | |
162 |
|
162 | |||
163 | $ test -x c || echo non-executable |
|
163 | $ test -x c || echo non-executable | |
164 | non-executable |
|
164 | non-executable | |
165 |
|
165 | |||
166 | $ chmod +x c |
|
166 | $ chmod +x c | |
167 | $ hg commit -m exe |
|
167 | $ hg commit -m exe | |
168 |
|
168 | |||
169 | $ chmod -x c |
|
169 | $ chmod -x c | |
170 | $ hg revert --all |
|
170 | $ hg revert --all | |
171 | reverting c |
|
171 | reverting c | |
172 |
|
172 | |||
173 | $ test -x c && echo executable |
|
173 | $ test -x c && echo executable | |
174 | executable |
|
174 | executable | |
175 | #endif |
|
175 | #endif | |
176 |
|
176 | |||
177 | $ cd .. |
|
177 | $ cd .. | |
178 |
|
178 | |||
179 |
|
179 | |||
180 | Issue241: update and revert produces inconsistent repositories |
|
180 | Issue241: update and revert produces inconsistent repositories | |
181 | -------------------------------------------------------------- |
|
181 | -------------------------------------------------------------- | |
182 |
|
182 | |||
183 | $ hg init a |
|
183 | $ hg init a | |
184 | $ cd a |
|
184 | $ cd a | |
185 | $ echo a >> a |
|
185 | $ echo a >> a | |
186 | $ hg commit -A -d '1 0' -m a |
|
186 | $ hg commit -A -d '1 0' -m a | |
187 | adding a |
|
187 | adding a | |
188 | $ echo a >> a |
|
188 | $ echo a >> a | |
189 | $ hg commit -d '2 0' -m a |
|
189 | $ hg commit -d '2 0' -m a | |
190 | $ hg update 0 |
|
190 | $ hg update 0 | |
191 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
191 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
192 | $ mkdir b |
|
192 | $ mkdir b | |
193 | $ echo b > b/b |
|
193 | $ echo b > b/b | |
194 |
|
194 | |||
195 | call `hg revert` with no file specified |
|
195 | call `hg revert` with no file specified | |
196 | --------------------------------------- |
|
196 | --------------------------------------- | |
197 |
|
197 | |||
198 | $ hg revert -rtip |
|
198 | $ hg revert -rtip | |
199 | abort: no files or directories specified |
|
199 | abort: no files or directories specified | |
200 | (use --all to revert all files, or 'hg update 1' to update) |
|
200 | (use --all to revert all files, or 'hg update 1' to update) | |
201 | [255] |
|
201 | [255] | |
202 |
|
202 | |||
203 | call `hg revert` with --all |
|
203 | call `hg revert` with --all | |
204 | --------------------------- |
|
204 | --------------------------- | |
205 |
|
205 | |||
206 | $ hg revert --all -rtip |
|
206 | $ hg revert --all -rtip | |
207 | reverting a |
|
207 | reverting a | |
208 |
|
208 | |||
209 |
|
209 | |||
210 | Issue332: confusing message when reverting directory |
|
210 | Issue332: confusing message when reverting directory | |
211 | ---------------------------------------------------- |
|
211 | ---------------------------------------------------- | |
212 |
|
212 | |||
213 | $ hg ci -A -m b |
|
213 | $ hg ci -A -m b | |
214 | adding b/b |
|
214 | adding b/b | |
215 | created new head |
|
215 | created new head | |
216 | $ echo foobar > b/b |
|
216 | $ echo foobar > b/b | |
217 | $ mkdir newdir |
|
217 | $ mkdir newdir | |
218 | $ echo foo > newdir/newfile |
|
218 | $ echo foo > newdir/newfile | |
219 | $ hg add newdir/newfile |
|
219 | $ hg add newdir/newfile | |
220 | $ hg revert b newdir |
|
220 | $ hg revert b newdir | |
221 | reverting b/b (glob) |
|
221 | reverting b/b (glob) | |
222 | forgetting newdir/newfile (glob) |
|
222 | forgetting newdir/newfile (glob) | |
223 | $ echo foobar > b/b |
|
223 | $ echo foobar > b/b | |
224 | $ hg revert . |
|
224 | $ hg revert . | |
225 | reverting b/b (glob) |
|
225 | reverting b/b (glob) | |
226 |
|
226 | |||
227 |
|
227 | |||
228 | reverting a rename target should revert the source |
|
228 | reverting a rename target should revert the source | |
229 | -------------------------------------------------- |
|
229 | -------------------------------------------------- | |
230 |
|
230 | |||
231 | $ hg mv a newa |
|
231 | $ hg mv a newa | |
232 | $ hg revert newa |
|
232 | $ hg revert newa | |
233 | $ hg st a newa |
|
233 | $ hg st a newa | |
234 | ? newa |
|
234 | ? newa | |
235 |
|
235 | |||
236 | $ cd .. |
|
236 | $ cd .. | |
237 |
|
237 | |||
238 | $ hg init ignored |
|
238 | $ hg init ignored | |
239 | $ cd ignored |
|
239 | $ cd ignored | |
240 | $ echo '^ignored$' > .hgignore |
|
240 | $ echo '^ignored$' > .hgignore | |
241 | $ echo '^ignoreddir$' >> .hgignore |
|
241 | $ echo '^ignoreddir$' >> .hgignore | |
242 | $ echo '^removed$' >> .hgignore |
|
242 | $ echo '^removed$' >> .hgignore | |
243 |
|
243 | |||
244 | $ mkdir ignoreddir |
|
244 | $ mkdir ignoreddir | |
245 | $ touch ignoreddir/file |
|
245 | $ touch ignoreddir/file | |
246 | $ touch ignoreddir/removed |
|
246 | $ touch ignoreddir/removed | |
247 | $ touch ignored |
|
247 | $ touch ignored | |
248 | $ touch removed |
|
248 | $ touch removed | |
249 |
|
249 | |||
250 | 4 ignored files (we will add/commit everything) |
|
250 | 4 ignored files (we will add/commit everything) | |
251 |
|
251 | |||
252 | $ hg st -A -X .hgignore |
|
252 | $ hg st -A -X .hgignore | |
253 | I ignored |
|
253 | I ignored | |
254 | I ignoreddir/file |
|
254 | I ignoreddir/file | |
255 | I ignoreddir/removed |
|
255 | I ignoreddir/removed | |
256 | I removed |
|
256 | I removed | |
257 | $ hg ci -qAm 'add files' ignored ignoreddir/file ignoreddir/removed removed |
|
257 | $ hg ci -qAm 'add files' ignored ignoreddir/file ignoreddir/removed removed | |
258 |
|
258 | |||
259 | $ echo >> ignored |
|
259 | $ echo >> ignored | |
260 | $ echo >> ignoreddir/file |
|
260 | $ echo >> ignoreddir/file | |
261 | $ hg rm removed ignoreddir/removed |
|
261 | $ hg rm removed ignoreddir/removed | |
262 |
|
262 | |||
263 | should revert ignored* and undelete *removed |
|
263 | should revert ignored* and undelete *removed | |
264 | -------------------------------------------- |
|
264 | -------------------------------------------- | |
265 |
|
265 | |||
266 | $ hg revert -a --no-backup |
|
266 | $ hg revert -a --no-backup | |
267 | reverting ignored |
|
267 | reverting ignored | |
268 | reverting ignoreddir/file (glob) |
|
268 | reverting ignoreddir/file (glob) | |
269 | undeleting ignoreddir/removed (glob) |
|
269 | undeleting ignoreddir/removed (glob) | |
270 | undeleting removed |
|
270 | undeleting removed | |
271 | $ hg st -mardi |
|
271 | $ hg st -mardi | |
272 |
|
272 | |||
273 | $ hg up -qC |
|
273 | $ hg up -qC | |
274 | $ echo >> ignored |
|
274 | $ echo >> ignored | |
275 | $ hg rm removed |
|
275 | $ hg rm removed | |
276 |
|
276 | |||
277 | should silently revert the named files |
|
277 | should silently revert the named files | |
278 | -------------------------------------- |
|
278 | -------------------------------------- | |
279 |
|
279 | |||
280 | $ hg revert --no-backup ignored removed |
|
280 | $ hg revert --no-backup ignored removed | |
281 | $ hg st -mardi |
|
281 | $ hg st -mardi | |
282 |
|
282 | |||
283 | Reverting copy (issue3920) |
|
283 | Reverting copy (issue3920) | |
284 | -------------------------- |
|
284 | -------------------------- | |
285 |
|
285 | |||
286 | someone set up us the copies |
|
286 | someone set up us the copies | |
287 |
|
287 | |||
288 | $ rm .hgignore |
|
288 | $ rm .hgignore | |
289 | $ hg update -C |
|
289 | $ hg update -C | |
290 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
290 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
291 | $ hg mv ignored allyour |
|
291 | $ hg mv ignored allyour | |
292 | $ hg copy removed base |
|
292 | $ hg copy removed base | |
293 | $ hg commit -m rename |
|
293 | $ hg commit -m rename | |
294 |
|
294 | |||
295 | copies and renames, you have no chance to survive make your time (issue3920) |
|
295 | copies and renames, you have no chance to survive make your time (issue3920) | |
296 |
|
296 | |||
297 | $ hg update '.^' |
|
297 | $ hg update '.^' | |
298 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
298 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
299 | $ hg revert -rtip -a |
|
299 | $ hg revert -rtip -a | |
300 | adding allyour |
|
300 | adding allyour | |
301 | adding base |
|
301 | adding base | |
302 | removing ignored |
|
302 | removing ignored | |
303 | $ hg status -C |
|
303 | $ hg status -C | |
304 | A allyour |
|
304 | A allyour | |
305 | ignored |
|
305 | ignored | |
306 | A base |
|
306 | A base | |
307 | removed |
|
307 | removed | |
308 | R ignored |
|
308 | R ignored | |
309 |
|
309 | |||
310 | Test revert of a file added by one side of the merge |
|
310 | Test revert of a file added by one side of the merge | |
311 | ==================================================== |
|
311 | ==================================================== | |
312 |
|
312 | |||
313 | remove any pending change |
|
313 | remove any pending change | |
314 |
|
314 | |||
315 | $ hg revert --all |
|
315 | $ hg revert --all | |
316 | forgetting allyour |
|
316 | forgetting allyour | |
317 | forgetting base |
|
317 | forgetting base | |
318 | undeleting ignored |
|
318 | undeleting ignored | |
319 | $ hg purge --all --config extensions.purge= |
|
319 | $ hg purge --all --config extensions.purge= | |
320 |
|
320 | |||
321 | Adds a new commit |
|
321 | Adds a new commit | |
322 |
|
322 | |||
323 | $ echo foo > newadd |
|
323 | $ echo foo > newadd | |
324 | $ hg add newadd |
|
324 | $ hg add newadd | |
325 | $ hg commit -m 'other adds' |
|
325 | $ hg commit -m 'other adds' | |
326 | created new head |
|
326 | created new head | |
327 |
|
327 | |||
328 |
|
328 | |||
329 | merge it with the other head |
|
329 | merge it with the other head | |
330 |
|
330 | |||
331 | $ hg merge # merge 1 into 2 |
|
331 | $ hg merge # merge 1 into 2 | |
332 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
332 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
333 | (branch merge, don't forget to commit) |
|
333 | (branch merge, don't forget to commit) | |
334 | $ hg summary |
|
334 | $ hg summary | |
335 | parent: 2:b8ec310b2d4e tip |
|
335 | parent: 2:b8ec310b2d4e tip | |
336 | other adds |
|
336 | other adds | |
337 | parent: 1:f6180deb8fbe |
|
337 | parent: 1:f6180deb8fbe | |
338 | rename |
|
338 | rename | |
339 | branch: default |
|
339 | branch: default | |
340 | commit: 2 modified, 1 removed (merge) |
|
340 | commit: 2 modified, 1 removed (merge) | |
341 | update: (current) |
|
341 | update: (current) | |
342 |
|
342 | |||
343 | clarifies who added what |
|
343 | clarifies who added what | |
344 |
|
344 | |||
345 | $ hg status |
|
345 | $ hg status | |
346 | M allyour |
|
346 | M allyour | |
347 | M base |
|
347 | M base | |
348 | R ignored |
|
348 | R ignored | |
349 | $ hg status --change 'p1()' |
|
349 | $ hg status --change 'p1()' | |
350 | A newadd |
|
350 | A newadd | |
351 | $ hg status --change 'p2()' |
|
351 | $ hg status --change 'p2()' | |
352 | A allyour |
|
352 | A allyour | |
353 | A base |
|
353 | A base | |
354 | R ignored |
|
354 | R ignored | |
355 |
|
355 | |||
356 | revert file added by p1() to p1() state |
|
356 | revert file added by p1() to p1() state | |
357 | ----------------------------------------- |
|
357 | ----------------------------------------- | |
358 |
|
358 | |||
359 | $ hg revert -r 'p1()' 'glob:newad?' |
|
359 | $ hg revert -r 'p1()' 'glob:newad?' | |
360 | $ hg status |
|
360 | $ hg status | |
361 | M allyour |
|
361 | M allyour | |
362 | M base |
|
362 | M base | |
363 | R ignored |
|
363 | R ignored | |
364 |
|
364 | |||
365 | revert file added by p1() to p2() state |
|
365 | revert file added by p1() to p2() state | |
366 | ------------------------------------------ |
|
366 | ------------------------------------------ | |
367 |
|
367 | |||
368 | $ hg revert -r 'p2()' 'glob:newad?' |
|
368 | $ hg revert -r 'p2()' 'glob:newad?' | |
369 | removing newadd |
|
369 | removing newadd | |
370 | $ hg status |
|
370 | $ hg status | |
371 | M allyour |
|
371 | M allyour | |
372 | M base |
|
372 | M base | |
373 | R ignored |
|
373 | R ignored | |
374 | R newadd |
|
374 | R newadd | |
375 |
|
375 | |||
376 | revert file added by p2() to p2() state |
|
376 | revert file added by p2() to p2() state | |
377 | ------------------------------------------ |
|
377 | ------------------------------------------ | |
378 |
|
378 | |||
379 | $ hg revert -r 'p2()' 'glob:allyou?' |
|
379 | $ hg revert -r 'p2()' 'glob:allyou?' | |
380 | $ hg status |
|
380 | $ hg status | |
381 | M allyour |
|
381 | M allyour | |
382 | M base |
|
382 | M base | |
383 | R ignored |
|
383 | R ignored | |
384 | R newadd |
|
384 | R newadd | |
385 |
|
385 | |||
386 | revert file added by p2() to p1() state |
|
386 | revert file added by p2() to p1() state | |
387 | ------------------------------------------ |
|
387 | ------------------------------------------ | |
388 |
|
388 | |||
389 | $ hg revert -r 'p1()' 'glob:allyou?' |
|
389 | $ hg revert -r 'p1()' 'glob:allyou?' | |
390 | removing allyour |
|
390 | removing allyour | |
391 | $ hg status |
|
391 | $ hg status | |
392 | M base |
|
392 | M base | |
393 | R allyour |
|
393 | R allyour | |
394 | R ignored |
|
394 | R ignored | |
395 | R newadd |
|
395 | R newadd | |
396 |
|
396 | |||
397 | Systematic behavior validation of most possible cases |
|
397 | Systematic behavior validation of most possible cases | |
398 | ===================================================== |
|
398 | ===================================================== | |
399 |
|
399 | |||
400 | This section tests most of the possible combinations of working directory |
|
400 | This section tests most of the possible combinations of working directory | |
401 | changes and inter-revision changes. The number of possible cases is significant |
|
401 | changes and inter-revision changes. The number of possible cases is significant | |
402 | but they all have a slighly different handling. So this section commits to |
|
402 | but they all have a slighly different handling. So this section commits to | |
403 | generating and testing all of them to allow safe refactoring of the revert code. |
|
403 | generating and testing all of them to allow safe refactoring of the revert code. | |
404 |
|
404 | |||
405 | A python script is used to generate a file history for each combination of |
|
405 | A python script is used to generate a file history for each combination of | |
406 | changes between, on one side the working directory and its parent and on |
|
406 | changes between, on one side the working directory and its parent and on | |
407 | the other side, changes between a revert target (--rev) and working directory |
|
407 | the other side, changes between a revert target (--rev) and working directory | |
408 | parent. The three states generated are: |
|
408 | parent. The three states generated are: | |
409 |
|
409 | |||
410 | - a "base" revision |
|
410 | - a "base" revision | |
411 | - a "parent" revision |
|
411 | - a "parent" revision | |
412 | - the working directory (based on "parent") |
|
412 | - the working directory (based on "parent") | |
413 |
|
413 | |||
414 | The file generated have names of the form: |
|
414 | The file generated have names of the form: | |
415 |
|
415 | |||
416 | <changeset-state>_<working-copy-state> |
|
416 | <changeset-state>_<working-copy-state> | |
417 |
|
417 | |||
418 | Here, "changeset-state" conveys the state in "base" and "parent" (or the change |
|
418 | Here, "changeset-state" conveys the state in "base" and "parent" (or the change | |
419 | that happen between them), "working-copy-state" is self explanatory. |
|
419 | that happen between them), "working-copy-state" is self explanatory. | |
420 |
|
420 | |||
421 | All known states are not tested yet. See inline documentation for details. |
|
421 | All known states are not tested yet. See inline documentation for details. | |
422 | Special cases from merge and rename are not tested by this section. |
|
422 | Special cases from merge and rename are not tested by this section. | |
423 |
|
423 | |||
424 | There are also multiple cases where the current revert implementation is known to |
|
424 | There are also multiple cases where the current revert implementation is known to | |
425 | slightly misbehave. |
|
425 | slightly misbehave. | |
426 |
|
426 | |||
427 | Write the python script to disk |
|
427 | Write the python script to disk | |
428 | ------------------------------- |
|
428 | ------------------------------- | |
429 |
|
429 | |||
430 | $ cat << EOF > gen-revert-cases.py |
|
430 | $ cat << EOF > gen-revert-cases.py | |
431 | > # generate proper file state to test revert behavior |
|
431 | > # generate proper file state to test revert behavior | |
432 | > import sys |
|
432 | > import sys | |
433 | > import os |
|
433 | > import os | |
434 | > |
|
434 | > | |
435 | > # content of the file in "base" and "parent" |
|
435 | > # content of the file in "base" and "parent" | |
436 | > # None means no file at all |
|
436 | > # None means no file at all | |
437 | > ctxcontent = { |
|
437 | > ctxcontent = { | |
438 | > # clean: no change from base to parent |
|
438 | > # clean: no change from base to parent | |
439 | > 'clean': ['base', 'base'], |
|
439 | > 'clean': ['base', 'base'], | |
440 | > # modified: file content change from base to parent |
|
440 | > # modified: file content change from base to parent | |
441 | > 'modified': ['base', 'parent'], |
|
441 | > 'modified': ['base', 'parent'], | |
442 | > # added: file is missing from base and added in parent |
|
442 | > # added: file is missing from base and added in parent | |
443 | > 'added': [None, 'parent'], |
|
443 | > 'added': [None, 'parent'], | |
444 | > # removed: file exist in base but is removed from parent |
|
444 | > # removed: file exist in base but is removed from parent | |
445 | > 'removed': ['base', None], |
|
445 | > 'removed': ['base', None], | |
446 | > # file exist neither in base not in parent |
|
446 | > # file exist neither in base not in parent | |
447 | > 'missing': [None, None], |
|
447 | > 'missing': [None, None], | |
448 | > } |
|
448 | > } | |
449 | > |
|
449 | > | |
450 | > # content of file in working copy |
|
450 | > # content of file in working copy | |
451 | > wccontent = { |
|
451 | > wccontent = { | |
452 | > # clean: wc content is the same as parent |
|
452 | > # clean: wc content is the same as parent | |
453 | > 'clean': lambda cc: cc[1], |
|
453 | > 'clean': lambda cc: cc[1], | |
454 | > # revert: wc content is the same as base |
|
454 | > # revert: wc content is the same as base | |
455 | > 'revert': lambda cc: cc[0], |
|
455 | > 'revert': lambda cc: cc[0], | |
456 | > # wc: file exist with a content different from base and parent |
|
456 | > # wc: file exist with a content different from base and parent | |
457 | > 'wc': lambda cc: 'wc', |
|
457 | > 'wc': lambda cc: 'wc', | |
|
458 | > # removed: file is missing and marked as untracked | |||
|
459 | > 'removed': lambda cc: None, | |||
458 | > } |
|
460 | > } | |
459 | > |
|
461 | > | |
460 | > # build the combination of possible states |
|
462 | > # build the combination of possible states | |
461 | > combination = [] |
|
463 | > combination = [] | |
462 | > for ctxkey in ctxcontent: |
|
464 | > for ctxkey in ctxcontent: | |
463 | > for wckey in wccontent: |
|
465 | > for wckey in wccontent: | |
464 | > filename = "%s_%s" % (ctxkey, wckey) |
|
466 | > filename = "%s_%s" % (ctxkey, wckey) | |
465 | > combination.append((filename, ctxkey, wckey)) |
|
467 | > combination.append((filename, ctxkey, wckey)) | |
466 | > |
|
468 | > | |
467 | > # make sure we have stable output |
|
469 | > # make sure we have stable output | |
468 | > combination.sort() |
|
470 | > combination.sort() | |
469 | > |
|
471 | > | |
470 | > # retrieve the state we must generate |
|
472 | > # retrieve the state we must generate | |
471 | > target = sys.argv[1] |
|
473 | > target = sys.argv[1] | |
472 | > |
|
474 | > | |
473 | > # compute file content |
|
475 | > # compute file content | |
474 | > content = [] |
|
476 | > content = [] | |
475 | > for filename, ctxkey, wckey in combination: |
|
477 | > for filename, ctxkey, wckey in combination: | |
476 | > cc = ctxcontent[ctxkey] |
|
478 | > cc = ctxcontent[ctxkey] | |
477 | > if target == 'filelist': |
|
479 | > if target == 'filelist': | |
478 | > print filename |
|
480 | > print filename | |
479 | > elif target == 'base': |
|
481 | > elif target == 'base': | |
480 | > content.append((filename, cc[0])) |
|
482 | > content.append((filename, cc[0])) | |
481 | > elif target == 'parent': |
|
483 | > elif target == 'parent': | |
482 | > content.append((filename, cc[1])) |
|
484 | > content.append((filename, cc[1])) | |
483 | > elif target == 'wc': |
|
485 | > elif target == 'wc': | |
484 | > content.append((filename, wccontent[wckey](cc))) |
|
486 | > content.append((filename, wccontent[wckey](cc))) | |
485 | > else: |
|
487 | > else: | |
486 | > print >> sys.stderr, "unknown target:", target |
|
488 | > print >> sys.stderr, "unknown target:", target | |
487 | > sys.exit(1) |
|
489 | > sys.exit(1) | |
488 | > |
|
490 | > | |
489 | > # write actual content |
|
491 | > # write actual content | |
490 | > for filename, data in content: |
|
492 | > for filename, data in content: | |
491 | > if data is not None: |
|
493 | > if data is not None: | |
492 | > f = open(filename, 'w') |
|
494 | > f = open(filename, 'w') | |
493 | > f.write(data + '\n') |
|
495 | > f.write(data + '\n') | |
494 | > f.close() |
|
496 | > f.close() | |
495 | > elif os.path.exists(filename): |
|
497 | > elif os.path.exists(filename): | |
496 | > os.remove(filename) |
|
498 | > os.remove(filename) | |
497 | > EOF |
|
499 | > EOF | |
498 |
|
500 | |||
499 | check list of planned files |
|
501 | check list of planned files | |
500 |
|
502 | |||
501 | $ python gen-revert-cases.py filelist |
|
503 | $ python gen-revert-cases.py filelist | |
502 | added_clean |
|
504 | added_clean | |
|
505 | added_removed | |||
503 | added_revert |
|
506 | added_revert | |
504 | added_wc |
|
507 | added_wc | |
505 | clean_clean |
|
508 | clean_clean | |
|
509 | clean_removed | |||
506 | clean_revert |
|
510 | clean_revert | |
507 | clean_wc |
|
511 | clean_wc | |
508 | missing_clean |
|
512 | missing_clean | |
|
513 | missing_removed | |||
509 | missing_revert |
|
514 | missing_revert | |
510 | missing_wc |
|
515 | missing_wc | |
511 | modified_clean |
|
516 | modified_clean | |
|
517 | modified_removed | |||
512 | modified_revert |
|
518 | modified_revert | |
513 | modified_wc |
|
519 | modified_wc | |
514 | removed_clean |
|
520 | removed_clean | |
|
521 | removed_removed | |||
515 | removed_revert |
|
522 | removed_revert | |
516 | removed_wc |
|
523 | removed_wc | |
517 |
|
524 | |||
518 | Script to make a simple text version of the content |
|
525 | Script to make a simple text version of the content | |
519 | --------------------------------------------------- |
|
526 | --------------------------------------------------- | |
520 |
|
527 | |||
521 | $ cat << EOF >> dircontent.py |
|
528 | $ cat << EOF >> dircontent.py | |
522 | > # generate a simple text view of the directory for easy comparison |
|
529 | > # generate a simple text view of the directory for easy comparison | |
523 | > import os |
|
530 | > import os | |
524 | > files = os.listdir('.') |
|
531 | > files = os.listdir('.') | |
525 | > files.sort() |
|
532 | > files.sort() | |
526 | > for filename in files: |
|
533 | > for filename in files: | |
527 | > if os.path.isdir(filename): |
|
534 | > if os.path.isdir(filename): | |
528 | > continue |
|
535 | > continue | |
529 | > content = open(filename).read() |
|
536 | > content = open(filename).read() | |
530 | > print '%-6s %s' % (content.strip(), filename) |
|
537 | > print '%-6s %s' % (content.strip(), filename) | |
531 | > EOF |
|
538 | > EOF | |
532 |
|
539 | |||
533 | Generate appropriate repo state |
|
540 | Generate appropriate repo state | |
534 | ------------------------------- |
|
541 | ------------------------------- | |
535 |
|
542 | |||
536 | $ hg init revert-ref |
|
543 | $ hg init revert-ref | |
537 | $ cd revert-ref |
|
544 | $ cd revert-ref | |
538 |
|
545 | |||
539 | Generate base changeset |
|
546 | Generate base changeset | |
540 |
|
547 | |||
541 | $ python ../gen-revert-cases.py base |
|
548 | $ python ../gen-revert-cases.py base | |
542 | $ hg addremove --similarity 0 |
|
549 | $ hg addremove --similarity 0 | |
543 | adding clean_clean |
|
550 | adding clean_clean | |
|
551 | adding clean_removed | |||
544 | adding clean_revert |
|
552 | adding clean_revert | |
545 | adding clean_wc |
|
553 | adding clean_wc | |
546 | adding modified_clean |
|
554 | adding modified_clean | |
|
555 | adding modified_removed | |||
547 | adding modified_revert |
|
556 | adding modified_revert | |
548 | adding modified_wc |
|
557 | adding modified_wc | |
549 | adding removed_clean |
|
558 | adding removed_clean | |
|
559 | adding removed_removed | |||
550 | adding removed_revert |
|
560 | adding removed_revert | |
551 | adding removed_wc |
|
561 | adding removed_wc | |
552 | $ hg status |
|
562 | $ hg status | |
553 | A clean_clean |
|
563 | A clean_clean | |
|
564 | A clean_removed | |||
554 | A clean_revert |
|
565 | A clean_revert | |
555 | A clean_wc |
|
566 | A clean_wc | |
556 | A modified_clean |
|
567 | A modified_clean | |
|
568 | A modified_removed | |||
557 | A modified_revert |
|
569 | A modified_revert | |
558 | A modified_wc |
|
570 | A modified_wc | |
559 | A removed_clean |
|
571 | A removed_clean | |
|
572 | A removed_removed | |||
560 | A removed_revert |
|
573 | A removed_revert | |
561 | A removed_wc |
|
574 | A removed_wc | |
562 | $ hg commit -m 'base' |
|
575 | $ hg commit -m 'base' | |
563 |
|
576 | |||
564 | (create a simple text version of the content) |
|
577 | (create a simple text version of the content) | |
565 |
|
578 | |||
566 | $ python ../dircontent.py > ../content-base.txt |
|
579 | $ python ../dircontent.py > ../content-base.txt | |
567 | $ cat ../content-base.txt |
|
580 | $ cat ../content-base.txt | |
568 | base clean_clean |
|
581 | base clean_clean | |
|
582 | base clean_removed | |||
569 | base clean_revert |
|
583 | base clean_revert | |
570 | base clean_wc |
|
584 | base clean_wc | |
571 | base modified_clean |
|
585 | base modified_clean | |
|
586 | base modified_removed | |||
572 | base modified_revert |
|
587 | base modified_revert | |
573 | base modified_wc |
|
588 | base modified_wc | |
574 | base removed_clean |
|
589 | base removed_clean | |
|
590 | base removed_removed | |||
575 | base removed_revert |
|
591 | base removed_revert | |
576 | base removed_wc |
|
592 | base removed_wc | |
577 |
|
593 | |||
578 | Create parent changeset |
|
594 | Create parent changeset | |
579 |
|
595 | |||
580 | $ python ../gen-revert-cases.py parent |
|
596 | $ python ../gen-revert-cases.py parent | |
581 | $ hg addremove --similarity 0 |
|
597 | $ hg addremove --similarity 0 | |
582 | adding added_clean |
|
598 | adding added_clean | |
|
599 | adding added_removed | |||
583 | adding added_revert |
|
600 | adding added_revert | |
584 | adding added_wc |
|
601 | adding added_wc | |
585 | removing removed_clean |
|
602 | removing removed_clean | |
|
603 | removing removed_removed | |||
586 | removing removed_revert |
|
604 | removing removed_revert | |
587 | removing removed_wc |
|
605 | removing removed_wc | |
588 | $ hg status |
|
606 | $ hg status | |
589 | M modified_clean |
|
607 | M modified_clean | |
|
608 | M modified_removed | |||
590 | M modified_revert |
|
609 | M modified_revert | |
591 | M modified_wc |
|
610 | M modified_wc | |
592 | A added_clean |
|
611 | A added_clean | |
|
612 | A added_removed | |||
593 | A added_revert |
|
613 | A added_revert | |
594 | A added_wc |
|
614 | A added_wc | |
595 | R removed_clean |
|
615 | R removed_clean | |
|
616 | R removed_removed | |||
596 | R removed_revert |
|
617 | R removed_revert | |
597 | R removed_wc |
|
618 | R removed_wc | |
598 | $ hg commit -m 'parent' |
|
619 | $ hg commit -m 'parent' | |
599 |
|
620 | |||
600 | (create a simple text version of the content) |
|
621 | (create a simple text version of the content) | |
601 |
|
622 | |||
602 | $ python ../dircontent.py > ../content-parent.txt |
|
623 | $ python ../dircontent.py > ../content-parent.txt | |
603 | $ cat ../content-parent.txt |
|
624 | $ cat ../content-parent.txt | |
604 | parent added_clean |
|
625 | parent added_clean | |
|
626 | parent added_removed | |||
605 | parent added_revert |
|
627 | parent added_revert | |
606 | parent added_wc |
|
628 | parent added_wc | |
607 | base clean_clean |
|
629 | base clean_clean | |
|
630 | base clean_removed | |||
608 | base clean_revert |
|
631 | base clean_revert | |
609 | base clean_wc |
|
632 | base clean_wc | |
610 | parent modified_clean |
|
633 | parent modified_clean | |
|
634 | parent modified_removed | |||
611 | parent modified_revert |
|
635 | parent modified_revert | |
612 | parent modified_wc |
|
636 | parent modified_wc | |
613 |
|
637 | |||
614 | Setup working directory |
|
638 | Setup working directory | |
615 |
|
639 | |||
616 | $ python ../gen-revert-cases.py wc | cat |
|
640 | $ python ../gen-revert-cases.py wc | cat | |
617 | $ hg addremove --similarity 0 |
|
641 | $ hg addremove --similarity 0 | |
|
642 | removing added_removed | |||
618 | removing added_revert |
|
643 | removing added_revert | |
|
644 | removing clean_removed | |||
619 | adding missing_wc |
|
645 | adding missing_wc | |
|
646 | removing modified_removed | |||
620 | adding removed_revert |
|
647 | adding removed_revert | |
621 | adding removed_wc |
|
648 | adding removed_wc | |
622 | $ hg status |
|
649 | $ hg status | |
623 | M added_wc |
|
650 | M added_wc | |
624 | M clean_wc |
|
651 | M clean_wc | |
625 | M modified_revert |
|
652 | M modified_revert | |
626 | M modified_wc |
|
653 | M modified_wc | |
627 | A missing_wc |
|
654 | A missing_wc | |
628 | A removed_revert |
|
655 | A removed_revert | |
629 | A removed_wc |
|
656 | A removed_wc | |
|
657 | R added_removed | |||
630 | R added_revert |
|
658 | R added_revert | |
|
659 | R clean_removed | |||
|
660 | R modified_removed | |||
631 |
|
661 | |||
632 | $ hg status --rev 'desc("base")' |
|
662 | $ hg status --rev 'desc("base")' | |
633 | M clean_wc |
|
663 | M clean_wc | |
634 | M modified_clean |
|
664 | M modified_clean | |
635 | M modified_wc |
|
665 | M modified_wc | |
636 | M removed_wc |
|
666 | M removed_wc | |
637 | A added_clean |
|
667 | A added_clean | |
638 | A added_wc |
|
668 | A added_wc | |
639 | A missing_wc |
|
669 | A missing_wc | |
|
670 | R clean_removed | |||
|
671 | R modified_removed | |||
640 | R removed_clean |
|
672 | R removed_clean | |
|
673 | R removed_removed | |||
641 |
|
674 | |||
642 | (create a simple text version of the content) |
|
675 | (create a simple text version of the content) | |
643 |
|
676 | |||
644 | $ python ../dircontent.py > ../content-wc.txt |
|
677 | $ python ../dircontent.py > ../content-wc.txt | |
645 | $ cat ../content-wc.txt |
|
678 | $ cat ../content-wc.txt | |
646 | parent added_clean |
|
679 | parent added_clean | |
647 | wc added_wc |
|
680 | wc added_wc | |
648 | base clean_clean |
|
681 | base clean_clean | |
649 | base clean_revert |
|
682 | base clean_revert | |
650 | wc clean_wc |
|
683 | wc clean_wc | |
651 | wc missing_wc |
|
684 | wc missing_wc | |
652 | parent modified_clean |
|
685 | parent modified_clean | |
653 | base modified_revert |
|
686 | base modified_revert | |
654 | wc modified_wc |
|
687 | wc modified_wc | |
655 | base removed_revert |
|
688 | base removed_revert | |
656 | wc removed_wc |
|
689 | wc removed_wc | |
657 |
|
690 | |||
658 | $ cd .. |
|
691 | $ cd .. | |
659 |
|
692 | |||
660 | Test revert --all to parent content |
|
693 | Test revert --all to parent content | |
661 | ----------------------------------- |
|
694 | ----------------------------------- | |
662 |
|
695 | |||
663 | (setup from reference repo) |
|
696 | (setup from reference repo) | |
664 |
|
697 | |||
665 | $ cp -r revert-ref revert-parent-all |
|
698 | $ cp -r revert-ref revert-parent-all | |
666 | $ cd revert-parent-all |
|
699 | $ cd revert-parent-all | |
667 |
|
700 | |||
668 | check revert output |
|
701 | check revert output | |
669 |
|
702 | |||
670 | $ hg revert --all |
|
703 | $ hg revert --all | |
|
704 | undeleting added_removed | |||
671 | undeleting added_revert |
|
705 | undeleting added_revert | |
672 | reverting added_wc |
|
706 | reverting added_wc | |
|
707 | undeleting clean_removed | |||
673 | reverting clean_wc |
|
708 | reverting clean_wc | |
674 | forgetting missing_wc |
|
709 | forgetting missing_wc | |
|
710 | undeleting modified_removed | |||
675 | reverting modified_revert |
|
711 | reverting modified_revert | |
676 | reverting modified_wc |
|
712 | reverting modified_wc | |
677 | forgetting removed_revert |
|
713 | forgetting removed_revert | |
678 | forgetting removed_wc |
|
714 | forgetting removed_wc | |
679 |
|
715 | |||
680 | Compare resulting directory with revert target. |
|
716 | Compare resulting directory with revert target. | |
681 |
|
717 | |||
682 | The diff is filtered to include change only. The only difference should be |
|
718 | The diff is filtered to include change only. The only difference should be | |
683 | additional `.orig` backup file when applicable. |
|
719 | additional `.orig` backup file when applicable. | |
684 |
|
720 | |||
685 | $ python ../dircontent.py > ../content-parent-all.txt |
|
721 | $ python ../dircontent.py > ../content-parent-all.txt | |
686 | $ cd .. |
|
722 | $ cd .. | |
687 | $ diff -U 0 -- content-parent.txt content-parent-all.txt | grep _ |
|
723 | $ diff -U 0 -- content-parent.txt content-parent-all.txt | grep _ | |
688 | +wc added_wc.orig |
|
724 | +wc added_wc.orig | |
689 | +wc clean_wc.orig |
|
725 | +wc clean_wc.orig | |
690 | +wc missing_wc |
|
726 | +wc missing_wc | |
691 | +base modified_revert.orig |
|
727 | +base modified_revert.orig | |
692 | +wc modified_wc.orig |
|
728 | +wc modified_wc.orig | |
693 | +base removed_revert |
|
729 | +base removed_revert | |
694 | +wc removed_wc |
|
730 | +wc removed_wc | |
695 |
|
731 | |||
696 | Test revert --all to "base" content |
|
732 | Test revert --all to "base" content | |
697 | ----------------------------------- |
|
733 | ----------------------------------- | |
698 |
|
734 | |||
699 | (setup from reference repo) |
|
735 | (setup from reference repo) | |
700 |
|
736 | |||
701 | $ cp -r revert-ref revert-base-all |
|
737 | $ cp -r revert-ref revert-base-all | |
702 | $ cd revert-base-all |
|
738 | $ cd revert-base-all | |
703 |
|
739 | |||
704 | check revert output |
|
740 | check revert output | |
705 |
|
741 | |||
706 | Misbehavior: |
|
742 | Misbehavior: | |
707 |
|
743 | |||
708 | - report "reverting" when file needs no changes |
|
744 | - report "reverting" when file needs no changes | |
709 | | |
|
745 | | | |
710 | | - reverting modified_revert |
|
746 | | - reverting modified_revert | |
711 | | - reverting removed_revert |
|
747 | | - reverting removed_revert | |
712 |
|
748 | |||
713 | $ hg revert --all --rev 'desc(base)' |
|
749 | $ hg revert --all --rev 'desc(base)' | |
714 | removing added_clean |
|
750 | removing added_clean | |
715 | removing added_wc |
|
751 | removing added_wc | |
|
752 | undeleting clean_removed | |||
716 | reverting clean_wc |
|
753 | reverting clean_wc | |
717 | forgetting missing_wc |
|
754 | forgetting missing_wc | |
718 | reverting modified_clean |
|
755 | reverting modified_clean | |
|
756 | undeleting modified_removed | |||
719 | reverting modified_revert |
|
757 | reverting modified_revert | |
720 | reverting modified_wc |
|
758 | reverting modified_wc | |
721 | adding removed_clean |
|
759 | adding removed_clean | |
|
760 | adding removed_removed | |||
722 | reverting removed_revert |
|
761 | reverting removed_revert | |
723 | reverting removed_wc |
|
762 | reverting removed_wc | |
724 |
|
763 | |||
725 | Compare resulting directory with revert target. |
|
764 | Compare resulting directory with revert target. | |
726 |
|
765 | |||
727 | The diff is filtered to include change only. The only difference should be |
|
766 | The diff is filtered to include change only. The only difference should be | |
728 | additional `.orig` backup file when applicable. |
|
767 | additional `.orig` backup file when applicable. | |
729 |
|
768 | |||
730 | Misbehavior: |
|
769 | Misbehavior: | |
731 |
|
770 | |||
732 | - no backup for |
|
771 | - no backup for | |
733 | | - added_wc (DATA LOSS) |
|
772 | | - added_wc (DATA LOSS) | |
734 |
|
773 | |||
735 | $ python ../dircontent.py > ../content-base-all.txt |
|
774 | $ python ../dircontent.py > ../content-base-all.txt | |
736 | $ cd .. |
|
775 | $ cd .. | |
737 | $ diff -U 0 -- content-base.txt content-base-all.txt | grep _ |
|
776 | $ diff -U 0 -- content-base.txt content-base-all.txt | grep _ | |
738 | +wc clean_wc.orig |
|
777 | +wc clean_wc.orig | |
739 | +wc missing_wc |
|
778 | +wc missing_wc | |
740 | +wc modified_wc.orig |
|
779 | +wc modified_wc.orig | |
741 | +wc removed_wc.orig |
|
780 | +wc removed_wc.orig | |
742 |
|
781 | |||
743 | Test revert to parent content with explicit file name |
|
782 | Test revert to parent content with explicit file name | |
744 | ----------------------------------------------------- |
|
783 | ----------------------------------------------------- | |
745 |
|
784 | |||
746 | (setup from reference repo) |
|
785 | (setup from reference repo) | |
747 |
|
786 | |||
748 | $ cp -r revert-ref revert-parent-explicit |
|
787 | $ cp -r revert-ref revert-parent-explicit | |
749 | $ cd revert-parent-explicit |
|
788 | $ cd revert-parent-explicit | |
750 |
|
789 | |||
751 | revert all files individually and check the output |
|
790 | revert all files individually and check the output | |
752 | (output is expected to be different than in the --all case) |
|
791 | (output is expected to be different than in the --all case) | |
753 |
|
792 | |||
754 | $ for file in `python ../gen-revert-cases.py filelist`; do |
|
793 | $ for file in `python ../gen-revert-cases.py filelist`; do | |
755 | > echo '### revert for:' $file; |
|
794 | > echo '### revert for:' $file; | |
756 | > hg revert $file; |
|
795 | > hg revert $file; | |
757 | > echo |
|
796 | > echo | |
758 | > done |
|
797 | > done | |
759 | ### revert for: added_clean |
|
798 | ### revert for: added_clean | |
760 | no changes needed to added_clean |
|
799 | no changes needed to added_clean | |
761 |
|
800 | |||
|
801 | ### revert for: added_removed | |||
|
802 | ||||
762 | ### revert for: added_revert |
|
803 | ### revert for: added_revert | |
763 |
|
804 | |||
764 | ### revert for: added_wc |
|
805 | ### revert for: added_wc | |
765 |
|
806 | |||
766 | ### revert for: clean_clean |
|
807 | ### revert for: clean_clean | |
767 | no changes needed to clean_clean |
|
808 | no changes needed to clean_clean | |
768 |
|
809 | |||
|
810 | ### revert for: clean_removed | |||
|
811 | ||||
769 | ### revert for: clean_revert |
|
812 | ### revert for: clean_revert | |
770 | no changes needed to clean_revert |
|
813 | no changes needed to clean_revert | |
771 |
|
814 | |||
772 | ### revert for: clean_wc |
|
815 | ### revert for: clean_wc | |
773 |
|
816 | |||
774 | ### revert for: missing_clean |
|
817 | ### revert for: missing_clean | |
775 | missing_clean: no such file in rev * (glob) |
|
818 | missing_clean: no such file in rev * (glob) | |
776 |
|
819 | |||
|
820 | ### revert for: missing_removed | |||
|
821 | missing_removed: no such file in rev * (glob) | |||
|
822 | ||||
777 | ### revert for: missing_revert |
|
823 | ### revert for: missing_revert | |
778 | missing_revert: no such file in rev * (glob) |
|
824 | missing_revert: no such file in rev * (glob) | |
779 |
|
825 | |||
780 | ### revert for: missing_wc |
|
826 | ### revert for: missing_wc | |
781 |
|
827 | |||
782 | ### revert for: modified_clean |
|
828 | ### revert for: modified_clean | |
783 | no changes needed to modified_clean |
|
829 | no changes needed to modified_clean | |
784 |
|
830 | |||
|
831 | ### revert for: modified_removed | |||
|
832 | ||||
785 | ### revert for: modified_revert |
|
833 | ### revert for: modified_revert | |
786 |
|
834 | |||
787 | ### revert for: modified_wc |
|
835 | ### revert for: modified_wc | |
788 |
|
836 | |||
789 | ### revert for: removed_clean |
|
837 | ### revert for: removed_clean | |
790 | removed_clean: no such file in rev * (glob) |
|
838 | removed_clean: no such file in rev * (glob) | |
791 |
|
839 | |||
|
840 | ### revert for: removed_removed | |||
|
841 | removed_removed: no such file in rev * (glob) | |||
|
842 | ||||
792 | ### revert for: removed_revert |
|
843 | ### revert for: removed_revert | |
793 |
|
844 | |||
794 | ### revert for: removed_wc |
|
845 | ### revert for: removed_wc | |
795 |
|
846 | |||
796 |
|
847 | |||
797 | check resulting directory againt the --all run |
|
848 | check resulting directory againt the --all run | |
798 | (There should be no difference) |
|
849 | (There should be no difference) | |
799 |
|
850 | |||
800 | $ python ../dircontent.py > ../content-parent-explicit.txt |
|
851 | $ python ../dircontent.py > ../content-parent-explicit.txt | |
801 | $ cd .. |
|
852 | $ cd .. | |
802 | $ diff -U 0 -- content-parent-all.txt content-parent-explicit.txt | grep _ |
|
853 | $ diff -U 0 -- content-parent-all.txt content-parent-explicit.txt | grep _ | |
803 | [1] |
|
854 | [1] | |
804 |
|
855 | |||
805 | Test revert to "base" content with explicit file name |
|
856 | Test revert to "base" content with explicit file name | |
806 | ----------------------------------------------------- |
|
857 | ----------------------------------------------------- | |
807 |
|
858 | |||
808 | (setup from reference repo) |
|
859 | (setup from reference repo) | |
809 |
|
860 | |||
810 | $ cp -r revert-ref revert-base-explicit |
|
861 | $ cp -r revert-ref revert-base-explicit | |
811 | $ cd revert-base-explicit |
|
862 | $ cd revert-base-explicit | |
812 |
|
863 | |||
813 | revert all files individually and check the output |
|
864 | revert all files individually and check the output | |
814 | (output is expected to be different than in the --all case) |
|
865 | (output is expected to be different than in the --all case) | |
815 |
|
866 | |||
816 | Misbehavior: |
|
867 | Misbehavior: | |
817 |
|
868 | |||
818 | - fails to report no change to revert for |
|
869 | - fails to report no change to revert for | |
819 | | |
|
870 | | | |
820 | | - clean_clean |
|
871 | | - clean_clean | |
821 | | - added_revert |
|
872 | | - added_revert | |
822 | | - clean_revert |
|
873 | | - clean_revert | |
823 | | - modified_revert |
|
874 | | - modified_revert | |
824 | | - removed_revert |
|
875 | | - removed_revert | |
|
876 | | - added_removed | |||
825 |
|
877 | |||
826 | $ for file in `python ../gen-revert-cases.py filelist`; do |
|
878 | $ for file in `python ../gen-revert-cases.py filelist`; do | |
827 | > echo '### revert for:' $file; |
|
879 | > echo '### revert for:' $file; | |
828 | > hg revert $file --rev 'desc(base)'; |
|
880 | > hg revert $file --rev 'desc(base)'; | |
829 | > echo |
|
881 | > echo | |
830 | > done |
|
882 | > done | |
831 | ### revert for: added_clean |
|
883 | ### revert for: added_clean | |
832 |
|
884 | |||
|
885 | ### revert for: added_removed | |||
|
886 | ||||
833 | ### revert for: added_revert |
|
887 | ### revert for: added_revert | |
834 |
|
888 | |||
835 | ### revert for: added_wc |
|
889 | ### revert for: added_wc | |
836 |
|
890 | |||
837 | ### revert for: clean_clean |
|
891 | ### revert for: clean_clean | |
838 |
|
892 | |||
|
893 | ### revert for: clean_removed | |||
|
894 | ||||
839 | ### revert for: clean_revert |
|
895 | ### revert for: clean_revert | |
840 |
|
896 | |||
841 | ### revert for: clean_wc |
|
897 | ### revert for: clean_wc | |
842 |
|
898 | |||
843 | ### revert for: missing_clean |
|
899 | ### revert for: missing_clean | |
844 | missing_clean: no such file in rev * (glob) |
|
900 | missing_clean: no such file in rev * (glob) | |
845 |
|
901 | |||
|
902 | ### revert for: missing_removed | |||
|
903 | missing_removed: no such file in rev * (glob) | |||
|
904 | ||||
846 | ### revert for: missing_revert |
|
905 | ### revert for: missing_revert | |
847 | missing_revert: no such file in rev * (glob) |
|
906 | missing_revert: no such file in rev * (glob) | |
848 |
|
907 | |||
849 | ### revert for: missing_wc |
|
908 | ### revert for: missing_wc | |
850 |
|
909 | |||
851 | ### revert for: modified_clean |
|
910 | ### revert for: modified_clean | |
852 |
|
911 | |||
|
912 | ### revert for: modified_removed | |||
|
913 | ||||
853 | ### revert for: modified_revert |
|
914 | ### revert for: modified_revert | |
854 |
|
915 | |||
855 | ### revert for: modified_wc |
|
916 | ### revert for: modified_wc | |
856 |
|
917 | |||
857 | ### revert for: removed_clean |
|
918 | ### revert for: removed_clean | |
858 |
|
919 | |||
|
920 | ### revert for: removed_removed | |||
|
921 | ||||
859 | ### revert for: removed_revert |
|
922 | ### revert for: removed_revert | |
860 |
|
923 | |||
861 | ### revert for: removed_wc |
|
924 | ### revert for: removed_wc | |
862 |
|
925 | |||
863 |
|
926 | |||
864 | check resulting directory againt the --all run |
|
927 | check resulting directory againt the --all run | |
865 | (There should be no difference) |
|
928 | (There should be no difference) | |
866 |
|
929 | |||
867 | $ python ../dircontent.py > ../content-base-explicit.txt |
|
930 | $ python ../dircontent.py > ../content-base-explicit.txt | |
868 | $ cd .. |
|
931 | $ cd .. | |
869 | $ diff -U 0 -- content-base-all.txt content-base-explicit.txt | grep _ |
|
932 | $ diff -U 0 -- content-base-all.txt content-base-explicit.txt | grep _ | |
870 | [1] |
|
933 | [1] |
General Comments 0
You need to be logged in to leave comments.
Login now