# # # add_dir "tests/merge((patch_a),_(drop_a))" # # add_file "tests/merge((patch_a),_(drop_a))/__driver__.lua" # content [bc219dd7af69d3aac168acc48d12ac59f6edc305] # # patch "NEWS" # from [f0020c7fff4e02f237ab66b28383c35f59a998d1] # to [830d7f355004247a6bdd8d872226e83d0be7bb85] # # patch "roster_merge.cc" # from [5cbf793f50cf62a073ce837d337569d4ddb9475b] # to [5042fc18ffc1014ae6cdf878305617b8ae0e8999] # ============================================================ --- tests/merge((patch_a),_(drop_a))/__driver__.lua bc219dd7af69d3aac168acc48d12ac59f6edc305 +++ tests/merge((patch_a),_(drop_a))/__driver__.lua bc219dd7af69d3aac168acc48d12ac59f6edc305 @@ -0,0 +1,27 @@ + +mtn_setup() + +writefile("base", "foo blah") +writefile("left", "bar blah") + +copy("base", "testfile") +check(mtn("add", "testfile"), 0, false, false) +commit() +base = base_revision() + +copy("left", "testfile") +commit() +left = base_revision() + +revert_to(base) + +check(mtn("drop", "testfile"), 0, false, false) +commit() + +check(mtn("merge"), 0, false, true) + +-- check that we're warned about the changes being dropped... + +check(qgrep("Content changes to the file", "stderr")) +check(qgrep(left, "stderr")) + ============================================================ --- NEWS f0020c7fff4e02f237ab66b28383c35f59a998d1 +++ NEWS 830d7f355004247a6bdd8d872226e83d0be7bb85 @@ -11,6 +11,9 @@ - mtn log now prints a single dot for a project's root directory instead of an empty string. + - mtn now warns if changes to a file will be ignored because + the file has been deleted on one side of a merge. + Internal - Update Botan to 1.7.2. ============================================================ --- roster_merge.cc 5cbf793f50cf62a073ce837d337569d4ddb9475b +++ roster_merge.cc 5042fc18ffc1014ae6cdf878305617b8ae0e8999 @@ -267,11 +267,37 @@ namespace insert_if_unborn(node_t const & n, marking_map const & markings, set const & uncommon_ancestors, + roster_t const & parent_roster, roster_t & new_roster) { revision_id const & birth = safe_get(markings, n->self).birth_revision; if (uncommon_ancestors.find(birth) != uncommon_ancestors.end()) create_node_for(n, new_roster); + else + { + // In this branch we are NOT inserting the node into the new roster as it + // has been deleted from the other side of the merge. + // In this case, output a warning if there are changes to the file on the + // side of the merge where it still exists. + set const & content_marks = safe_get(markings, n->self).file_content; + bool found_one_ignored_content = false; + for (set::const_iterator it = content_marks.begin(); it != content_marks.end(); it++) + { + if (uncommon_ancestors.find(*it) != uncommon_ancestors.end()) + { + if (!found_one_ignored_content) + { + file_path fp; + parent_roster.get_name(n->self, fp); + W(F("Content changes to the file \"%s\"") % fp); + W(F("will be ignored during this merge as the file has been")); + W(F("removed on one side of the merge. Affected revisions include:")); + } + found_one_ignored_content = true; + W(F("Revision : %s") % *it); + } + } + } } bool @@ -411,13 +437,13 @@ roster_merge(roster_t const & left_paren case parallel::in_left: insert_if_unborn(i.left_data(), - left_markings, left_uncommon_ancestors, + left_markings, left_uncommon_ancestors, left_parent, result.roster); break; case parallel::in_right: insert_if_unborn(i.right_data(), - right_markings, right_uncommon_ancestors, + right_markings, right_uncommon_ancestors, right_parent, result.roster); break;