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