# # patch "roster.cc" # from [f9d2876167485c049868abf1469f511779bab613] # to [ffe9ce242c8197dc32586e516e652ad6ee97874a] # ======================================================================== --- roster.cc f9d2876167485c049868abf1469f511779bab613 +++ roster.cc ffe9ce242c8197dc32586e516e652ad6ee97874a @@ -1700,8 +1700,82 @@ } -/// getting rosters from the working copy +//////////////////////////////////////////////////////////////////// +// merging +//////////////////////////////////////////////////////////////////// +struct node_name_conflict +{ + node_id nid; + std::pair left, right; +}; + +struct file_content_conflict +{ + node_id nid; + file_id left, right; +}; + +struct node_attr_conflict +{ + node_id nid; + attr_key key; + std::pair left, right; +}; + +// structural conflicts: +// -- orphans +// -- directory containment loops +// -- multiple nodes with the same name +// renaming the root dir allows: +// -- MT in root +// -- missing root directory + +struct roster_merge_result +{ + std::vector node_name_conflicts; + std::vector file_content_conflicts; + std::vector node_attr_conflicts; + // this roster is sane iff is_clean() returns true + roster_t roster; + bool is_clean(); + void clear(); +}; + +bool +roster_merge_result::is_clean() +{ + return node_name_conflicts.empty() + && file_content_conflicts.empty() + && node_attr_conflicts.empty(); +} + +void +roster_merge_result::clear() +{ + node_attr_conflicts.clear(); + file_content_conflicts.clear(); + node_attr_conflicts.clear(); + roster = roster_t(); +} + +void +roster_merge(roster_t const & left_parent, + marking_map const & left_marking, + std::set left_uncommon_ancestors, + roster_t const & right_parent, + marking_map const & right_marking, + std::set right_uncommon_ancestors, + roster_merge_result & result) +{ + result.clear(); + +} + +//////////////////////////////////////////////////////////////////// +// getting rosters from the working copy +//////////////////////////////////////////////////////////////////// + inline static bool inodeprint_unchanged(inodeprint_map const & ipm, file_path const & path) {