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