Fossil SCM

Add test case to handle file add and rename before merging to trunk. Make test_setup return the repository path so it can be used in the test.

andybradford 2016-11-12 22:19 trunk
Commit 6a5f0c5b557a70adeb555098a9c7cc212c81c948
--- test/merge_renames.test
+++ test/merge_renames.test
@@ -465,10 +465,73 @@
465465
466466
fossil merge m
467467
test_status_list merge_renames-12-5 $RESULT {MERGE f1v}
468468
test_file_contents merge_renames-12-6 f1v "f1v\nm"
469469
fossil commit -m "merge m"
470
+
471
+#################################################################
472
+# Test 13 #
473
+# Merge in add+rename that happened on a branch, then merged #
474
+# back to branch, and again to trunk, then merge in branch. #
475
+#################################################################
476
+
477
+set repoDir [test_setup]
478
+write_file f1 "line1"
479
+fossil add f1
480
+fossil commit -m "add f1" --tag c1
481
+
482
+write_file f2 "line1"
483
+fossil add f2
484
+fossil commit -m "add f2 on branch" -b b --tag c2
485
+fossil update trunk
486
+test_status_list merge_renames_13-1 $RESULT {REMOVE f2}
487
+write_file f1 "line1\nline2\n"
488
+fossil commit -m "edit f1 on trunk" --tag c3
489
+
490
+fossil update b
491
+test_status_list merge_renames_13-2 $RESULT {
492
+ UPDATE f1
493
+ ADD f2
494
+}
495
+fossil merge trunk
496
+fossil commit -m "merge trunk" --tag c4
497
+fossil mv --hard f2 f2n
498
+test_status_list merge_renames-13-3 $RESULT "
499
+ RENAME f2 f2n
500
+ MOVED_FILE $repoDir/f2
501
+"
502
+fossil commit -m "renamed f2->f2n" --tag c5
503
+
504
+fossil update trunk
505
+fossil merge b
506
+test_status_list merge_renames-13-4 $RESULT {ADDED f2n}
507
+fossil commit -m "merge f2n" --tag m1 --tag c6
508
+
509
+fossil update b
510
+write_file f1 "line1\nline3\nline2"
511
+fossil commit -m "edit f1 on b" --tag c7
512
+
513
+fossil update trunk
514
+write_file f1 "line1\nline3\nline2\nline4"
515
+fossil commit -m "edit f1 on trunk" --tag c8
516
+
517
+fossil update b
518
+fossil merge trunk
519
+fossil commit -m "merge trunk" --tag c9
520
+write_file f1 "line1\nline3\nline4"
521
+fossil commit -m "edit f1 on b" --tag c10
522
+
523
+fossil revert
524
+fossil update m1
525
+fossil merge b
526
+test_status_list merge_renames-13-7 $RESULT {UPDATE f1}
527
+test_file_contents merge_renames-13-8 f2n "line1"
528
+
529
+fossil update trunk
530
+fossil merge --integrate b
531
+test_status_list merge_renames-13-5 $RESULT {UPDATE f1}
532
+test_file_contents merge_renames-13-6 f2n "line1"
470533
471534
######################################
472535
#
473536
# Tests for troubles not specifically linked with renames but that I'd like to
474537
# write:
475538
--- test/merge_renames.test
+++ test/merge_renames.test
@@ -465,10 +465,73 @@
465
466 fossil merge m
467 test_status_list merge_renames-12-5 $RESULT {MERGE f1v}
468 test_file_contents merge_renames-12-6 f1v "f1v\nm"
469 fossil commit -m "merge m"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
470
471 ######################################
472 #
473 # Tests for troubles not specifically linked with renames but that I'd like to
474 # write:
475
--- test/merge_renames.test
+++ test/merge_renames.test
@@ -465,10 +465,73 @@
465
466 fossil merge m
467 test_status_list merge_renames-12-5 $RESULT {MERGE f1v}
468 test_file_contents merge_renames-12-6 f1v "f1v\nm"
469 fossil commit -m "merge m"
470
471 #################################################################
472 # Test 13 #
473 # Merge in add+rename that happened on a branch, then merged #
474 # back to branch, and again to trunk, then merge in branch. #
475 #################################################################
476
477 set repoDir [test_setup]
478 write_file f1 "line1"
479 fossil add f1
480 fossil commit -m "add f1" --tag c1
481
482 write_file f2 "line1"
483 fossil add f2
484 fossil commit -m "add f2 on branch" -b b --tag c2
485 fossil update trunk
486 test_status_list merge_renames_13-1 $RESULT {REMOVE f2}
487 write_file f1 "line1\nline2\n"
488 fossil commit -m "edit f1 on trunk" --tag c3
489
490 fossil update b
491 test_status_list merge_renames_13-2 $RESULT {
492 UPDATE f1
493 ADD f2
494 }
495 fossil merge trunk
496 fossil commit -m "merge trunk" --tag c4
497 fossil mv --hard f2 f2n
498 test_status_list merge_renames-13-3 $RESULT "
499 RENAME f2 f2n
500 MOVED_FILE $repoDir/f2
501 "
502 fossil commit -m "renamed f2->f2n" --tag c5
503
504 fossil update trunk
505 fossil merge b
506 test_status_list merge_renames-13-4 $RESULT {ADDED f2n}
507 fossil commit -m "merge f2n" --tag m1 --tag c6
508
509 fossil update b
510 write_file f1 "line1\nline3\nline2"
511 fossil commit -m "edit f1 on b" --tag c7
512
513 fossil update trunk
514 write_file f1 "line1\nline3\nline2\nline4"
515 fossil commit -m "edit f1 on trunk" --tag c8
516
517 fossil update b
518 fossil merge trunk
519 fossil commit -m "merge trunk" --tag c9
520 write_file f1 "line1\nline3\nline4"
521 fossil commit -m "edit f1 on b" --tag c10
522
523 fossil revert
524 fossil update m1
525 fossil merge b
526 test_status_list merge_renames-13-7 $RESULT {UPDATE f1}
527 test_file_contents merge_renames-13-8 f2n "line1"
528
529 fossil update trunk
530 fossil merge --integrate b
531 test_status_list merge_renames-13-5 $RESULT {UPDATE f1}
532 test_file_contents merge_renames-13-6 f2n "line1"
533
534 ######################################
535 #
536 # Tests for troubles not specifically linked with renames but that I'd like to
537 # write:
538
--- test/tester.tcl
+++ test/tester.tcl
@@ -451,10 +451,11 @@
451451
if {[string length $filename] > 0} {
452452
exec $::fossilexe new $filename
453453
exec $::fossilexe open $filename
454454
exec $::fossilexe set mtime-changes off
455455
}
456
+ return $repoPath
456457
}
457458
458459
# This procedure only returns non-zero if the Tcl integration feature was
459460
# enabled at compile-time and is now enabled at runtime.
460461
proc is_tcl_usable_by_fossil {} {
461462
--- test/tester.tcl
+++ test/tester.tcl
@@ -451,10 +451,11 @@
451 if {[string length $filename] > 0} {
452 exec $::fossilexe new $filename
453 exec $::fossilexe open $filename
454 exec $::fossilexe set mtime-changes off
455 }
 
456 }
457
458 # This procedure only returns non-zero if the Tcl integration feature was
459 # enabled at compile-time and is now enabled at runtime.
460 proc is_tcl_usable_by_fossil {} {
461
--- test/tester.tcl
+++ test/tester.tcl
@@ -451,10 +451,11 @@
451 if {[string length $filename] > 0} {
452 exec $::fossilexe new $filename
453 exec $::fossilexe open $filename
454 exec $::fossilexe set mtime-changes off
455 }
456 return $repoPath
457 }
458
459 # This procedure only returns non-zero if the Tcl integration feature was
460 # enabled at compile-time and is now enabled at runtime.
461 proc is_tcl_usable_by_fossil {} {
462

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button