# # # patch "annotate.cc" # from [cbd85ba009acf915ed81f81facaece3df478ca0b] # to [e2d60b0f0c64accab92bed62d0b45a2a9281160a] # # patch "annotate.hh" # from [bb1f437d65a043cb2aa763835632551d7041fbb3] # to [94f7fb620b8fe37ed5e83975a1ea944fbff089fd] # # patch "automate.cc" # from [e688920b10fa396e5905dabff6de466f7a044158] # to [1165da4aac8418c1bde2dfa71747e8cc46a6541d] # # patch "cmd_files.cc" # from [99e62a44c75f7463e1ed37a92c14a26f6c9184cc] # to [54fe77df26911485cf7af092e61cb565a6ade369] # # patch "cmd_list.cc" # from [866bc63bb2443fc1260f2cebcfdfbdfc9a358e02] # to [99af2b16b3355b6eb57a02299d31cc88285265a8] # # patch "cmd_merging.cc" # from [63784e8d2c75c976e83e63303e09e455c562ce55] # to [60d92e3c90b4ca18c0460603fbef81fcc088a02a] # # patch "update.cc" # from [370ff546900209b02ac77b6fe2e9dc3a9ffc1932] # to [8dcb986a24fa82f06baa594ade6c1de1d925c71f] # # patch "update.hh" # from [2dc36b9ef125c3861bf4e45477caf1d29b7daa78] # to [3e7b3c756bdd0a55ae4527cc54a4e99404879b08] # ============================================================ --- annotate.cc cbd85ba009acf915ed81f81facaece3df478ca0b +++ annotate.cc e2d60b0f0c64accab92bed62d0b45a2a9281160a @@ -58,7 +58,7 @@ public: class annotate_context { public: - annotate_context(file_id fid, database & db); + annotate_context(file_id fid, database & db, project_t & project); shared_ptr initial_lineage() const; @@ -75,7 +75,7 @@ public: /// return true if we have no more unassigned lines bool is_complete() const; - void dump(database & db, bool just_revs) const; + void dump(bool just_revs) const; string get_line(int line_index) const { @@ -83,9 +83,14 @@ private: } private: - void build_revisions_to_annotations(database & db, - map & r2a) const; + void build_revisions_to_annotations(map & r2a) const; + database & db; + project_t & project; + + /// keep a count so we can tell quickly whether we can terminate + size_t annotated_lines_completed; + vector file_lines; vector annotations; @@ -93,9 +98,6 @@ private: /// revision as line m map equivalent_lines; - /// keep a count so we can tell quickly whether we can terminate - size_t annotated_lines_completed; - // elements of the set are indexes into the array of lines in the // UDOI lineages add entries here when they notice that they copied // a line from the UDOI @@ -205,8 +207,9 @@ typedef multi_index_container< > work_units; -annotate_context::annotate_context(file_id fid, database & db) - : annotated_lines_completed(0) +annotate_context::annotate_context(file_id fid, database & db, + project_t & project) + : db(db), project(project), annotated_lines_completed(0) { // initialize file_lines file_data fpacked; @@ -372,8 +375,7 @@ annotate_context::build_revisions_to_ann void annotate_context::build_revisions_to_annotations -(database & db, - map & revs_to_notations) const +(map & revs_to_notations) const { I(annotations.size() == file_lines.size()); @@ -392,7 +394,7 @@ annotate_context::build_revisions_to_ann i != seen.end(); i++) { vector< revision > certs; - db.get_project().get_revision_certs(*i, certs); + project.get_revision_certs(*i, certs); erase_bogus_certs(certs, db); string author(cert_string_value(certs, author_cert_name, @@ -425,7 +427,7 @@ void } void -annotate_context::dump(database & db, bool just_revs) const +annotate_context::dump(bool just_revs) const { revision_id nullid; I(annotations.size() == file_lines.size()); @@ -434,7 +436,7 @@ annotate_context::dump(database & db, bo string empty_note; if (!just_revs) { - build_revisions_to_annotations(db, revs_to_notations); + build_revisions_to_annotations(revs_to_notations); size_t max_note_length = revs_to_notations.begin()->second.size(); empty_note.insert(string::size_type(0), max_note_length - 2, ' '); } @@ -816,13 +818,14 @@ void } void -do_annotate (database & db, file_t file_node, revision_id rid, bool just_revs) +do_annotate (database & db, project_t & project, file_t file_node, + revision_id rid, bool just_revs) { L(FL("annotating file %s with content %s in revision %s") % file_node->self % file_node->content % rid); shared_ptr - acp(new annotate_context(file_node->content, db)); + acp(new annotate_context(file_node->content, db, project)); shared_ptr lineage = acp->initial_lineage(); @@ -861,7 +864,7 @@ do_annotate (database & db, file_t file_ acp->annotate_equivalent_lines(); I(acp->is_complete()); - acp->dump(db, just_revs); + acp->dump(just_revs); } // Local Variables: ============================================================ --- annotate.hh bb1f437d65a043cb2aa763835632551d7041fbb3 +++ annotate.hh 94f7fb620b8fe37ed5e83975a1ea944fbff089fd @@ -13,9 +13,11 @@ class database; #include "vocab.hh" #include "roster.hh" class database; +class project_t; void -do_annotate(database & db, file_t file_node, revision_id rid, bool just_revs); +do_annotate(database & db, project_t & project, + file_t file_node, revision_id rid, bool just_revs); // Local Variables: // mode: C++ ============================================================ --- automate.cc e688920b10fa396e5905dabff6de466f7a044158 +++ automate.cc 1165da4aac8418c1bde2dfa71747e8cc46a6541d @@ -1264,7 +1264,7 @@ CMD_AUTOMATE(packets_for_certs, N_("REVI N(db.revision_exists(r_id), F("no such revision '%s'") % r_id); - db.get_project().get_revision_certs(r_id, certs); + app.get_project().get_revision_certs(r_id, certs); for (size_t i = 0; i < certs.size(); ++i) pw.consume_revision_cert(idx(certs,i)); } @@ -1431,7 +1431,7 @@ CMD_AUTOMATE(branches, "", set names; - db.get_project().get_branch_list(names); + app.get_project().get_branch_list(names); for (set::const_iterator i = names.begin(); i != names.end(); ++i) @@ -1498,13 +1498,13 @@ CMD_AUTOMATE(tags, N_("[BRANCH_PATTERN]" prt.print_stanza(stz); set tags; - db.get_project().get_tags(tags); + app.get_project().get_tags(tags); for (set::const_iterator tag = tags.begin(); tag != tags.end(); ++tag) { set branches; - db.get_project().get_revision_branches(tag->ident, branches); + app.get_project().get_revision_branches(tag->ident, branches); bool show(!filtering); vector branch_names; ============================================================ --- cmd_files.cc 99e62a44c75f7463e1ed37a92c14a26f6c9184cc +++ cmd_files.cc 54fe77df26911485cf7af092e61cb565a6ade369 @@ -186,7 +186,7 @@ CMD(annotate, "annotate", "", CMD_REF(in file_t file_node = downcast_to_file_t(node); L(FL("annotate for file_id %s") % file_node->self); - do_annotate(app.db, file_node, rid, app.opts.revs_only); + do_annotate(app.db, app.get_project(), file_node, rid, app.opts.revs_only); } CMD(identify, "identify", "", CMD_REF(debug), N_("[PATH]"), ============================================================ --- cmd_list.cc 866bc63bb2443fc1260f2cebcfdfbdfc9a358e02 +++ cmd_list.cc 99af2b16b3355b6eb57a02299d31cc88285265a8 @@ -682,7 +682,7 @@ CMD_AUTOMATE(certs, N_("REV"), vector< revision > ts; // FIXME_PROJECTS: after projects are implemented, // use the db version instead if no project is specified. - db.get_project().get_revision_certs(rid, ts); + app.get_project().get_revision_certs(rid, ts); for (size_t i = 0; i < ts.size(); ++i) certs.push_back(idx(ts, i).inner()); ============================================================ --- cmd_merging.cc 63784e8d2c75c976e83e63303e09e455c562ce55 +++ cmd_merging.cc 60d92e3c90b4ca18c0460603fbef81fcc088a02a @@ -170,7 +170,7 @@ CMD(update, "update", "", CMD_REF(worksp { P(F("updating along branch '%s'") % app.opts.branchname); set candidates; - pick_update_candidates(old_rid, app.db, candidates); + pick_update_candidates(old_rid, app.db, app.get_project(), candidates); N(!candidates.empty(), F("your request matches no descendents of the current revision\n" "in fact, it doesn't even match the current revision\n" ============================================================ --- update.cc 370ff546900209b02ac77b6fe2e9dc3a9ffc1932 +++ update.cc 8dcb986a24fa82f06baa594ade6c1de1d925c71f @@ -54,10 +54,11 @@ get_test_results_for_revision(revision_i static void get_test_results_for_revision(revision_id const & id, map & results, - database & db) + database & db, project_t & project) { vector< revision > certs; - db.get_project().get_revision_certs_by_name(id, cert_name(testresult_cert_name), certs); + project.get_revision_certs_by_name(id, cert_name(testresult_cert_name), + certs); for (vector< revision >::const_iterator i = certs.begin(); i != certs.end(); ++i) { @@ -80,12 +81,12 @@ acceptable_descendent(branch_name const revision_id const & base, map & base_results, revision_id const & target, - database & db) + database & db, project_t & project) { L(FL("Considering update target %s") % target); // step 1: check the branch - if (!db.get_project().revision_is_in_branch(target, branch)) + if (!project.revision_is_in_branch(target, branch)) { L(FL("%s not in branch %s") % target % branch); return false; @@ -93,7 +94,7 @@ acceptable_descendent(branch_name const // step 2: check the testresults map target_results; - get_test_results_for_revision(target, target_results, db); + get_test_results_for_revision(target, target_results, db, project); if (db.hook_accept_testresult_change(base_results, target_results)) { L(FL("%s is acceptable update candidate") % target); @@ -133,17 +134,17 @@ calculate_update_set(revision_id const & static void calculate_update_set(revision_id const & base, branch_name const & branch, - database & db, + database & db, project_t & project, set & candidates) { map base_results; - get_test_results_for_revision(base, base_results, db); + get_test_results_for_revision(base, base_results, db, project); candidates.clear(); // we possibly insert base into the candidate set as well; returning a set // containing just it means that we are up to date; returning an empty set // means that there is no acceptable update. - if (acceptable_descendent(branch, base, base_results, base, db)) + if (acceptable_descendent(branch, base, base_results, base, db, project)) candidates.insert(base); // keep a visited set to avoid repeating work @@ -165,7 +166,8 @@ calculate_update_set(revision_id const & visited.insert(target); // then, possibly insert this revision as a candidate - if (acceptable_descendent(branch, base, base_results, target, db)) + if (acceptable_descendent(branch, base, base_results, + target, db, project)) candidates.insert(target); // and traverse its children as well @@ -174,24 +176,29 @@ calculate_update_set(revision_id const & } erase_ancestors(candidates, db); + + if (db.get_opt_ignore_suspend_certs()) + return; bool have_non_suspended_rev = false; - for (set::const_iterator it = candidates.begin(); it != candidates.end(); it++) + for (set::const_iterator it = candidates.begin(); + it != candidates.end(); it++) { - if (!db.get_project().revision_is_suspended_in_branch(*it, branch)) + if (!project.revision_is_suspended_in_branch(*it, branch)) { have_non_suspended_rev = true; break; } } - if (!db.get_opt_ignore_suspend_certs() && have_non_suspended_rev) + if (have_non_suspended_rev) { // remove all suspended revisions base64 branch_encoded; encode_base64(cert_value(branch()), branch_encoded); suspended_in_branch s(db, branch_encoded); - for(std::set::iterator it = candidates.begin(); it != candidates.end(); it++) + for(std::set::iterator it = candidates.begin(); + it != candidates.end(); it++) if (s(*it)) candidates.erase(*it); } @@ -199,7 +206,7 @@ void pick_update_candidates(revision_id void pick_update_candidates(revision_id const & base_ident, - database & db, + database & db, project_t & project, set & candidates) { branch_name const & branchname = db.get_opt_branchname(); @@ -208,7 +215,7 @@ void pick_update_candidates(revision_id I(!null_id(base_ident)); calculate_update_set(base_ident, branchname, - db, candidates); + db, project, candidates); } ============================================================ --- update.hh 2dc36b9ef125c3861bf4e45477caf1d29b7daa78 +++ update.hh 3e7b3c756bdd0a55ae4527cc54a4e99404879b08 @@ -14,6 +14,7 @@ class database; #include "vocab.hh" class database; +class project_t; // this function just encapsulates the (somewhat complex) logic // behind picking an update target. the actual updating takes @@ -25,7 +26,7 @@ void pick_update_candidates(revision_id // revision, then 'candidates' will contain exactly the current revision. void pick_update_candidates(revision_id const & base_ident, - database & db, + database & db, project_t & project, std::set &candidates); // Local Variables: