# # # patch "app_state.cc" # from [7dce08a3255c99adc96350424dce00ce403a2252] # to [4534848fd6ec5d06db4e6b389bfa0dbc8764f975] # # patch "app_state.hh" # from [b556393474ffd1133a0d72c549e5ef4b0346d05f] # to [c417b99837f0a2de58f1e8f9b059ab3d25f611c1] # # patch "options_list.hh" # from [b3ccd0af968b5f1f375de18267d86c10b10fd423] # to [54ee12e3dfb608ca3a4b9a64cc51a845fc4a0501] # # patch "paths.cc" # from [f0ef9bdb3ec64caa3183cb482ff62c3fdd9b1314] # to [8f2048d28dbd11312ebb07266c9b7b6884daffc1] # # patch "paths.hh" # from [3c506fff82779d8a58807bcbd364c459e6061886] # to [95e2d4782ab7e04859e292f8b92aad4ead046b83] # ============================================================ --- app_state.cc 7dce08a3255c99adc96350424dce00ce403a2252 +++ app_state.cc 4534848fd6ec5d06db4e6b389bfa0dbc8764f975 @@ -11,11 +11,6 @@ #include #include -#include -#include -#include -#include - #include "botan/pubkey.h" #include "botan/rsa.h" @@ -28,8 +23,6 @@ #include "ui.hh" #include "work.hh" -namespace fs = boost::filesystem; - using std::exception; using std::map; using std::string; @@ -39,8 +32,6 @@ app_state::app_state() app_state::app_state() : db(system_path()), keys(*this), work(db, lua), -// search_root(current_root_path()), -// diff_format(unified_diff), branch_is_sticky(false), project(*this) { @@ -57,7 +48,6 @@ app_state::allow_workspace() void app_state::allow_workspace() { - L(FL("initializing from directory %s") % fs::initial_path().string()); found_workspace = find_and_go_to_workspace(opts.root); if (found_workspace) @@ -234,17 +224,6 @@ app_state::get_project() return project; } -void -app_state::set_root(system_path const & path) -{ - require_path_is_directory - (path, - F("search root '%s' does not exist") % path, - F("search root '%s' is not a directory") % path); - opts.root = path; - L(FL("set search root to %s") % opts.root); -} - // rc files are loaded after we've changed to the workspace so that // _MTN/monotonerc can be loaded between ~/.monotone/monotonerc and other // rcfiles. ============================================================ --- app_state.hh b556393474ffd1133a0d72c549e5ef4b0346d05f +++ app_state.hh c417b99837f0a2de58f1e8f9b059ab3d25f611c1 @@ -90,7 +90,6 @@ public: void set_database(system_path const & filename); void set_key_dir(system_path const & filename); - void set_root(system_path const & root); void set_diff_format(diff_type dtype); explicit app_state(); ============================================================ --- options_list.hh b3ccd0af968b5f1f375de18267d86c10b10fd423 +++ options_list.hh 54ee12e3dfb608ca3a4b9a64cc51a845fc4a0501 @@ -463,11 +463,11 @@ OPTION(revision, revision, true, "revisi } #endif -GOPT(root, "root", system_path, current_root_path(), +GOPT(root, "root", std::string, , gettext_noop("limit search for workspace to specified root")) #ifdef option_bodies { - root = system_path(arg); + root = arg; } #endif ============================================================ --- paths.cc f0ef9bdb3ec64caa3183cb482ff62c3fdd9b1314 +++ paths.cc 8f2048d28dbd11312ebb07266c9b7b6884daffc1 @@ -652,12 +652,6 @@ dirname_basename(split_path const & sp, // workspace (and path root) handling /////////////////////////////////////////////////////////////////////////// -system_path -current_root_path() -{ - return system_path(fs::initial_path().root_path().string()); -} - static bool find_bookdir(fs::path const & root, fs::path const & bookdir, fs::path & current, fs::path & removed) @@ -736,13 +730,26 @@ bool bool -find_and_go_to_workspace(system_path const & search_root) +find_and_go_to_workspace(std::string const & search_root) { - fs::path root(search_root.as_external(), fs::native); fs::path bookdir(bookkeeping_root.as_external(), fs::native); fs::path oldbookdir(old_bookkeeping_root.as_external(), fs::native); - fs::path current, removed; + fs::path root, current, removed; + if (search_root.empty()) + root = fs::initial_path().root_path(); + else + { + L(FL("limiting search for workspace to %s") % search_root); + // converting through system_path makes it absolute + root = fs::path(system_path(search_root).as_external(), fs::native); + + N(fs::exists(root), + F("search root '%s' does not exist") % search_root); + N(fs::is_directory(root), + F("search root '%s' is not a directory") % search_root); + } + // first look for the current name of the bookkeeping directory. // if we don't find it, look for it under the old name, so that // migration has a chance to work. ============================================================ --- paths.hh 3c506fff82779d8a58807bcbd364c459e6061886 +++ paths.hh 95e2d4782ab7e04859e292f8b92aad4ead046b83 @@ -253,13 +253,10 @@ save_initial_path(); void save_initial_path(); -system_path -current_root_path(); - // returns true if workspace found, in which case cwd has been changed // returns false if workspace not found bool -find_and_go_to_workspace(system_path const & search_root); +find_and_go_to_workspace(std::string const & search_root); // this is like change_current_working_dir, but also initializes the various // root paths that are needed to interpret paths