# # # add_file "tests/automate_show_conflicts/expected-content-attached.stdout" # content [8a0d74dc6a9da3441fac2dd413d558d8a66b8228] # # add_file "tests/automate_show_conflicts/expected-content-detached.stdout" # content [bbb2b7df6e757607c02ec538f8612b484bbfd287] # # patch "roster_merge.cc" # from [f777b6fd3259a2e04b5b58f888796bd89d7b6c1d] # to [ead7941916d41d74a9a243662beb7762b5bf05fb] # # patch "tests/automate_show_conflicts/expected-attribute-attached.stdout" # from [4daf93c51c4699dd73bccceb83923417d27b88aa] # to [fa0c84e4e5afa446740c2b8a9ba0076af9b8d456] # # patch "tests/automate_show_conflicts/expected-attribute-detached.stdout" # from [1d130232bac4d4aa470591b0f3c01bc18d123c5f] # to [1c448e949539b7a1e2dd9150fc96bc4b6599d32d] # ============================================================ --- tests/automate_show_conflicts/expected-content-attached.stdout 8a0d74dc6a9da3441fac2dd413d558d8a66b8228 +++ tests/automate_show_conflicts/expected-content-attached.stdout 8a0d74dc6a9da3441fac2dd413d558d8a66b8228 @@ -0,0 +1,30 @@ + left [0b9e5111f3e13ccb1727bc936aff962020dc9809] + right [49d6a10f5f09b064a35f1700966795ae698f0555] +ancestor [7d854bf031420b7a5c1cafcb908f1020593196a8] + + conflict "content" + node_type "file" + ancestor_name "bar" +ancestor_file_id [f0ef49fe92167fe2a086588019ffcff7ea561786] + left_name "bar" + left_file_id [08cd878106a93ce2ef036a32499c1432adb3ee0d] + right_name "bar" + right_file_id [0cf419dd93d38b2daaaf1f5e0f3ec647745b9690] + + conflict "content" + node_type "file" + ancestor_name "baz" +ancestor_file_id [55320c8cee4b87edb47ec6d7e678af53eed2c717] + left_name "baz" + left_file_id [4ba6aabe8949871079bb70b5ae0cd64d502def46] + right_name "baz" + right_file_id [ac923b3bc65d6638cdee243bd46b57d3e14ce4ee] + + conflict "content" + node_type "file" + ancestor_name "foo" +ancestor_file_id [26798f895189be8aa9a366011e3253c738966010] + left_name "foo" + left_file_id [e6b176b142ff08e09a1d8f836b5c65d9f650c0ef] + right_name "foo" + right_file_id [5d4daf4aff681dfcb97cca561ec06298489fafa3] ============================================================ --- tests/automate_show_conflicts/expected-content-detached.stdout bbb2b7df6e757607c02ec538f8612b484bbfd287 +++ tests/automate_show_conflicts/expected-content-detached.stdout bbb2b7df6e757607c02ec538f8612b484bbfd287 @@ -0,0 +1,24 @@ + left [7a4c8dae08866a0c65a5a136eeca82f85e028837] + right [40a6208fa7406a393823d33aecae509c80db37b4] +ancestor [936159c798b9bb3f5d0f871a0dda158a844e9348] + + conflict "multiple names" + left_type "renamed file" + ancestor_name "foo" +ancestor_file_id [50bf338804db2685a575124c8c8371d06b65c523] + left_name "bar" + left_file_id [f1bb6fff2ad16d67143d89fc374ede7abec5d437] + right_type "renamed file" + ancestor_name "foo" +ancestor_file_id [50bf338804db2685a575124c8c8371d06b65c523] + right_name "baz" + right_file_id [b966b2d35b99e456cb0c55e4573ef0b1b155b4a9] + + conflict "content" + node_type "file" + ancestor_name "foo" +ancestor_file_id [50bf338804db2685a575124c8c8371d06b65c523] + left_name "bar" + left_file_id [f1bb6fff2ad16d67143d89fc374ede7abec5d437] + right_name "baz" + right_file_id [b966b2d35b99e456cb0c55e4573ef0b1b155b4a9] ============================================================ --- roster_merge.cc f777b6fd3259a2e04b5b58f888796bd89d7b6c1d +++ roster_merge.cc ead7941916d41d74a9a243662beb7762b5bf05fb @@ -414,6 +414,58 @@ static void } static void +put_content_conflict (basic_io::stanza & st, + content_merge_adaptor & adaptor, + file_content_conflict const & conflict) +{ + // Always report ancestor, left, and right information, for completeness + + content_merge_database_adaptor & db_adaptor (dynamic_cast(adaptor)); + + // This ensures that the ancestor roster is computed + boost::shared_ptr ancestor_roster; + revision_id ancestor_rid; + db_adaptor.get_ancestral_roster (conflict.nid, ancestor_rid, ancestor_roster); + + boost::shared_ptr left_roster(db_adaptor.rosters[db_adaptor.left_rid]); + I(0 != left_roster); + boost::shared_ptr right_roster(db_adaptor.rosters[db_adaptor.right_rid]); + I(0 != right_roster); + + file_path ancestor_name; + file_path left_name; + file_path right_name; + + ancestor_roster->get_name (conflict.nid, ancestor_name); + left_roster->get_name (conflict.nid, left_name); + right_roster->get_name (conflict.nid, right_name); + + if (file_type == get_type (*ancestor_roster, conflict.nid)) + { + st.push_str_pair(syms::node_type, "file"); + file_id ancestor_fid; + db_adaptor.db.get_file_content (db_adaptor.lca, conflict.nid, ancestor_fid); + st.push_str_pair(syms::ancestor_name, ancestor_name.as_external()); + st.push_hex_pair(syms::ancestor_file_id, ancestor_fid.inner()); + file_id left_fid; + db_adaptor.db.get_file_content (db_adaptor.left_rid, conflict.nid, left_fid); + st.push_str_pair(syms::left_name, left_name.as_external()); + st.push_hex_pair(syms::left_file_id, left_fid.inner()); + file_id right_fid; + db_adaptor.db.get_file_content (db_adaptor.right_rid, conflict.nid, right_fid); + st.push_str_pair(syms::right_name, right_name.as_external()); + st.push_hex_pair(syms::right_file_id, right_fid.inner()); + } + else + { + st.push_str_pair(syms::node_type, "directory"); + st.push_str_pair(syms::ancestor_name, ancestor_name.as_external()); + st.push_str_pair(syms::left_name, left_name.as_external()); + st.push_str_pair(syms::right_name, right_name.as_external()); + } +} + +static void put_stanza (basic_io::stanza & st, std::ostream & output) { @@ -1030,7 +1082,7 @@ roster_merge_result::report_attribute_co { basic_io::stanza st; - st.push_str_pair(syms::conflict, "multiple attribute values"); + st.push_str_pair(syms::conflict, "attribute"); put_attr_conflict (st, adaptor, conflict); put_stanza (st, output); } @@ -1141,39 +1193,51 @@ roster_merge_result::report_file_content file_content_conflict const & conflict = file_content_conflicts[i]; MM(conflict); - if (roster.is_attached(conflict.nid)) + + if (basic_io) { - file_path name; - roster.get_name(conflict.nid, name); + basic_io::stanza st; - P(F("conflict: content conflict on file '%s'") - % name); - P(F("content hash is %s on the left") % conflict.left); - P(F("content hash is %s on the right") % conflict.right); + st.push_str_pair(syms::conflict, "content"); + put_content_conflict (st, adaptor, conflict); + put_stanza (st, output); } else { - // this node isn't attached in the merged roster and there - // isn't really a good name for it so report both the left - // and right names using a slightly different format + if (roster.is_attached(conflict.nid)) + { + file_path name; + roster.get_name(conflict.nid, name); - file_path left_name, right_name; - left_roster.get_name(conflict.nid, left_name); - right_roster.get_name(conflict.nid, right_name); + P(F("conflict: content conflict on file '%s'") + % name); + P(F("content hash is %s on the left") % conflict.left); + P(F("content hash is %s on the right") % conflict.right); + } + else + { + // this node isn't attached in the merged roster and there + // isn't really a good name for it so report both the left + // and right names using a slightly different format - shared_ptr lca_roster; - revision_id lca_rid; - file_path lca_name; + file_path left_name, right_name; + left_roster.get_name(conflict.nid, left_name); + right_roster.get_name(conflict.nid, right_name); - adaptor.get_ancestral_roster(conflict.nid, lca_rid, lca_roster); - lca_roster->get_name(conflict.nid, lca_name); + shared_ptr lca_roster; + revision_id lca_rid; + file_path lca_name; - P(F("conflict: content conflict on file '%s' from revision %s") - % lca_name % lca_rid); - P(F("content hash is %s on the left in file '%s'") - % conflict.left % left_name); - P(F("content hash is %s on the right in file '%s'") - % conflict.right % right_name); + adaptor.get_ancestral_roster(conflict.nid, lca_rid, lca_roster); + lca_roster->get_name(conflict.nid, lca_name); + + P(F("conflict: content conflict on file '%s' from revision %s") + % lca_name % lca_rid); + P(F("content hash is %s on the left in file '%s'") + % conflict.left % left_name); + P(F("content hash is %s on the right in file '%s'") + % conflict.right % right_name); + } } } } ============================================================ --- tests/automate_show_conflicts/expected-attribute-attached.stdout 4daf93c51c4699dd73bccceb83923417d27b88aa +++ tests/automate_show_conflicts/expected-attribute-attached.stdout fa0c84e4e5afa446740c2b8a9ba0076af9b8d456 @@ -1,8 +1,8 @@ ancestor [c79cbcfb99f7a5e547815669b150dd left [febd58929375e5820fb73dd258d3f53d77014aa9] right [feec4de91f4698bc77f1b50c82ee4513cc47ae8f] ancestor [c79cbcfb99f7a5e547815669b150dd3d9a28a598] - conflict "multiple attribute values" + conflict "attribute" node_type "file" attr_name "attr1" ancestor_name "foo" @@ -14,7 +14,7 @@ right_attr_value "valueZ" right_file_id [bab2022ff2ed13501a8a83bcc6bd53f5042141be] right_attr_value "valueZ" - conflict "multiple attribute values" + conflict "attribute" node_type "file" attr_name "attr2" ancestor_name "foo" ============================================================ --- tests/automate_show_conflicts/expected-attribute-detached.stdout 1d130232bac4d4aa470591b0f3c01bc18d123c5f +++ tests/automate_show_conflicts/expected-attribute-detached.stdout 1c448e949539b7a1e2dd9150fc96bc4b6599d32d @@ -14,7 +14,7 @@ ancestor_file_id [e80910e54d0bdea1b6d295 right_name "baz" right_file_id [e80910e54d0bdea1b6d295ada320b87aaf9fdc23] - conflict "multiple attribute values" + conflict "attribute" node_type "file" attr_name "attr1" ancestor_name "foo" @@ -26,7 +26,7 @@ right_attr_value "valueZ" right_file_id [e80910e54d0bdea1b6d295ada320b87aaf9fdc23] right_attr_value "valueZ" - conflict "multiple attribute values" + conflict "attribute" node_type "file" attr_name "attr2" ancestor_name "foo"