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