##// END OF EJS Templates
test-revert: removing a missing file has no effect...
Martin von Zweigbergk -
r23155:25e12d49 default
parent child Browse files
Show More
@@ -1,1134 +1,1090
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 473 > if not ctxvalue[0] and 'revert' in wckey:
474 474 > continue
475 > if not ctxvalue[1] and ('removed' in wckey or 'deleted' in wckey):
476 > continue
475 477 > filename = "%s_%s" % (ctxkey, wckey)
476 478 > combination.append((filename, ctxkey, wckey))
477 479 >
478 480 > # make sure we have stable output
479 481 > combination.sort()
480 482 >
481 483 > # retrieve the state we must generate
482 484 > target = sys.argv[1]
483 485 >
484 486 > # compute file content
485 487 > content = []
486 488 > for filename, ctxkey, wckey in combination:
487 489 > cc = ctxcontent[ctxkey]
488 490 > if target == 'filelist':
489 491 > print filename
490 492 > elif target == 'base':
491 493 > content.append((filename, cc[0]))
492 494 > elif target == 'parent':
493 495 > content.append((filename, cc[1]))
494 496 > elif target == 'wc':
495 497 > content.append((filename, wccontent[wckey](cc)))
496 498 > else:
497 499 > print >> sys.stderr, "unknown target:", target
498 500 > sys.exit(1)
499 501 >
500 502 > # write actual content
501 503 > for filename, data in content:
502 504 > if data is not None:
503 505 > f = open(filename, 'w')
504 506 > f.write(data + '\n')
505 507 > f.close()
506 508 > elif os.path.exists(filename):
507 509 > os.remove(filename)
508 510 > EOF
509 511
510 512 check list of planned files
511 513
512 514 $ python gen-revert-cases.py filelist
513 515 added_clean
514 516 added_deleted
515 517 added_removed
516 518 added_untracked-clean
517 519 added_untracked-wc
518 520 added_wc
519 521 clean_clean
520 522 clean_deleted
521 523 clean_removed
522 524 clean_untracked-clean
523 525 clean_untracked-wc
524 526 clean_wc
525 527 missing_clean
526 missing_deleted
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 removed_deleted
541 removed_removed
542 540 removed_revert
543 541 removed_untracked-clean
544 542 removed_untracked-revert
545 543 removed_untracked-wc
546 544 removed_wc
547 545
548 546 Script to make a simple text version of the content
549 547 ---------------------------------------------------
550 548
551 549 $ cat << EOF >> dircontent.py
552 550 > # generate a simple text view of the directory for easy comparison
553 551 > import os
554 552 > files = os.listdir('.')
555 553 > files.sort()
556 554 > for filename in files:
557 555 > if os.path.isdir(filename):
558 556 > continue
559 557 > content = open(filename).read()
560 558 > print '%-6s %s' % (content.strip(), filename)
561 559 > EOF
562 560
563 561 Generate appropriate repo state
564 562 -------------------------------
565 563
566 564 $ hg init revert-ref
567 565 $ cd revert-ref
568 566
569 567 Generate base changeset
570 568
571 569 $ python ../gen-revert-cases.py base
572 570 $ hg addremove --similarity 0
573 571 adding clean_clean
574 572 adding clean_deleted
575 573 adding clean_removed
576 574 adding clean_untracked-clean
577 575 adding clean_untracked-wc
578 576 adding clean_wc
579 577 adding modified_clean
580 578 adding modified_deleted
581 579 adding modified_removed
582 580 adding modified_revert
583 581 adding modified_untracked-clean
584 582 adding modified_untracked-revert
585 583 adding modified_untracked-wc
586 584 adding modified_wc
587 585 adding removed_clean
588 adding removed_deleted
589 adding removed_removed
590 586 adding removed_revert
591 587 adding removed_untracked-clean
592 588 adding removed_untracked-revert
593 589 adding removed_untracked-wc
594 590 adding removed_wc
595 591 $ hg status
596 592 A clean_clean
597 593 A clean_deleted
598 594 A clean_removed
599 595 A clean_untracked-clean
600 596 A clean_untracked-wc
601 597 A clean_wc
602 598 A modified_clean
603 599 A modified_deleted
604 600 A modified_removed
605 601 A modified_revert
606 602 A modified_untracked-clean
607 603 A modified_untracked-revert
608 604 A modified_untracked-wc
609 605 A modified_wc
610 606 A removed_clean
611 A removed_deleted
612 A removed_removed
613 607 A removed_revert
614 608 A removed_untracked-clean
615 609 A removed_untracked-revert
616 610 A removed_untracked-wc
617 611 A removed_wc
618 612 $ hg commit -m 'base'
619 613
620 614 (create a simple text version of the content)
621 615
622 616 $ python ../dircontent.py > ../content-base.txt
623 617 $ cat ../content-base.txt
624 618 base clean_clean
625 619 base clean_deleted
626 620 base clean_removed
627 621 base clean_untracked-clean
628 622 base clean_untracked-wc
629 623 base clean_wc
630 624 base modified_clean
631 625 base modified_deleted
632 626 base modified_removed
633 627 base modified_revert
634 628 base modified_untracked-clean
635 629 base modified_untracked-revert
636 630 base modified_untracked-wc
637 631 base modified_wc
638 632 base removed_clean
639 base removed_deleted
640 base removed_removed
641 633 base removed_revert
642 634 base removed_untracked-clean
643 635 base removed_untracked-revert
644 636 base removed_untracked-wc
645 637 base removed_wc
646 638
647 639 Create parent changeset
648 640
649 641 $ python ../gen-revert-cases.py parent
650 642 $ hg addremove --similarity 0
651 643 adding added_clean
652 644 adding added_deleted
653 645 adding added_removed
654 646 adding added_untracked-clean
655 647 adding added_untracked-wc
656 648 adding added_wc
657 649 removing removed_clean
658 removing removed_deleted
659 removing removed_removed
660 650 removing removed_revert
661 651 removing removed_untracked-clean
662 652 removing removed_untracked-revert
663 653 removing removed_untracked-wc
664 654 removing removed_wc
665 655 $ hg status
666 656 M modified_clean
667 657 M modified_deleted
668 658 M modified_removed
669 659 M modified_revert
670 660 M modified_untracked-clean
671 661 M modified_untracked-revert
672 662 M modified_untracked-wc
673 663 M modified_wc
674 664 A added_clean
675 665 A added_deleted
676 666 A added_removed
677 667 A added_untracked-clean
678 668 A added_untracked-wc
679 669 A added_wc
680 670 R removed_clean
681 R removed_deleted
682 R removed_removed
683 671 R removed_revert
684 672 R removed_untracked-clean
685 673 R removed_untracked-revert
686 674 R removed_untracked-wc
687 675 R removed_wc
688 676 $ hg commit -m 'parent'
689 677
690 678 (create a simple text version of the content)
691 679
692 680 $ python ../dircontent.py > ../content-parent.txt
693 681 $ cat ../content-parent.txt
694 682 parent added_clean
695 683 parent added_deleted
696 684 parent added_removed
697 685 parent added_untracked-clean
698 686 parent added_untracked-wc
699 687 parent added_wc
700 688 base clean_clean
701 689 base clean_deleted
702 690 base clean_removed
703 691 base clean_untracked-clean
704 692 base clean_untracked-wc
705 693 base clean_wc
706 694 parent modified_clean
707 695 parent modified_deleted
708 696 parent modified_removed
709 697 parent modified_revert
710 698 parent modified_untracked-clean
711 699 parent modified_untracked-revert
712 700 parent modified_untracked-wc
713 701 parent modified_wc
714 702
715 703 Setup working directory
716 704
717 705 $ python ../gen-revert-cases.py wc
718 706 $ hg addremove --similarity 0
719 707 removing added_removed
720 708 removing clean_removed
721 adding missing_deleted
722 709 adding missing_untracked-wc
723 710 adding missing_wc
724 711 removing modified_removed
725 adding removed_deleted
726 712 adding removed_revert
727 713 adding removed_untracked-revert
728 714 adding removed_untracked-wc
729 715 adding removed_wc
730 716 $ hg forget *untracked*
731 717 $ rm *deleted*
732 718 $ hg status
733 719 M added_wc
734 720 M clean_wc
735 721 M modified_revert
736 722 M modified_wc
737 723 A missing_wc
738 724 A removed_revert
739 725 A removed_wc
740 726 R added_removed
741 727 R added_untracked-clean
742 728 R added_untracked-wc
743 729 R clean_removed
744 730 R clean_untracked-clean
745 731 R clean_untracked-wc
746 732 R modified_removed
747 733 R modified_untracked-clean
748 734 R modified_untracked-revert
749 735 R modified_untracked-wc
750 736 ! added_deleted
751 737 ! clean_deleted
752 ! missing_deleted
753 738 ! modified_deleted
754 ! removed_deleted
755 739 ? missing_untracked-wc
756 740 ? removed_untracked-revert
757 741 ? removed_untracked-wc
758 742
759 743 $ hg status --rev 'desc("base")'
760 744 M clean_wc
761 745 M modified_clean
762 746 M modified_wc
763 747 M removed_wc
764 748 A added_clean
765 749 A added_wc
766 750 A missing_wc
767 751 R clean_removed
768 752 R clean_untracked-clean
769 753 R clean_untracked-wc
770 754 R modified_removed
771 755 R modified_untracked-clean
772 756 R modified_untracked-revert
773 757 R modified_untracked-wc
774 758 R removed_clean
775 R removed_deleted
776 R removed_removed
777 759 R removed_untracked-clean
778 760 R removed_untracked-revert
779 761 R removed_untracked-wc
780 762 ! added_deleted
781 763 ! clean_deleted
782 ! missing_deleted
783 764 ! modified_deleted
784 ! removed_deleted
785 765 ? missing_untracked-wc
786 766
787 767 (create a simple text version of the content)
788 768
789 769 $ python ../dircontent.py > ../content-wc.txt
790 770 $ cat ../content-wc.txt
791 771 parent added_clean
792 772 parent added_untracked-clean
793 773 wc added_untracked-wc
794 774 wc added_wc
795 775 base clean_clean
796 776 base clean_untracked-clean
797 777 wc clean_untracked-wc
798 778 wc clean_wc
799 779 wc missing_untracked-wc
800 780 wc missing_wc
801 781 parent modified_clean
802 782 base modified_revert
803 783 parent modified_untracked-clean
804 784 base modified_untracked-revert
805 785 wc modified_untracked-wc
806 786 wc modified_wc
807 787 base removed_revert
808 788 base removed_untracked-revert
809 789 wc removed_untracked-wc
810 790 wc removed_wc
811 791
812 792 $ cd ..
813 793
814 794 Test revert --all to parent content
815 795 -----------------------------------
816 796
817 797 (setup from reference repo)
818 798
819 799 $ cp -r revert-ref revert-parent-all
820 800 $ cd revert-parent-all
821 801
822 802 check revert output
823 803
824 804 $ hg revert --all
825 805 reverting added_deleted
826 806 undeleting added_removed
827 807 undeleting added_untracked-clean
828 808 undeleting added_untracked-wc
829 809 reverting added_wc
830 810 reverting clean_deleted
831 811 undeleting clean_removed
832 812 undeleting clean_untracked-clean
833 813 undeleting clean_untracked-wc
834 814 reverting clean_wc
835 forgetting missing_deleted
836 815 forgetting missing_wc
837 816 reverting modified_deleted
838 817 undeleting modified_removed
839 818 reverting modified_revert
840 819 undeleting modified_untracked-clean
841 820 undeleting modified_untracked-revert
842 821 undeleting modified_untracked-wc
843 822 reverting modified_wc
844 forgetting removed_deleted
845 823 forgetting removed_revert
846 824 forgetting removed_wc
847 825
848 826 Compare resulting directory with revert target.
849 827
850 828 The diff is filtered to include change only. The only difference should be
851 829 additional `.orig` backup file when applicable.
852 830
853 831 $ python ../dircontent.py > ../content-parent-all.txt
854 832 $ cd ..
855 833 $ diff -U 0 -- content-parent.txt content-parent-all.txt | grep _
856 834 +wc added_untracked-wc.orig
857 835 +wc added_wc.orig
858 836 +wc clean_untracked-wc.orig
859 837 +wc clean_wc.orig
860 838 +wc missing_untracked-wc
861 839 +wc missing_wc
862 840 +base modified_revert.orig
863 841 +base modified_untracked-revert.orig
864 842 +wc modified_untracked-wc.orig
865 843 +wc modified_wc.orig
866 844 +base removed_revert
867 845 +base removed_untracked-revert
868 846 +wc removed_untracked-wc
869 847 +wc removed_wc
870 848
871 849 Test revert --all to "base" content
872 850 -----------------------------------
873 851
874 852 (setup from reference repo)
875 853
876 854 $ cp -r revert-ref revert-base-all
877 855 $ cd revert-base-all
878 856
879 857 check revert output
880 858
881 859 $ hg revert --all --rev 'desc(base)'
882 860 removing added_clean
883 861 removing added_deleted
884 862 removing added_wc
885 863 reverting clean_deleted
886 864 undeleting clean_removed
887 865 undeleting clean_untracked-clean
888 866 undeleting clean_untracked-wc
889 867 reverting clean_wc
890 forgetting missing_deleted
891 868 forgetting missing_wc
892 869 reverting modified_clean
893 870 reverting modified_deleted
894 871 undeleting modified_removed
895 872 undeleting modified_untracked-clean
896 873 undeleting modified_untracked-revert
897 874 undeleting modified_untracked-wc
898 875 reverting modified_wc
899 876 adding removed_clean
900 reverting removed_deleted
901 adding removed_removed
902 877 adding removed_untracked-clean
903 878 adding removed_untracked-revert
904 879 adding removed_untracked-wc
905 880 reverting removed_wc
906 881
907 882 Compare resulting directory with revert target.
908 883
909 884 The diff is filtered to include change only. The only difference should be
910 885 additional `.orig` backup file when applicable.
911 886
912 887 $ python ../dircontent.py > ../content-base-all.txt
913 888 $ cd ..
914 889 $ diff -U 0 -- content-base.txt content-base-all.txt | grep _
915 890 +parent added_untracked-clean
916 891 +wc added_untracked-wc
917 892 +wc added_wc.orig
918 893 +wc clean_untracked-wc.orig
919 894 +wc clean_wc.orig
920 895 +wc missing_untracked-wc
921 896 +wc missing_wc
922 897 +parent modified_untracked-clean.orig
923 898 +wc modified_untracked-wc.orig
924 899 +wc modified_wc.orig
925 900 +wc removed_untracked-wc.orig
926 901 +wc removed_wc.orig
927 902
928 903 Test revert to parent content with explicit file name
929 904 -----------------------------------------------------
930 905
931 906 (setup from reference repo)
932 907
933 908 $ cp -r revert-ref revert-parent-explicit
934 909 $ cd revert-parent-explicit
935 910
936 911 revert all files individually and check the output
937 912 (output is expected to be different than in the --all case)
938 913
939 914 $ for file in `python ../gen-revert-cases.py filelist`; do
940 915 > echo '### revert for:' $file;
941 916 > hg revert $file;
942 917 > echo
943 918 > done
944 919 ### revert for: added_clean
945 920 no changes needed to added_clean
946 921
947 922 ### revert for: added_deleted
948 923
949 924 ### revert for: added_removed
950 925
951 926 ### revert for: added_untracked-clean
952 927
953 928 ### revert for: added_untracked-wc
954 929
955 930 ### revert for: added_wc
956 931
957 932 ### revert for: clean_clean
958 933 no changes needed to clean_clean
959 934
960 935 ### revert for: clean_deleted
961 936
962 937 ### revert for: clean_removed
963 938
964 939 ### revert for: clean_untracked-clean
965 940
966 941 ### revert for: clean_untracked-wc
967 942
968 943 ### revert for: clean_wc
969 944
970 945 ### revert for: missing_clean
971 946 missing_clean: no such file in rev * (glob)
972 947
973 ### revert for: missing_deleted
974
975 ### revert for: missing_removed
976 missing_removed: no such file in rev * (glob)
977
978 948 ### revert for: missing_untracked-clean
979 949 missing_untracked-clean: no such file in rev * (glob)
980 950
981 951 ### revert for: missing_untracked-wc
982 952 file not managed: missing_untracked-wc
983 953
984 954 ### revert for: missing_wc
985 955
986 956 ### revert for: modified_clean
987 957 no changes needed to modified_clean
988 958
989 959 ### revert for: modified_deleted
990 960
991 961 ### revert for: modified_removed
992 962
993 963 ### revert for: modified_revert
994 964
995 965 ### revert for: modified_untracked-clean
996 966
997 967 ### revert for: modified_untracked-revert
998 968
999 969 ### revert for: modified_untracked-wc
1000 970
1001 971 ### revert for: modified_wc
1002 972
1003 973 ### revert for: removed_clean
1004 974 removed_clean: no such file in rev * (glob)
1005 975
1006 ### revert for: removed_deleted
1007
1008 ### revert for: removed_removed
1009 removed_removed: no such file in rev * (glob)
1010
1011 976 ### revert for: removed_revert
1012 977
1013 978 ### revert for: removed_untracked-clean
1014 979 removed_untracked-clean: no such file in rev * (glob)
1015 980
1016 981 ### revert for: removed_untracked-revert
1017 982 file not managed: removed_untracked-revert
1018 983
1019 984 ### revert for: removed_untracked-wc
1020 985 file not managed: removed_untracked-wc
1021 986
1022 987 ### revert for: removed_wc
1023 988
1024 989
1025 990 check resulting directory against the --all run
1026 991 (There should be no difference)
1027 992
1028 993 $ python ../dircontent.py > ../content-parent-explicit.txt
1029 994 $ cd ..
1030 995 $ diff -U 0 -- content-parent-all.txt content-parent-explicit.txt | grep _
1031 996 [1]
1032 997
1033 998 Test revert to "base" content with explicit file name
1034 999 -----------------------------------------------------
1035 1000
1036 1001 (setup from reference repo)
1037 1002
1038 1003 $ cp -r revert-ref revert-base-explicit
1039 1004 $ cd revert-base-explicit
1040 1005
1041 1006 revert all files individually and check the output
1042 1007 (output is expected to be different than in the --all case)
1043 1008
1044 1009 $ for file in `python ../gen-revert-cases.py filelist`; do
1045 1010 > echo '### revert for:' $file;
1046 1011 > hg revert $file --rev 'desc(base)';
1047 1012 > echo
1048 1013 > done
1049 1014 ### revert for: added_clean
1050 1015
1051 1016 ### revert for: added_deleted
1052 1017
1053 1018 ### revert for: added_removed
1054 1019 no changes needed to added_removed
1055 1020
1056 1021 ### revert for: added_untracked-clean
1057 1022 no changes needed to added_untracked-clean
1058 1023
1059 1024 ### revert for: added_untracked-wc
1060 1025 no changes needed to added_untracked-wc
1061 1026
1062 1027 ### revert for: added_wc
1063 1028
1064 1029 ### revert for: clean_clean
1065 1030 no changes needed to clean_clean
1066 1031
1067 1032 ### revert for: clean_deleted
1068 1033
1069 1034 ### revert for: clean_removed
1070 1035
1071 1036 ### revert for: clean_untracked-clean
1072 1037
1073 1038 ### revert for: clean_untracked-wc
1074 1039
1075 1040 ### revert for: clean_wc
1076 1041
1077 1042 ### revert for: missing_clean
1078 1043 missing_clean: no such file in rev * (glob)
1079 1044
1080 ### revert for: missing_deleted
1081
1082 ### revert for: missing_removed
1083 missing_removed: no such file in rev * (glob)
1084
1085 1045 ### revert for: missing_untracked-clean
1086 1046 missing_untracked-clean: no such file in rev * (glob)
1087 1047
1088 1048 ### revert for: missing_untracked-wc
1089 1049 file not managed: missing_untracked-wc
1090 1050
1091 1051 ### revert for: missing_wc
1092 1052
1093 1053 ### revert for: modified_clean
1094 1054
1095 1055 ### revert for: modified_deleted
1096 1056
1097 1057 ### revert for: modified_removed
1098 1058
1099 1059 ### revert for: modified_revert
1100 1060 no changes needed to modified_revert
1101 1061
1102 1062 ### revert for: modified_untracked-clean
1103 1063
1104 1064 ### revert for: modified_untracked-revert
1105 1065
1106 1066 ### revert for: modified_untracked-wc
1107 1067
1108 1068 ### revert for: modified_wc
1109 1069
1110 1070 ### revert for: removed_clean
1111 1071
1112 ### revert for: removed_deleted
1113
1114 ### revert for: removed_removed
1115
1116 1072 ### revert for: removed_revert
1117 1073 no changes needed to removed_revert
1118 1074
1119 1075 ### revert for: removed_untracked-clean
1120 1076
1121 1077 ### revert for: removed_untracked-revert
1122 1078
1123 1079 ### revert for: removed_untracked-wc
1124 1080
1125 1081 ### revert for: removed_wc
1126 1082
1127 1083
1128 1084 check resulting directory against the --all run
1129 1085 (There should be no difference)
1130 1086
1131 1087 $ python ../dircontent.py > ../content-base-explicit.txt
1132 1088 $ cd ..
1133 1089 $ diff -U 0 -- content-base-all.txt content-base-explicit.txt | grep _
1134 1090 [1]
General Comments 0
You need to be logged in to leave comments. Login now