# # patch "ChangeLog" # from [5ae1c93f361849e02134bc7b0f3f18e035fdd41e] # to [8383a15808ebd32ad57433efe3dce087c3f268a2] # # patch "app_state.hh" # from [ca251afc3129d7d5d530a4f96a97abe925fa3841] # to [8bfec96641911e1f330522c618427b661fbc0dd0] # # patch "file_io.hh" # from [8864571732a091a7c652c1605f32118708b7cf94] # to [ed97b9af4400a34e84f147baa04195cd0ef36d97] # # patch "monotone.cc" # from [604d5b80f18d40961ae6d589064c7791cc3def71] # to [577add6b7ecb796267e7aff85997a2795c20a1ef] # # patch "paths.cc" # from [a2f37cdbc982e66032c34df86d2570176fc854a5] # to [842f2b7b7b55c8e811c5d47b45f3a52a25ad57ba] # # patch "paths.hh" # from [94f4c5abfbd54d869aec02f69e9824108e119972] # to [1aa910b01bdbca07ffa1b4081446fe77883eea15] # # patch "sanity.hh" # from [cb85ef0c3537ccd48478de3c93975cfeb8ebe518] # to [5f640e7a5b4d5c0a699399042d7884697050ae2d] # ======================================================================== --- ChangeLog 5ae1c93f361849e02134bc7b0f3f18e035fdd41e +++ ChangeLog 8383a15808ebd32ad57433efe3dce087c3f268a2 @@ -1,5 +1,14 @@ 2005-08-23 Nathaniel Smith + * file_io.hh (get_homedir): Return a system_path. + * app_state.hh (app_state): Make pidfile a system_path. + * sanity.hh (sanity::filename): Make a system_path. + * monotone.cc (cpp_main): Adjust accordingly. + * paths.hh (any_path): Add as_internal() to interface. + * paths.cc: Add roundtripping tests. + +2005-08-23 Nathaniel Smith + * platform.hh, unix/fs.cc, win32/fs.cc (change_current_working_dir): Take an any_path, not a string. * rcs_import.{cc,hh}: Convert to paths.hh. ======================================================================== --- app_state.hh ca251afc3129d7d5d530a4f96a97abe925fa3841 +++ app_state.hh 8bfec96641911e1f330522c618427b661fbc0dd0 @@ -19,6 +19,7 @@ #include "lua.hh" #include "work.hh" #include "vocab.hh" +#include "paths.hh" // this class is supposed to hold all (or.. well, most) of the state of the // application, barring some unfortunate static objects like the debugging / @@ -53,7 +54,7 @@ bool found_working_copy; long depth; long last; - fs::path pidfile; + system_path pidfile; diff_type diff_format; bool diff_args_provided; utf8 diff_args; ======================================================================== --- file_io.hh 8864571732a091a7c652c1605f32118708b7cf94 +++ file_io.hh ed97b9af4400a34e84f147baa04195cd0ef36d97 @@ -41,7 +41,7 @@ fs::path & working_copy_root, fs::path & working_copy_restriction); -std::string get_homedir(); +system_path get_homedir(); std::string absolutify(std::string const & path); std::string absolutify_for_command_line(std::string const & path); std::string tilde_expand(std::string const & path); ======================================================================== --- monotone.cc 604d5b80f18d40961ae6d589064c7791cc3def71 +++ monotone.cc 577add6b7ecb796267e7aff85997a2795c20a1ef @@ -324,7 +324,7 @@ break; case OPT_DUMP: - global_sanity.filename = absolutify(tilde_expand(string(argstr))); + global_sanity.filename = system_path(argstr); break; case OPT_DB_NAME: ======================================================================== --- paths.cc a2f37cdbc982e66032c34df86d2570176fc854a5 +++ paths.cc 842f2b7b7b55c8e811c5d47b45f3a52a25ad57ba @@ -245,7 +245,7 @@ std::ostream & operator <<(std::ostream & o, any_path const & a) { - o << a.data; + o << a.as_internal(); } #ifdef BUILD_UNIT_TESTS @@ -297,6 +297,7 @@ { file_path fp(internal, *c); BOOST_CHECK(fp.as_internal() == *c); + BOOST_CHECK(file_path(fp.as_internal()) == fp); std::vector split_test; fp.split(split_test); file_path fp2(split_test); @@ -314,6 +315,7 @@ { file_path fp(external, before); BOOST_CHECK(fp.as_internal() == after); + BOOST_CHECK(file_path(internal, fp.as_internal()) == after); // we compare after to the external form too, since as far as we know // relative normalized posix paths are always good win32 paths too BOOST_CHECK(fp.as_external() == after); @@ -448,7 +450,9 @@ static void check_bk_normalizes_to(char * before, char * after) { - BOOST_CHECK((bookkeeping_root / before).as_external() == after); + bookkeeping_path bp(bookkeeping_root / before); + BOOST_CHECK(bp.as_external() == after); + BOOST_CHECK(bookkeeping_path(bp.as_internal()) == bp); } static void test_bookkeeping_path() @@ -482,7 +486,9 @@ static void check_system_normalizes_to(char * before, char * after) { - BOOST_CHECK(system_path(before).as_external() == after); + system_path sp(before); + BOOST_CHECK(sp.as_external() == after); + BOOST_CHECK(system_path(sp.as_internal()) == sp); } static void test_system_path() ======================================================================== --- paths.hh 94f4c5abfbd54d869aec02f69e9824108e119972 +++ paths.hh 1aa910b01bdbca07ffa1b4081446fe77883eea15 @@ -33,13 +33,15 @@ public: // converts to native charset and path syntax std::string as_external() const; + // leaves as utf8 + std::string const & as_internal() const + { return data(); } protected: utf8 data; private: any_path(); any_path(any_path const & other); any_path & operator=(any_path const & other); - friend std::ostream & operator<<(std::ostream & o, any_path const & a); } std::ostream & operator<<(std::ostream & o, any_path const & a); @@ -64,12 +66,6 @@ file_path operator /(std::string const & to_append); - // returns raw normalized path string - // the string is always stored in normalized etc. form; so the generated - // copy constructor and assignment operator are fine. - std::string const & as_internal() const - { return data(); } - void split(std::vector & pieces) const; bool operator ==(const file_path & other) const ======================================================================== --- sanity.hh cb85ef0c3537ccd48478de3c93975cfeb8ebe518 +++ sanity.hh 5f640e7a5b4d5c0a699399042d7884697050ae2d @@ -55,7 +55,7 @@ bool quiet; bool relaxed; boost::circular_buffer logbuf; - std::string filename; + system_path filename; std::string gasp_dump; bool already_dumping; std::vector musings;