# # # patch "database.cc" # from [40233e632e2045e6f9327d9c0dfe51e93491236c] # to [f22f2ec7d8c1741d20388581203084a34a290794] # # patch "roster_delta.cc" # from [e55ee69820c741d7ef44e8f2bfb094a2898bdebb] # to [4d06fa6a95df2ff254ce9572a57bc0b0d1bb7e52] # # patch "roster_delta.hh" # from [c469955ebc623dd5986883c7751a1010e530a963] # to [85506c111153554e2184a41cae920e4198890bfd] # ============================================================ --- database.cc 40233e632e2045e6f9327d9c0dfe51e93491236c +++ database.cc f22f2ec7d8c1741d20388581203084a34a290794 @@ -1412,7 +1412,7 @@ database::get_markings(revision_id const { roster_delta del; get_roster_delta(id.inner()(), *i, del); - bool found = get_markings_from_roster_delta(del, nid, markings); + bool found = try_get_markings_from_roster_delta(del, nid, markings); if (found) return; } @@ -1431,7 +1431,7 @@ database::get_markings(revision_id const { roster_delta del; get_roster_delta(target_rev, *p, del); - bool found = get_markings_from_roster_delta(del, nid, markings); + bool found = try_get_markings_from_roster_delta(del, nid, markings); if (found) return; } @@ -1477,7 +1477,7 @@ database::get_file_content(revision_id c { roster_delta del; get_roster_delta(id.inner()(), *i, del); - bool found = get_content_from_roster_delta(del, nid, content); + bool found = try_get_content_from_roster_delta(del, nid, content); if (found) return; } @@ -1496,7 +1496,7 @@ database::get_file_content(revision_id c { roster_delta del; get_roster_delta(target_rev, *p, del); - bool found = get_content_from_roster_delta(del, nid, content); + bool found = try_get_content_from_roster_delta(del, nid, content); if (found) return; } ============================================================ --- roster_delta.cc e55ee69820c741d7ef44e8f2bfb094a2898bdebb +++ roster_delta.cc 4d06fa6a95df2ff254ce9572a57bc0b0d1bb7e52 @@ -476,8 +476,8 @@ static } static -void get_roster_delta(roster_delta const & del, - roster_delta_t & d) +void read_roster_delta(roster_delta const & del, + roster_delta_t & d) { basic_io::input_source src(del.inner()(), "roster_delta"); basic_io::tokenizer tok(src); @@ -494,19 +494,19 @@ apply_roster_delta(roster_delta const & MM(markings); roster_delta_t d; - get_roster_delta(del, d); + read_roster_delta(del, d); d.apply(roster, markings); } // Extract the marking for one node from the roster delta, or return false // if they are not contained in that delta bool -get_markings_from_roster_delta(roster_delta const & del, - node_id const & nid, - marking_t & markings) +try_get_markings_from_roster_delta(roster_delta const & del, + node_id const & nid, + marking_t & markings) { roster_delta_t d; - get_roster_delta(del, d); + read_roster_delta(del, d); std::map::iterator i = d.markings_changed.find(nid); if (i != d.markings_changed.end()) @@ -520,15 +520,19 @@ get_markings_from_roster_delta(roster_de } } -// Extract the content hash for one node from the roster delta. Return false -// if this delta doesn't contain information about this node. +// Extract the content hash for one node from the roster delta -- if it is +// available. If we know what the file_id was, we return true and set +// 'content' appropriately. If we can prove that the file did not exist in +// this revision, we return true and set 'content' to a null id. If we +// cannot determine anything about the file contents, then we return false +// -- in this case content is left undefined. bool -get_content_from_roster_delta(roster_delta const & del, +try_get_content_from_roster_delta(roster_delta const & del, node_id const & nid, file_id & content) { roster_delta_t d; - get_roster_delta(del, d); + read_roster_delta(del, d); roster_delta_t::deltas_applied_t::const_iterator i = d.deltas_applied.find(nid); if (i != d.deltas_applied.end()) ============================================================ --- roster_delta.hh c469955ebc623dd5986883c7751a1010e530a963 +++ roster_delta.hh 85506c111153554e2184a41cae920e4198890bfd @@ -26,14 +26,15 @@ bool roster_t & roster, marking_map & markings); bool -get_markings_from_roster_delta(roster_delta const & del, - node_id const & nid, - marking_t & markings); +try_get_markings_from_roster_delta(roster_delta const & del, + node_id const & nid, + marking_t & markings); +// See the comment on this function's body for a description of its api. bool -get_content_from_roster_delta(roster_delta const & del, - node_id const & nid, - file_id & content); +try_get_content_from_roster_delta(roster_delta const & del, + node_id const & nid, + file_id & content); #ifdef BUILD_UNIT_TESTS