# # patch "ChangeLog" # from [2b2a7734613dfc5b0127b902a22934c41efb7389] # to [01efb07825a66872a8400a5deb665c76b71f6e5b] # # patch "app_state.cc" # from [201f486c9447e06e4de252db8656896a56ce3723] # to [b8c84fd7d7240c97d342629836583cc1ac06d17b] # # patch "app_state.hh" # from [0c4a6377b293071abac920c5dcba7d8a192570dc] # to [0d9e2a1d4749deb578f935f3d15efbf3bc6997b4] # # patch "automate.cc" # from [7492b76019ac6578ecc8e1fec67025cff1ffbc39] # to [ca486d66afc95b42519bd3831732b71099d45cc4] # # patch "commands.cc" # from [0810ba0819d92e2e93db7c7e2769429d1e8a64ad] # to [db0ce86b24b1091ca667a4416827cc6494e97988] # # patch "paths.hh" # from [a2c5f09f4dfa841b54e7a163f45d765cf32e0e2b] # to [0b8007bc1bf1c2f64cb27fcfd16cd6c739277bcb] # ======================================================================== --- ChangeLog 2b2a7734613dfc5b0127b902a22934c41efb7389 +++ ChangeLog 01efb07825a66872a8400a5deb665c76b71f6e5b @@ -1,3 +1,10 @@ +2005-08-24 Nathaniel Smith + + * app_state.cc: More paths.hh conversion. + (app_state::prefix): Remove. + * commands.cc: Remove uses of app.prefix. + * automate.cc (automate_attributes): Likewise. + 2005-08-23 Nathaniel Smith * paths.hh (any_path::as_internal): On second thought, return a ======================================================================== --- app_state.cc 201f486c9447e06e4de252db8656896a56ce3723 +++ app_state.cc b8c84fd7d7240c97d342629836583cc1ac06d17b @@ -62,7 +62,7 @@ read_options(); - string dbname = absolutify(options[database_option]()); + system_path dbname = system_path(options[database_option]); if (dbname != "") db.set_filename(mkpath(dbname)); if (branch_name().empty()) branch_name = options[branch_option]; @@ -109,10 +109,10 @@ L(F("create working copy in %s\n") % target); { - fs::path new_dir = mkpath(target); + system_path new_dir(target); try { - fs::create_directories(new_dir); + mkdir_p(new_dir); } catch (fs::filesystem_error & err) { @@ -121,21 +121,17 @@ % err.path1().native_directory_string() % strerror(err.native_error())); } - N(chdir(new_dir.native_directory_string().c_str()) != -1, - F("cannot change to new directory %s\n") - % new_dir.native_directory_string()); + change_current_working_dir(new_dir); relative_directory = file_path(); } - local_path mt(book_keeping_dir); - - N(!directory_exists(mt), + N(!directory_exists(bookkeeping_root), F("monotone book-keeping directory '%s' already exists in '%s'\n") - % book_keeping_dir % target); + % bookkeeping_root % target); L(F("creating book-keeping directory '%s' for working copy in '%s'\n") - % book_keeping_dir % target); + % bookkeeping_root % target); mkdir_p(mt); @@ -151,15 +147,6 @@ load_rcfiles(); } -file_path -app_state::prefix(utf8 const & path) -{ - fs::path p1 = mkpath(relative_directory()) / mkpath(path()); - file_path p2(p1.normalize().string()); - L(F("'%s' prefixed to '%s'\n") % path() % p2()); - return p2; -} - void app_state::set_restriction(path_set const & valid_paths, vector const & paths, @@ -171,7 +158,7 @@ restrictions.clear(); for (vector::const_iterator i = paths.begin(); i != paths.end(); ++i) { - file_path p = prefix(*i); + file_path p(external, *i); if (respect_ignore && lua.hook_ignore_file(p)) { ======================================================================== --- app_state.hh 0c4a6377b293071abac920c5dcba7d8a192570dc +++ app_state.hh 0d9e2a1d4749deb578f935f3d15efbf3bc6997b4 @@ -76,7 +76,6 @@ void require_working_copy(std::string const & explanation = ""); void create_working_copy(std::string const & dir); - file_path prefix(utf8 const & path); void app_state::set_restriction(path_set const & valid_paths, std::vector const & paths, bool respect_ignore = true); ======================================================================== --- automate.cc 7492b76019ac6578ecc8e1fec67025cff1ffbc39 +++ automate.cc ca486d66afc95b42519bd3831732b71099d45cc4 @@ -237,7 +237,7 @@ if (args.size() == 1) { // a filename was given, if it has attributes, print them - file_path path = app.prefix(idx(args,0)()); + file_path path(external, idx(args,0)()); attr_map::const_iterator i = attrs.find(path); if (i == attrs.end()) return; ======================================================================== --- commands.cc 0810ba0819d92e2e93db7c7e2769429d1e8a64ad +++ commands.cc db0ce86b24b1091ca667a4416827cc6494e97988 @@ -1072,7 +1072,7 @@ vector paths; for (vector::const_iterator i = args.begin(); i != args.end(); ++i) - paths.push_back(app.prefix(*i)); + paths.push_back(file_path(external, *i)); build_additions(paths, m_old, app, work); @@ -1096,7 +1096,7 @@ vector paths; for (vector::const_iterator i = args.begin(); i != args.end(); ++i) - paths.push_back(app.prefix(*i)); + paths.push_back(file_path(external, *i)); build_deletions(paths, m_old, app, work); @@ -1121,7 +1121,9 @@ change_set::path_rearrangement work; get_path_rearrangement(work); - build_rename(app.prefix(idx(args, 0)()), app.prefix(idx(args, 1)()), m_old, work); + build_rename(file_path(external, idx(args, 0)()), + file_path(external, idx(args, 1)()), + m_old, work); put_path_rearrangement(work); @@ -1286,7 +1288,7 @@ { revision_id rid; complete(app, idx(args, 1)(), rid); - file_path fp = app.prefix(idx(args, 2)); + file_path fp = file_path(external, idx(args, 2)); manifest_id mid; app.db.get_revision_manifest(rid, mid); manifest_map m; @@ -2119,7 +2121,7 @@ read_attr_map(attr_data, attrs); } - file_path path = app.prefix(idx(args,1)()); + file_path path(external, idx(args,1)()); N(file_exists(path), F("file '%s' not found") % path); bool attrs_modified = false; ======================================================================== --- paths.hh a2c5f09f4dfa841b54e7a163f45d765cf32e0e2b +++ paths.hh 0b8007bc1bf1c2f64cb27fcfd16cd6c739277bcb @@ -61,6 +61,7 @@ // -- are confirmed to be normalized and relative // -- not to be in MT/ file_path(source_type type, std::string const & path); + file_path(source_type type, utf8 const & path); // join a file_path out of pieces file_path(std::vector const & pieces); @@ -85,6 +86,7 @@ // and _should_ look like an internal path // usually you should just use the / operator as a constructor! bookkeeping_path(std::string const & path); + bookkeeping_path(utf8 const & path); std::string as_external() const; bookkeeping_path operator /(std::string const & to_append); }; @@ -99,6 +101,7 @@ // tilde-expanded. it will considered to be relative to the directory // monotone started in. it should be in utf8. system_path(std::string const & path); + system_path(utf8 const & path); bool empty() const; system_path operator /(std::string const & to_append); };