# # # patch "rcs_import.cc" # from [c4d0490a4b110be212437cc6cd7a6c93c9acd1f5] # to [0cc1ea60e086f5e9e6176a82581577827c1fd9b2] # ============================================================ --- rcs_import.cc c4d0490a4b110be212437cc6cd7a6c93c9acd1f5 +++ rcs_import.cc 0cc1ea60e086f5e9e6176a82581577827c1fd9b2 @@ -1330,20 +1330,6 @@ blob_consumer app_state & app; ticker & n_revisions; - struct prepared_revision - { - prepared_revision(revision_id i, - shared_ptr r, - const cvs_branchname bn, - const cvs_blob & blob); - revision_id rid; - shared_ptr rev; - cvs_branchname branchname; - time_t time; - cvs_authorclog authorclog; - vector tags; - }; - struct branch_state { revision_id current_rid; @@ -1355,8 +1341,6 @@ blob_consumer temp_node_id_source nis; map branch_states; - vector preps; - blob_consumer(cvs_history & cvs, app_state & app, ticker & n_revs); @@ -1365,8 +1349,6 @@ blob_consumer void add_missing_parents(branch_state & bstate, file_path const & path, cset & cs); void build_cset(const cvs_blob & blob, branch_state & bstate, cset & cs); - void store_auxiliary_certs(prepared_revision const & p); - void store_revisions(); }; struct blob_splitter @@ -1986,10 +1968,6 @@ resolve_blob_dependencies(cvs_history & L(FL("next blob number from toposort: %d") % *i); cons.consume_blob(*i); } - - // finally store the revisions - // (ms) why is this an extra step? Is it faster? - cons.store_revisions(); } void @@ -2070,54 +2048,7 @@ blob_consumer::blob_consumer(cvs_history cvs.base_branch, branch_state())); } -blob_consumer::prepared_revision::prepared_revision(revision_id i, - shared_ptr r, - const cvs_branchname bn, - const cvs_blob & blob) - : rid(i), - rev(r), - branchname(bn) -{ - I(blob.get_digest().is_commit()); - - shared_ptr ce = - boost::static_pointer_cast(*blob.begin()); - - authorclog = ce->authorclog; - - // FIXME: calculate an avg time - time = ce->time; -} - - void -blob_consumer::store_revisions() -{ - if (! app.opts.dryrun) - for (vector::const_iterator i = preps.begin(); - i != preps.end(); ++i) - if (app.db.put_revision(i->rid, *(i->rev))) - { - store_auxiliary_certs(*i); - ++n_revisions; - } -} - -void -blob_consumer::store_auxiliary_certs(prepared_revision const & p) -{ - string author, changelog; - - cvs.split_authorclog(p.authorclog, author, changelog); - string bn = cvs.get_branchname(p.branchname); - app.get_project().put_standard_certs(p.rid, - branch_name(bn), - utf8(changelog), - date_t::from_unix_epoch(p.time), - utf8(author)); -} - -void blob_consumer::add_missing_parents(branch_state & bstate, file_path const & path, cset & cs) { @@ -2376,8 +2307,28 @@ blob_consumer::consume_blob(cvs_blob_ind calculate_ident(*rev, child_rid); - preps.push_back(prepared_revision(child_rid, rev, in_branch, blob)); + if (!app.opts.dryrun) + { + if (app.db.put_revision(child_rid, *rev)) + { + // FIXME: calculate an avg time + time_t commit_time = ce->time; + string author, changelog; + cvs.split_authorclog(ce->authorclog, author, changelog); + string bn = cvs.get_branchname(in_branch); + app.get_project().put_standard_certs(child_rid, + branch_name(bn), + utf8(changelog), + date_t::from_unix_epoch(commit_time), + utf8(author)); + + ++n_revisions; + } + else + I(false); // revision shouldn't exist already! + } + bstate.current_rid = child_rid; } else if (blob.get_digest().is_branch())