From c714eff72c1bd15f8831cffe7256f3dfd8faf806 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Thu, 23 Feb 2012 11:26:27 +0100 Subject: [reltool] Fix rollback and undo OTP-9794 Backup old configuration before starting re-configuration so rollback is possible if configuration fails. Store last configuration including derivates so undo does no longer need to refresh and analyse everything from disk. --- lib/reltool/src/reltool_sys_win.erl | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'lib/reltool/src/reltool_sys_win.erl') diff --git a/lib/reltool/src/reltool_sys_win.erl b/lib/reltool/src/reltool_sys_win.erl index c49641d6a3..1638acb145 100644 --- a/lib/reltool/src/reltool_sys_win.erl +++ b/lib/reltool/src/reltool_sys_win.erl @@ -1290,15 +1290,7 @@ reset_config(#state{status_bar = Bar} = S) -> undo_config(#state{status_bar = Bar} = S) -> wxStatusBar:setStatusText(Bar, "Processing libraries..."), - case reltool_server:undo_config(S#state.server_pid) of - {ok, []} -> - ok; - {ok, Warnings} -> - Msg = lists:flatten([[W, $\n] || W <- Warnings]), - display_message(Msg, ?wxICON_WARNING); - {error, Reason} -> - display_message(Reason, ?wxICON_ERROR) - end, + ok = reltool_server:undo_config(S#state.server_pid), refresh(S). load_config(#state{status_bar = Bar, config_file = OldFile} = S) -> @@ -1452,17 +1444,8 @@ undo_dialog(S, Warnings) -> ?wxID_OK -> true; ?wxID_CANCEL -> - case reltool_server:undo_config(S#state.server_pid) of - {ok, _} -> - false; - {error, Reason} -> - Msg = "FATAL - undo failed:\n\n" ++ - Reason ++ - "\n\nTerminating...", - display_message(Msg, ?wxICON_ERROR), - io:format("~p(~p): ~s\n", [?MODULE, ?LINE, Reason]), - exit(Reason) - end + ok = reltool_server:undo_config(S#state.server_pid), + false end. display_message(Message, Icon) -> -- cgit v1.2.3