#
# add_file "tests/t_drop_vs_patch_rename.at"
#
# patch "ChangeLog"
# from [2bc8c8ffa80a7a928c6b1f2134e6f024e93d8935]
# to [e86a2defcfd69c84d63947d1732e1cd49b613179]
#
# patch "change_set.cc"
# from [e963e597bcc9c332da6ff0d2593ac2c6e6e183ca]
# to [988bf342574bcfcb3cc9a370b450aa9300742c3c]
#
# patch "tests/t_drop_vs_patch_rename.at"
# from []
# to [1a6aca7fa842b2ea2bdac643970e5b4b652fe57d]
#
# patch "testsuite.at"
# from [c51c3fa1912eb930723b7167d87aee08312c8880]
# to [bf48975df98bcc87a58a906f0750f19bdaa71ccf]
#
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,11 @@
+2005-05-07 Matt Johnston
+
+ * change_set.cc: fix the code which skips deltas on deleted files,
+ it was looking at the merged filename not the ancestor
+ filename.
+ * tests/t_drop_vs_patch_rename.at: a test for the above fix
+ * testsuite.at: add it
+
2005-05-06 Timothy Brownawell
* contrib/monoprof.sh: Add lcad test.
--- change_set.cc
+++ change_set.cc
@@ -302,7 +302,7 @@
i != st.end(); ++i)
{
std::vector tmp_v;
- tmp.push_back(path_item_name(path_state_item(i)));
+ tmp_v.push_back(path_item_name(path_state_item(i)));
file_path tmp_fp;
compose_path(tmp_v, tmp_fp);
L(F("state '%s': tid %d, parent %d, type %s, name %s\n")
@@ -2079,19 +2079,21 @@
// now check to see if there was a delta on the b.second name in b
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))
+ {
+ L(F("skipping delta '%s'->'%s' on deleted file '%s'\n")
+ % delta_entry_src(i) % delta_entry_dst(i) % path_in_anc);
+ continue;
+ }
+
if (j == b.deltas.end())
{
- // if not, copy ours over using the merged name
+ // if no deltas in b, copy ours over using the merged name
L(F("merge is copying delta '%s' : '%s' -> '%s'\n")
% path_in_merged % delta_entry_src(i) % delta_entry_dst(i));
I(b.deltas.find(path_in_merged) == b.deltas.end());
- if (b.rearrangement.has_deleted_file(path_in_merged))
- // if the file was deleted on the other fork of the merge, then
- // we don't want to keep this delta.
- L(F("skipping delta '%s'->'%s' on deleted file '%s'\n")
- % delta_entry_src(i) % delta_entry_dst(i) % path_in_merged);
- else
- b_merged.apply_delta(path_in_merged, delta_entry_src(i), delta_entry_dst(i));
+ b_merged.apply_delta(path_in_merged, delta_entry_src(i), delta_entry_dst(i));
}
else
{
--- tests/t_drop_vs_patch_rename.at
+++ tests/t_drop_vs_patch_rename.at
@@ -0,0 +1,31 @@
+AT_SETUP([merge(, )])
+
+MONOTONE_SETUP
+
+AT_DATA(original, [some stuff here
+])
+
+AT_CHECK(MONOTONE add original, [], [ignore], [ignore])
+COMMIT(testbranch)
+BASE_R_SHA=`BASE_REVISION`
+
+# drop it
+AT_CHECK(MONOTONE drop original, [], [ignore], [ignore])
+COMMIT(testbranch)
+
+REVERT_TO($BASE_R_SHA)
+
+# patch and rename it
+AT_CHECK(mv original different)
+AT_CHECK(MONOTONE rename original different, [], [ignore], [ignore])
+echo "more" >> different
+COMMIT(testbranch)
+
+AT_CHECK(MONOTONE merge, [], [ignore], [ignore])
+AT_CHECK(MONOTONE checkout -b testbranch clean, [], [ignore], [ignore])
+
+# check that the file doesn't exist
+AT_CHECK(test -f clean/original, [1])
+AT_CHECK(test -f clean/different, [1])
+
+AT_CLEANUP
--- testsuite.at
+++ testsuite.at
@@ -610,3 +610,4 @@
m4_include(tests/t_cvsimport_deleted_invar.at)
m4_include(tests/t_rcfile_stdin.at)
m4_include(tests/t_monotone_up.at)
+m4_include(tests/t_drop_vs_patch_rename.at)