# # # patch "cmd_automate.cc" # from [e0e235fb482bd7233c962ecfa4754f85af0e2367] # to [5d377f31e2714ebdd959bb4a7d9c9e6e4f1de8b9] # # patch "cmd_merging.cc" # from [e30a1fe6db76f8e748cc647100fe580ba5acfe0d] # to [edae4eaccdef47b8fc497327603d16254de8b423] # # patch "monotone.texi" # from [d9ba9a183c69ad924a6fe5afc35b92ed54899bd9] # to [5b13393d7df65767bc1666100553f291ac04938b] # # patch "tests/automate_update/__driver__.lua" # from [737b9713cc9fafa0c9ec535636a9adcea973746b] # to [33ba9867907d8e690b89632ee71ba05c96dc439d] # ============================================================ --- cmd_automate.cc e0e235fb482bd7233c962ecfa4754f85af0e2367 +++ cmd_automate.cc 5d377f31e2714ebdd959bb4a7d9c9e6e4f1de8b9 @@ -346,8 +346,10 @@ LUAEXT(change_workspace, ) } catch (recoverable_failure & f) { - // need a variant of P that doesn't require F? - P(F(f.what())); + string msg(f.what()); + lua_pushboolean(LS, false); + lua_pushlstring(LS, msg.data(), msg.size()); + return 2; } // go_to_workspace doesn't check that it is a workspace, nor set workspace::found! ============================================================ --- cmd_merging.cc e30a1fe6db76f8e748cc647100fe580ba5acfe0d +++ cmd_merging.cc edae4eaccdef47b8fc497327603d16254de8b423 @@ -176,8 +176,8 @@ static void } static void -update (app_state & app, - args_vector const & args) +update(app_state & app, + args_vector const & args) { database db(app); workspace work(app); @@ -353,7 +353,7 @@ CMD(update, "update", "", CMD_REF(worksp if (app.opts.revision_selectors.size() > 1) throw usage(execid); - update (app, args); + update(app, args); } CMD_AUTOMATE(update, "", @@ -363,12 +363,12 @@ CMD_AUTOMATE(update, "", options::opts::move_conflicting_paths) { E(args.empty(), origin::user, - F("update takes no command arguments")); + F("wrong argument count")); E(app.opts.revision_selectors.size() <= 1, origin::user, F("at most one revision selector may be specified")); - update (app, args); + update(app, args); } // Subroutine of CMD(merge) and CMD(explicit_merge). Merge LEFT with RIGHT, ============================================================ --- monotone.texi d9ba9a183c69ad924a6fe5afc35b92ed54899bd9 +++ monotone.texi 5b13393d7df65767bc1666100553f291ac04938b @@ -11305,6 +11305,10 @@ @section Additional Lua Functions Throws an error if @var{directory} does not exist or is not a workspace (does not contain @file{_MTN}). +After calling change_workspace, the next operation should read the +workspace options. That means it should be a top level command like +'update', called via @command{mtn_automate}. + @item existonpath(@var{possible_command}) This function receives a string containing the name of an external ============================================================ --- tests/automate_update/__driver__.lua 737b9713cc9fafa0c9ec535636a9adcea973746b +++ tests/automate_update/__driver__.lua 33ba9867907d8e690b89632ee71ba05c96dc439d @@ -25,17 +25,27 @@ revert_to(rev1) revert_to(rev1) +-- normal automate check(mtn("automate", "update"), 0, false, true) check(qgrep("mtn: updated to base revision", "stderr")) revert_to(rev1) +-- automate stdio progress = run_stdio("l6:updatee", 0, 0, 'p') -check(string.find(progress[9], "updated to base revision") ~= nil) +check(string.find(progress[#progress], "updated to base revision") ~= nil) -- Command error cases -- no arguments allowed -run_stdio("l6:update3:fooe", 2) +check(mtn("automate", "update", "foo"), 1, false, true) +check(qgrep("wrong argument count", "stderr")) +-- only one revision selector +check(mtn("automate", "update", "-r 123", "-r 456"), 1, false, true) +check(qgrep("at most one revision selector may be specified", "stderr")) + +-- other errors are handled by the same code as 'mtn update', so don't +-- need to be tested here. + -- end of file