# # # patch "database.cc" # from [ef9b1b0d0967d3af9fce5568d3f3fb989b73475d] # to [e5dc9b4808c430fe3de84c9fb628e55596d64d22] # # patch "legacy.cc" # from [66f826bd1f889591db9cdb3bb20fd308b2209537] # to [bd227764e3736c41e9b135c9b644d5c40a10d21d] # # patch "legacy.hh" # from [3f55febed1c4c75bd0e23ce7ddd25210144ae43c] # to [593a5212d29b6e5abb730c6fe7e20146cfec5385] # # patch "revision.cc" # from [767a778ac41aaf5e57fb90e4aeecca057acca90c] # to [3c217a80fe44c479fb67f79ae610ef2c1a32e43f] # ============================================================ --- database.cc ef9b1b0d0967d3af9fce5568d3f3fb989b73475d +++ database.cc e5dc9b4808c430fe3de84c9fb628e55596d64d22 @@ -1363,15 +1363,6 @@ } void -database::get_manifest(manifest_id const & id, - manifest_map & mm) -{ - manifest_data mdat; - get_manifest_version(id, mdat); - read_manifest_map(mdat, mm); -} - -void database::put_file(file_id const & id, file_data const & dat) { @@ -2191,32 +2182,6 @@ void database::complete(string const & partial, - set & completions) -{ - results res; - completions.clear(); - - string pattern = partial + "*"; - - fetch(res, 1, any_rows, - "SELECT id FROM manifests WHERE id GLOB ?", - pattern.c_str()); - - for (size_t i = 0; i < res.size(); ++i) - completions.insert(manifest_id(res[i][0])); - - res.clear(); - - fetch(res, 1, any_rows, - "SELECT id FROM manifest_deltas WHERE id GLOB ?", - pattern.c_str()); - - for (size_t i = 0; i < res.size(); ++i) - completions.insert(manifest_id(res[i][0])); -} - -void -database::complete(string const & partial, set & completions) { results res; ============================================================ --- legacy.cc 66f826bd1f889591db9cdb3bb20fd308b2209537 +++ legacy.cc bd227764e3736c41e9b135c9b644d5c40a10d21d @@ -6,6 +6,7 @@ #include "legacy.hh" #include "basic_io.hh" #include "app_state.hh" +#include "constants.hh" namespace legacy { @@ -70,4 +71,40 @@ } I(false); } + + + void + read_manifest_map(data const & dat, + manifest_map & man) + { + std::string::size_type pos = 0; + while (pos != dat().size()) + { + // whenever we get here, pos points to the beginning of a manifest + // line + // manifest file has 40 characters hash, then 2 characters space, then + // everything until next \n is filename. + std::string ident = dat().substr(pos, constants::idlen); + std::string::size_type file_name_begin = pos + constants::idlen + 2; + pos = dat().find('\n', file_name_begin); + std::string file_name; + if (pos == std::string::npos) + file_name = dat().substr(file_name_begin); + else + file_name = dat().substr(file_name_begin, pos - file_name_begin); + man.insert(std::make_pair(file_path_internal(file_name), + hexenc(ident))); + // skip past the '\n' + ++pos; + } + return; + } + + void + read_manifest_map(manifest_data const & dat, + manifest_map & man) + { + read_manifest_map(dat.inner(), man); + } + } ============================================================ --- legacy.hh 3f55febed1c4c75bd0e23ce7ddd25210144ae43c +++ legacy.hh 593a5212d29b6e5abb730c6fe7e20146cfec5385 @@ -39,10 +39,12 @@ /////// // parsing old-style manifests, for 'rosterify' and 'changesetify' commands - typedef std::pair manifest_entry; typedef std::map, - QA(manifest_entry) > manifest_map; + std::less > manifest_map; + void read_manifest_map(data const & dat, + manifest_map & man); + void read_manifest_map(manifest_data const & dat, + manifest_map & man); } ============================================================ --- revision.cc 767a778ac41aaf5e57fb90e4aeecca057acca90c +++ revision.cc 3c217a80fe44c479fb67f79ae610ef2c1a32e43f @@ -1128,10 +1128,12 @@ L(F("processing node %d\n") % child); manifest_id old_child_mid; - manifest_map old_child_man; + legacy::manifest_map old_child_man; get_node_manifest(child, old_child_mid); - app.db.get_manifest(old_child_mid, old_child_man); + manifest_data mdat; + app.db.get_manifest_version(old_child_mid, mdat); + legacy::read_manifest_map(mdat, old_child_man); // Load all the parent rosters into a temporary roster map parent_roster_map parent_rosters; @@ -1156,7 +1158,7 @@ roster_t child_roster; MM(child_roster); temp_node_id_source nis; - for (manifest_map::const_iterator i = old_child_man.begin(); + for (legacy::manifest_map::const_iterator i = old_child_man.begin(); i != old_child_man.end(); ++i) { if (!(i->first == attr_path)) @@ -1169,7 +1171,7 @@ // migrate attributes out of .mt-attrs { - manifest_map::const_iterator i = old_child_man.find(attr_path); + legacy::manifest_map::const_iterator i = old_child_man.find(attr_path); if (i != old_child_man.end()) { file_data dat;