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