# # add_file "tests/t_drop_vs_dropadd.at" # # patch "ChangeLog" # from [5761c2caa715f2af4b1c74862ba2678668614393] # to [50fa8303aeb55d364c932720badca25be590865f] # # patch "change_set.cc" # from [988bf342574bcfcb3cc9a370b450aa9300742c3c] # to [803ba53c5e9aafcbc72169471fec66bcee20e14d] # # patch "tests/t_drop_vs_dropadd.at" # from [] # to [ca2bd0804f09260fff1d6b1c714a1f4cd1c5ea52] # # patch "testsuite.at" # from [27c292ee9a1b44803538b41dcb94b3203f707553] # to [d00c7fd5682d22065ccd27df2b0e2b152c6582c1] # --- ChangeLog +++ ChangeLog @@ -1,3 +1,10 @@ +2005-05-19 Matt Johnston + + * change_set.cc (merge_disjoint_analyses): handle the case where + a file is dropped on both sides but re-added on one. + * tests/t_drop_vs_dropadd.at: a test for it + * testsuite.at + 2005-05-19 Derek Scherger * commands.cc (checkout): rearrange to use --revision option --- change_set.cc +++ change_set.cc @@ -2080,7 +2080,8 @@ change_set::delta_map::const_iterator j = b.deltas.find(path_in_b_second); // if the file was deleted in b, we don't want to copy this delta. - if (b.rearrangement.has_deleted_file(path_in_anc)) + if (b.rearrangement.has_deleted_file(path_in_anc) + && !(a.rearrangement.has_added_file(path_in_merged))) { L(F("skipping delta '%s'->'%s' on deleted file '%s'\n") % delta_entry_src(i) % delta_entry_dst(i) % path_in_anc); --- tests/t_drop_vs_dropadd.at +++ tests/t_drop_vs_dropadd.at @@ -0,0 +1,47 @@ + +AT_SETUP([merge(, )]) + +MONOTONE_SETUP + +AT_DATA(original, [some stuff here +]) + +AT_DATA(replaced, [the re-added file +]) + +AT_DATA(nonce, [...nothing here... +]) + +AT_CHECK(cp original testfile) +AT_CHECK(MONOTONE add testfile, [], [ignore], [ignore]) +COMMIT(testbranch) +BASE_R_SHA=`BASE_REVISION` + +# drop it +AT_CHECK(MONOTONE drop testfile, [], [ignore], [ignore]) +COMMIT(testbranch) + +REVERT_TO($BASE_R_SHA) + +# on the other side of the fork, drop it ... +AT_CHECK(MONOTONE drop testfile, [], [ignore], [ignore]) +# we add this file so that we don't end up with the same revision as +# our first "drop" commit +AT_CHECK(MONOTONE add nonce, [], [ignore], [ignore]) +COMMIT(testbranch) + +# ... and add the replacement +# on the other side of the fork, drop it +AT_CHECK(cp replaced testfile) +AT_CHECK(MONOTONE add testfile, [], [ignore], [ignore]) +COMMIT(testbranch) + +AT_CHECK(MONOTONE merge, [], [ignore], [ignore]) +AT_CHECK(MONOTONE checkout -b testbranch clean, [], [ignore], [ignore]) + +# check that the file is the replacement one +AT_CHECK(cmp clean/testfile replaced) +# just for good measure +AT_CHECK(cmp clean/nonce nonce) + +AT_CLEANUP --- testsuite.at +++ testsuite.at @@ -645,3 +645,4 @@ m4_include(tests/t_unidiff3.at) m4_include(tests/t_netsync_permissions.at) m4_include(tests/t_update_with_blocked_rename.at) +m4_include(tests/t_drop_vs_dropadd.at)