# # # patch "legacy.cc" # from [7bc35fea7ce2533ea4aa4a2c71d79ded850be929] # to [66f826bd1f889591db9cdb3bb20fd308b2209537] # # patch "legacy.hh" # from [5f191e1160c82979a87a0720b8fbc2d80a89ac0f] # to [09d14a7e12c496b847a17a737074ef6f38cccf85] # # patch "revision.cc" # from [b2597ab7bee5ccbfee7485c5c8d78f1219964e22] # to [767a778ac41aaf5e57fb90e4aeecca057acca90c] # ============================================================ --- legacy.cc 7bc35fea7ce2533ea4aa4a2c71d79ded850be929 +++ legacy.cc 66f826bd1f889591db9cdb3bb20fd308b2209537 @@ -5,6 +5,7 @@ #include "legacy.hh" #include "basic_io.hh" +#include "app_state.hh" namespace legacy { @@ -34,4 +35,39 @@ } } } + + namespace + { + namespace syms + { + std::string const old_revision("old_revision"); + std::string const new_manifest("new_manifest"); + } + } + + void + get_manifest_for_rev(app_state & app, + revision_id const & ident, + manifest_id & mid) + { + revision_data dat; + app.db.get_revision(ident,dat); + basic_io::input_source src(dat.inner()(), "revision"); + basic_io::tokenizer tok(src); + basic_io::parser pars(tok); + while (pars.symp()) + { + if (pars.symp(syms::new_manifest)) + { + std::string tmp; + pars.sym(); + pars.hex(tmp); + mid = manifest_id(tmp); + return; + } + else + pars.sym(); + } + I(false); + } } ============================================================ --- legacy.hh 5f191e1160c82979a87a0720b8fbc2d80a89ac0f +++ legacy.hh 09d14a7e12c496b847a17a737074ef6f38cccf85 @@ -19,6 +19,18 @@ void read_dot_mt_attrs(data const & dat, dot_mt_attrs_map & attr); + + // HACK: this is a special reader which picks out the new_manifest field in + // a revision; it ignores all other symbols. This is because, in the + // pre-roster database, we have revisions holding change_sets, not + // csets. If we apply the cset reader to them, they fault. We need to + // *partially* read them, however, in order to get the manifest IDs out of + // the old revisions (before we delete the revs and rebuild them) + + void + get_manifest_for_rev(app_state & app, + revision_id const & ident, + manifest_id & mid); } #endif ============================================================ --- revision.cc b2597ab7bee5ccbfee7485c5c8d78f1219964e22 +++ revision.cc 767a778ac41aaf5e57fb90e4aeecca057acca90c @@ -773,11 +773,6 @@ return node; } -static void -get_manifest_for_rev(app_state & app, - revision_id const & ident, - manifest_id & mid); - u64 anc_graph::add_node_for_oldstyle_revision(revision_id const & rev) { I(existing_graph); @@ -789,7 +784,7 @@ ++n_nodes; manifest_id man; - get_manifest_for_rev(app, rev, man); + legacy::get_manifest_for_rev(app, rev, man); L(F("node %d = revision %s = manifest %s\n") % node % rev % man); old_rev_to_node.insert(std::make_pair(rev, node)); @@ -1181,7 +1176,7 @@ app.db.get_file_version(i->second, dat); legacy::dot_mt_attrs_map attrs; legacy::read_dot_mt_attrs(dat.inner(), attrs); - for (oldstyle_attr_map::const_iterator j = attrs.begin(); + for (legacy::dot_mt_attrs_map::const_iterator j = attrs.begin(); j != attrs.end(); ++j) { split_path sp; @@ -1369,41 +1364,6 @@ } } - -// HACK: this is a special reader which picks out the new_manifest field in -// a revision; it ignores all other symbols. This is because, in the -// pre-roster database, we have revisions holding change_sets, not -// csets. If we apply the cset reader to them, they fault. We need to -// *partially* read them, however, in order to get the manifest IDs out of -// the old revisions (before we delete the revs and rebuild them) - -static void -get_manifest_for_rev(app_state & app, - revision_id const & ident, - manifest_id & mid) -{ - revision_data dat; - app.db.get_revision(ident,dat); - basic_io::input_source src(dat.inner()(), "revision"); - basic_io::tokenizer tok(src); - basic_io::parser pars(tok); - while (pars.symp()) - { - if (pars.symp(syms::new_manifest)) - { - std::string tmp; - pars.sym(); - pars.hex(tmp); - mid = manifest_id(tmp); - return; - } - else - pars.sym(); - } - I(false); -} - - void print_edge(basic_io::printer & printer, edge_entry const & e)