# # # add_file "tests/merge_with_conflicting_name_and_renamed_dir/expected.stdout" # content [d5c917a78297e3c2abc113d04eaae5f61ae44e23] # # patch "NEWS" # from [7d6fb5fb42dc6351f7bd7a5dbac82273994498de] # to [e7df568a1ba702a6b8a843b3d0db6995da1d0c96] # # patch "roster_merge.cc" # from [2f1f8567e9ac91283175b0d4b245b469394939db] # to [a1b9408999d3d7f7d75686f4b9ef9325422afa7a] # # patch "tests/automate_show_conflicts/expected-duplicate-name-multiple-name-missing-root.stdout" # from [b7fde67bcbe78d888f10a4b3822428ea9174fd43] # to [ada9f4764d92f2a8e5f2a286adf56b837b312d32] # # patch "tests/merge_with_conflicting_name_and_renamed_dir/__driver__.lua" # from [a321dc78aef12dc78e2a47ab269f2ccd280f35ff] # to [8cc726016628bfe2c7a6be98a86e45ccc07e58fa] # ============================================================ --- tests/merge_with_conflicting_name_and_renamed_dir/expected.stdout d5c917a78297e3c2abc113d04eaae5f61ae44e23 +++ tests/merge_with_conflicting_name_and_renamed_dir/expected.stdout d5c917a78297e3c2abc113d04eaae5f61ae44e23 @@ -0,0 +1,11 @@ + left [3e5ae9c2084d1ab530cd9690bac5e45ee6db7ade] + right [e7d401d9de91696feaf17569337d10ed6e02a9b5] +ancestor [51ccdc67277ec1461e1140df66fd00d56db3e7b5] + + conflict "duplicate name" + left_type "added file" + left_name "foo/x" + left_file_id [75e12a4830b87d440b8ecadbdbcdf20842278d30] + right_type "added file" + right_name "bar/x" +right_file_id [53059abba1a72c7aff34a3eaf7fef10ed65541ce] ============================================================ --- NEWS 7d6fb5fb42dc6351f7bd7a5dbac82273994498de +++ NEWS e7df568a1ba702a6b8a843b3d0db6995da1d0c96 @@ -34,6 +34,8 @@ query the parent(s) of the workspace' base revision. This is equivalent to "mtn au select p:`mtn au get_base_workspace_revision`". + - Add 'automate show_conflicts' command + Internal - Update Botan to 1.7.4. ============================================================ --- roster_merge.cc 2f1f8567e9ac91283175b0d4b245b469394939db +++ roster_merge.cc a1b9408999d3d7f7d75686f4b9ef9325422afa7a @@ -541,18 +541,57 @@ roster_merge_result::report_missing_root else if (left_root == left_lca_root && right_root != right_lca_root) { if (!left_roster.has_node(right_root)) - P(F("directory '%s' deleted on the left") % right_lca_name); - P(F("directory '%s' pivoted to root on the right") % right_lca_name); + if (basic_io) + { + st.push_str_pair(syms::left_type, "deleted directory"); + st.push_str_pair(syms::ancestor_name, right_lca_name.as_external()); + } + else + P(F("directory '%s' deleted on the left") % right_lca_name); + + if (basic_io) + { + st.push_str_pair(syms::right_type, "pivoted root"); + st.push_str_pair(syms::ancestor_name, right_lca_name.as_external()); + } + else + P(F("directory '%s' pivoted to root on the right") % right_lca_name); } else if (left_root != left_lca_root && right_root != right_lca_root) { - P(F("directory '%s' pivoted to root on the left") % left_lca_name); + if (basic_io) + { + st.push_str_pair(syms::left_type, "pivoted root"); + st.push_str_pair(syms::ancestor_name, left_lca_name.as_external()); + } + else + P(F("directory '%s' pivoted to root on the left") % left_lca_name); + if (!right_roster.has_node(left_root)) - P(F("directory '%s' deleted on the right") % left_lca_name); + if (basic_io) + { + st.push_str_pair(syms::right_type, "deleted directory"); + st.push_str_pair(syms::ancestor_name, left_lca_name.as_external()); + } + else + P(F("directory '%s' deleted on the right") % left_lca_name); if (!left_roster.has_node(right_root)) - P(F("directory '%s' deleted on the left") % right_lca_name); - P(F("directory '%s' pivoted to root on the right") % right_lca_name); + if (basic_io) + { + st.push_str_pair(syms::left_type, "deleted directory"); + st.push_str_pair(syms::ancestor_name, right_lca_name.as_external()); + } + else + P(F("directory '%s' deleted on the left") % right_lca_name); + + if (basic_io) + { + st.push_str_pair(syms::right_type, "pivoted root"); + st.push_str_pair(syms::ancestor_name, right_lca_name.as_external()); + } + else + P(F("directory '%s' pivoted to root on the right") % right_lca_name); } // else // other conflicts can cause the root dir to be left detached @@ -630,20 +669,32 @@ roster_merge_result::report_invalid_name } else if (right_roster.root()->self == conflict.parent_name.first) { - P(F("'%s' pivoted to root on the right") - % lca_parent_name); + if (basic_io) + { + st.push_str_pair(syms::right_type, "pivoted root"); + st.push_str_pair(syms::ancestor_name, lca_parent_name.as_external()); + } + else + P(F("'%s' pivoted to root on the right") + % lca_parent_name); file_path left_name; left_roster.get_name(conflict.nid, left_name); if (parent_lca_roster->has_node(conflict.nid)) { - P(F("'%s' renamed to '%s' on the left") - % lca_name % left_name); + if (basic_io) + put_rename_conflict_left (st, adaptor, conflict.nid); + else + P(F("'%s' renamed to '%s' on the left") + % lca_name % left_name); } else { - P(F("'%s' added in revision %s on the left") - % left_name % lca_rid); + if (basic_io) + put_added_conflict_left (st, adaptor, conflict.nid); + else + P(F("'%s' added in revision %s on the left") + % left_name % lca_rid); } } else @@ -822,26 +873,38 @@ roster_merge_result::report_orphaned_nod right_roster.get_name(conflict.nid, orphan_name); right_roster.get_name(conflict.parent_name.first, parent_name); - P(F("parent directory '%s' was deleted on the left") - % parent_name); + if (basic_io) + { + st.push_str_pair(syms::left_type, "deleted directory"); + st.push_str_pair(syms::ancestor_name, parent_name.as_external()); + } + else + P(F("parent directory '%s' was deleted on the left") + % parent_name); if (parent_lca_roster->has_node(conflict.nid)) { - if (type == file_type) - P(F("file '%s' was renamed from '%s' on the right") - % orphan_name % lca_name); + if (basic_io) + put_rename_conflict_right (st, adaptor, conflict.nid); else - P(F("directory '%s' was renamed from '%s' on the right") - % orphan_name % lca_name); + if (type == file_type) + P(F("file '%s' was renamed from '%s' on the right") + % orphan_name % lca_name); + else + P(F("directory '%s' was renamed from '%s' on the right") + % orphan_name % lca_name); } else { - if (type == file_type) - P(F("file '%s' was added on the right") - % orphan_name); + if (basic_io) + put_added_conflict_right (st, adaptor, conflict.nid); else - P(F("directory '%s' was added on the right") - % orphan_name); + if (type == file_type) + P(F("file '%s' was added on the right") + % orphan_name); + else + P(F("directory '%s' was added on the right") + % orphan_name); } } else ============================================================ --- tests/automate_show_conflicts/expected-duplicate-name-multiple-name-missing-root.stdout b7fde67bcbe78d888f10a4b3822428ea9174fd43 +++ tests/automate_show_conflicts/expected-duplicate-name-multiple-name-missing-root.stdout ada9f4764d92f2a8e5f2a286adf56b837b312d32 @@ -1,8 +1,12 @@ ancestor [5bc669f00cf90b76dd38077827565b left [254fd127afd769a33979a843f5e3d8f2457097e6] right [6e0b7ffd0171d72db85dfc54234a78a35dd76cf3] ancestor [5bc669f00cf90b76dd38077827565b624d823756] -conflict "missing root" + conflict "missing root" + left_type "pivoted root" +ancestor_name "foo" + right_type "pivoted root" +ancestor_name "bar" conflict "multiple names" left_type "renamed directory" ============================================================ --- tests/merge_with_conflicting_name_and_renamed_dir/__driver__.lua a321dc78aef12dc78e2a47ab269f2ccd280f35ff +++ tests/merge_with_conflicting_name_and_renamed_dir/__driver__.lua 8cc726016628bfe2c7a6be98a86e45ccc07e58fa @@ -20,7 +20,7 @@ mtn_setup() -- ' !BOOM! ' o merge should fail due to -- duplicate names -- --- The merge currently failes with: +-- The merge previously failed with: -- ../nvm/roster_merge.cc:528: invariant 'I(left_name == right_name)' violated revs = {} @@ -47,3 +47,15 @@ check(qgrep("conflict: duplicate name", check(mtn("merge"), 1, false, true) check(qgrep("conflict: duplicate name", "stderr")) +-- Check automate show_conflicts output +-- +-- This does not mention the directory rename; we assume the tool +-- reading this output will figure it out. +expected = "expected.stdout" +check(get(expected)) + +check(mtn("automate", "show_conflicts"), 0, true, false) +canonicalize("stdout") +check(readfile(expected) == readfile("stdout")) + +-- end of file