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