# # # add_dir "tests/merge_update_part_of_file" # # add_file "tests/merge_update_part_of_file/__driver__.lua" # content [17e950250eb7641a8a7710465aaf71de715d1218] # # add_file "tests/merge_update_part_of_file/after.diff" # content [48e13022c089817683c14884566546af358f7ce9] # # add_file "tests/merge_update_part_of_file/before.diff" # content [6dffe627ffe07df8df1f15670b065f16264cba6a] # # add_file "tests/merge_update_part_of_file/onechange" # content [471a577db9d77994fad74d428645753de962b908] # # add_file "tests/merge_update_part_of_file/original" # content [d398dd22a6c828326c2e0777d412aee0e9ddf4e7] # # add_file "tests/merge_update_part_of_file/twochanges" # content [5fa4faad2ca837dee66a3052efcd72353f554056] # ============================================================ --- tests/merge_update_part_of_file/__driver__.lua 17e950250eb7641a8a7710465aaf71de715d1218 +++ tests/merge_update_part_of_file/__driver__.lua 17e950250eb7641a8a7710465aaf71de715d1218 @@ -0,0 +1,46 @@ +-- +-- Checks updating of a file which already has part of the changes that +-- are in head. That already-committed chunk can confuse the merge +-- algorithm because of the similarities of the removed text from the +-- text that was left. +-- +-- This test goes like this: +-- 1. Commits a file that has two similar parts (conditionals). +-- 2. Removes one of the conditionals and commits it. +-- 3. Reverts to the previous revision. +-- 4. Applies the change done in 2 and another change in another part of +-- the file (which results in a diff with two chunks). +-- 5. Updates the workspace to the latest revision. +-- 6. A diff of the test file should only report the second chunk as +-- modified. +-- + +mtn_setup() + +check(get("original")) +check(get("onechange")) +check(get("twochanges")) +check(get("before.diff")) +check(get("after.diff")) + +copy("original", "testfile") +addfile("testfile") +commit() +anc = base_revision() + +copy("onechange", "testfile") +commit() + +revert_to(anc) +copy("twochanges", "testfile") +check(mtn("diff", "testfile"), 0, true) +canonicalize("stdout") +rename("stdout", "monodiff") +check(samefile("monodiff", "before.diff")) + +check(mtn("update"), 0, false, true) + +check(mtn("diff", "testfile"), 0, true) +canonicalize("stdout") +rename("stdout", "monodiff") +check(samefile("monodiff", "after.diff")) ============================================================ --- tests/merge_update_part_of_file/after.diff 48e13022c089817683c14884566546af358f7ce9 +++ tests/merge_update_part_of_file/after.diff 48e13022c089817683c14884566546af358f7ce9 @@ -0,0 +1,16 @@ +# +# old_revision [4ccc559f3c16f31c41ac4cb2357a1d9b51ee51f4] +# +# patch "testfile" +# from [471a577db9d77994fad74d428645753de962b908] +# to [5fa4faad2ca837dee66a3052efcd72353f554056] +# +============================================================ +--- testfile 471a577db9d77994fad74d428645753de962b908 ++++ testfile 5fa4faad2ca837dee66a3052efcd72353f554056 +@@ -13,4 +13,4 @@ chunks + two + chunks + ++line changed +-line to be changed ============================================================ --- tests/merge_update_part_of_file/before.diff 6dffe627ffe07df8df1f15670b065f16264cba6a +++ tests/merge_update_part_of_file/before.diff 6dffe627ffe07df8df1f15670b065f16264cba6a @@ -0,0 +1,27 @@ +# +# old_revision [b73a4e885d20f1b7e6e4e4898b4be74180ba62e3] +# +# patch "testfile" +# from [d398dd22a6c828326c2e0777d412aee0e9ddf4e7] +# to [5fa4faad2ca837dee66a3052efcd72353f554056] +# +============================================================ +--- testfile d398dd22a6c828326c2e0777d412aee0e9ddf4e7 ++++ testfile 5fa4faad2ca837dee66a3052efcd72353f554056 +@@ -2,10 +2,6 @@ fi + true + fi + +-if false; then +- false +-fi +- + this + is + a +@@ -17,4 +13,4 @@ chunks + two + chunks + ++line changed +-line to be changed ============================================================ --- tests/merge_update_part_of_file/onechange 471a577db9d77994fad74d428645753de962b908 +++ tests/merge_update_part_of_file/onechange 471a577db9d77994fad74d428645753de962b908 @@ -0,0 +1,16 @@ +if true; then + true +fi + +this +is +a +long +text +used +to +separate +two +chunks + +line to be changed ============================================================ --- tests/merge_update_part_of_file/original d398dd22a6c828326c2e0777d412aee0e9ddf4e7 +++ tests/merge_update_part_of_file/original d398dd22a6c828326c2e0777d412aee0e9ddf4e7 @@ -0,0 +1,20 @@ +if true; then + true +fi + +if false; then + false +fi + +this +is +a +long +text +used +to +separate +two +chunks + +line to be changed ============================================================ --- tests/merge_update_part_of_file/twochanges 5fa4faad2ca837dee66a3052efcd72353f554056 +++ tests/merge_update_part_of_file/twochanges 5fa4faad2ca837dee66a3052efcd72353f554056 @@ -0,0 +1,16 @@ +if true; then + true +fi + +this +is +a +long +text +used +to +separate +two +chunks + +line changed