# # # add_dir "tests/bisect_blocked" # # add_file "tests/bisect_blocked/__driver__.lua" # content [69c78ac0f34384e75d5e00256de2e00b18287d55] # # patch "cmd_ws_commit.cc" # from [bd7f99febf5da19af95b74d786c9e9613ba933f5] # to [76029d05da2d497248cbf30c84814b7ac96e685b] # # patch "work.cc" # from [de8408bf54303936e29a1ca09335fcf0335d7c05] # to [4624f09640eefc22a17df1a54d3c5b3350a8b83f] # # patch "work.hh" # from [a1d124f2ed26619f06faf1b95f4e0a9e4602d874] # to [12a0cb4870fdb76affdfed725039d7407be701b8] # ============================================================ --- tests/bisect_blocked/__driver__.lua 69c78ac0f34384e75d5e00256de2e00b18287d55 +++ tests/bisect_blocked/__driver__.lua 69c78ac0f34384e75d5e00256de2e00b18287d55 @@ -0,0 +1,56 @@ +mtn_setup() + +addfile("r1", "111") +commit("testbranch", "r1") +r1 = base_revision() + +addfile("r2", "222") +commit("testbranch", "r2") +r2 = base_revision() + +addfile("r3", "333") +commit("testbranch", "r3") +r3 = base_revision() + +addfile("r4", "444") +commit("testbranch", "r4") +r4 = base_revision() + +addfile("r5", "555") +commit("testbranch", "r5") +r5 = base_revision() + +check(mtn("log", "--no-files", "--from", r1, "--next", 5), 0, false, false) + +check(mtn("update", "--revision", r1), 0, false, false) +check(mtn("bisect", "good"), 0, false, false) + +writefile("r2", "r2-blocked") + +check(mtn("bisect", "bad", "--revision", r5), 1, false, false) +check(base_revision() == r1) + +check(mtn("bisect", "status"), 0, false, true) +check(qgrep("warning:", "stderr")) + +check(mtn("bisect", "update"), 1, false, false) +check(base_revision() == r1) + +check(mtn("bisect", "update", "--move-conflicting-paths"), 0, false, false) +check(base_revision() == r3) + + +check(mtn("update", "--revision", r1), 0, false, false) +check(mtn("bisect", "reset"), 0, false, false) +remove("_MTN/resolutions") + +check(mtn("bisect", "good"), 0, false, false) + +writefile("r2", "r2-blocked") + +check(mtn("bisect", "bad", "--revision", r5), 1, false, false) +check(base_revision() == r1) + +check(mtn("bisect", "bad", "--revision", r5, "--move-conflicting-paths"), 0, false, false) +check(base_revision() == r3) + ============================================================ --- cmd_ws_commit.cc bd7f99febf5da19af95b74d786c9e9613ba933f5 +++ cmd_ws_commit.cc 76029d05da2d497248cbf30c84814b7ac96e685b @@ -1629,6 +1629,12 @@ bisect_select(project_t & project, case bisect::skipped: skipped.insert(i->second); break; + case bisect::update: + // this value is not persisted, it is only used by the bisect + // update command to rerun a selection and update based on current + // bisect information + I(false); + break; } } @@ -1760,7 +1766,13 @@ operator<<(std::ostream & os, case bisect::skipped: os << "skip"; break; - } + case bisect::update: + // this value is not persisted, it is only used by the bisect + // update command to rerun a selection and update based on current + // bisect information + I(false); + break; + } return os; } @@ -1808,35 +1820,39 @@ bisect_update(app_state & app, bisect::t if (info.empty()) { info.push_back(make_pair(bisect::start, current_id)); - P(F("bisection started at revision %s") % describe_revision(project, current_id)); + P(F("bisection started at revision %s") + % describe_revision(project, current_id)); } - // don't allow conflicting or redundant settings - for (vector::const_iterator i = info.begin(); - i != info.end(); ++i) + if (type != bisect::update) { - if (i->first == bisect::start) - continue; - if (marked_ids.find(i->second) != marked_ids.end()) + // don't allow conflicting or redundant settings + for (vector::const_iterator i = info.begin(); + i != info.end(); ++i) { - if (type == i->first) + if (i->first == bisect::start) + continue; + if (marked_ids.find(i->second) != marked_ids.end()) { - W(F("ignored redundant bisect %s on revision %s") - % type % i->second); - marked_ids.erase(i->second); + if (type == i->first) + { + W(F("ignored redundant bisect %s on revision %s") + % type % i->second); + marked_ids.erase(i->second); + } + else + E(false, origin::user, F("conflicting bisect %s/%s on revision %s") + % type % i->first % i->second); } - else - E(false, origin::user, F("conflicting bisect %s/%s on revision %s") - % type % i->first % i->second); } - } - // push back all marked revs with the appropriate type - for (set::const_iterator i = marked_ids.begin(); - i != marked_ids.end(); ++i) - info.push_back(make_pair(type, *i)); + // push back all marked revs with the appropriate type + for (set::const_iterator i = marked_ids.begin(); + i != marked_ids.end(); ++i) + info.push_back(make_pair(type, *i)); - work.put_bisect_info(info); + work.put_bisect_info(info); + } revision_id selected_id; bisect_select(project, info, current_id, selected_id); @@ -1852,7 +1868,8 @@ bisect_update(app_state & app, bisect::t make_cset(current_roster, selected_roster, update); content_merge_checkout_adaptor adaptor(db); - work.perform_content_update(current_roster, selected_roster, update, adaptor); + work.perform_content_update(current_roster, selected_roster, update, adaptor, + true, app.opts.move_conflicting_paths); revision_t selected_rev; cset empty; @@ -1893,33 +1910,51 @@ CMD(bisect_status, "status", "", CMD_REF revision_id selected_id; bisect_select(project, info, current_id, selected_id); + + if (current_id != selected_id) + { + W(F("next revision for bisection testing is %s\n") % selected_id); + W(F("however this workspace is currently at %s\n") % current_id); + W(F("run 'bisect update' to update to this revision before testing")); + } } -CMD(skip, "skip", "", CMD_REF(bisect), "", +CMD(bisect_update, "update", "", CMD_REF(bisect), "", + N_("Updates the workspace to the next revision to be tested by bisection"), + N_("This command can be used if updates by good, bad or skip commands " + "fail due to blocked paths or other problems."), + options::opts::move_conflicting_paths) +{ + if (args.size() != 0) + throw usage(execid); + bisect_update(app, bisect::update); +} + +CMD(bisect_skip, "skip", "", CMD_REF(bisect), "", N_("Excludes the current revision or specified revisions from the search"), N_("Skipped revisions are removed from the set being searched. Revisions " "that cannot be tested for some reason should be skipped."), - options::opts::revision) + options::opts::revision | options::opts::move_conflicting_paths) { if (args.size() != 0) throw usage(execid); bisect_update(app, bisect::skipped); } -CMD(bad, "bad", "", CMD_REF(bisect), "", +CMD(bisect_bad, "bad", "", CMD_REF(bisect), "", N_("Marks the current revision or specified revisions as bad"), N_("Known bad revisions are removed from the set being searched."), - options::opts::revision) + options::opts::revision | options::opts::move_conflicting_paths) { if (args.size() != 0) throw usage(execid); bisect_update(app, bisect::bad); } -CMD(good, "good", "", CMD_REF(bisect), "", +CMD(bisect_good, "good", "", CMD_REF(bisect), "", N_("Marks the current revision or specified revisions as good"), N_("Known good revisions are removed from the set being searched."), - options::opts::revision) + options::opts::revision | options::opts::move_conflicting_paths) { if (args.size() != 0) throw usage(execid); ============================================================ --- work.cc de8408bf54303936e29a1ca09335fcf0335d7c05 +++ work.cc 4624f09640eefc22a17df1a54d3c5b3350a8b83f @@ -713,6 +713,13 @@ workspace::put_bisect_info(vectorsecond.inner()); break; + + case bisect::update: + // this value is not persisted, it is only used by the bisect + // update command to rerun a selection and update based on current + // bisect information + I(false); + break; } } ============================================================ --- work.hh a1d124f2ed26619f06faf1b95f4e0a9e4602d874 +++ work.hh 12a0cb4870fdb76affdfed725039d7407be701b8 @@ -83,7 +83,7 @@ namespace bisect namespace bisect { - enum type { start, good, bad, skipped }; + enum type { start, good, bad, skipped, update }; typedef std::pair entry; };