# # # patch "update.cc" # from [974b6d54d36ef82389781738f2b247417d5def27] # to [c5dd32db83ca5702882667690c87e7f44281f0f6] # ============================================================ --- update.cc 974b6d54d36ef82389781738f2b247417d5def27 +++ update.cc c5dd32db83ca5702882667690c87e7f44281f0f6 @@ -106,30 +106,6 @@ acceptable_descendent(branch_name const } } -namespace -{ - struct suspended_in_branch : public is_failure - { - app_state & app; - base64 const & branch_encoded; - suspended_in_branch(app_state & app, - base64 const & branch_encoded) - : app(app), branch_encoded(branch_encoded) - {} - virtual bool operator()(revision_id const & rid) - { - vector< revision > certs; - app.db.get_revision_certs(rid, - cert_name(suspend_cert_name), - branch_encoded, - certs); - erase_bogus_certs(certs, app); - return !certs.empty(); - } - }; -} - - static void calculate_update_set(revision_id const & base, branch_name const & branch, @@ -175,29 +151,19 @@ calculate_update_set(revision_id const & erase_ancestors(candidates, app); - bool have_non_suspended_rev = false; - - for (set::const_iterator it = candidates.begin(); it != candidates.end(); it++) - { - if (!app.get_project().revision_is_suspended_in_branch(*it, branch)) - { - have_non_suspended_rev = true; - break; - } - } - if (!app.opts.ignore_suspend_certs && have_non_suspended_rev) - { - // remove all suspended revisions - base64 branch_encoded; - encode_base64(cert_value(branch()), branch_encoded); - suspended_in_branch s(app, branch_encoded); - for(std::set::iterator it = candidates.begin(); it != candidates.end(); it++) - if (s(*it)) - candidates.erase(*it); - } + if (app.opts.ignore_suspend_certs) + return; + + set active_candidates; + for (set::const_iterator i = candidates.begin(); + i != candidates.end(); i++) + if (!app.get_project().revision_is_suspended_in_branch(*i, branch)) + safe_insert(active_candidates, *i); + + if (!active_candidates.empty()) + candidates = active_candidates; } - void pick_update_candidates(revision_id const & base_ident, app_state & app, set & candidates)