# # patch "ChangeLog" # from [66859d375bd50538e9d83d8f612ee3593957c9b6] # to [e4f0ea9c6ed9e606f9f0d4f5eece59f22d091d78] # # patch "app_state.cc" # from [e17ca6062893530171e755833363cdcb237fa658] # to [2df6fe318b2aad02e24d2f1670727c2d875835c2] # # patch "paths.cc" # from [c9dd97711a5c2bb7f2fe432b5b3a8b078d3ed460] # to [fbb3eba886c5d83d087ab056325d4f37415abfc9] # # patch "paths.hh" # from [dff7a05dac7f17af9054dd1331de7203e3db0810] # to [90103ad12a83f237c1fc7579e21562be87c533fd] # ======================================================================== --- ChangeLog 66859d375bd50538e9d83d8f612ee3593957c9b6 +++ ChangeLog e4f0ea9c6ed9e606f9f0d4f5eece59f22d091d78 @@ -1,5 +1,13 @@ 2005-08-25 Nathaniel Smith + * paths.hh (system_path::system_path): Add new boolean argument + controlling some access_tracker behavior. + * app_state.cc (allow_working_copy): Use it. + * paths.cc (system_path): Implement it. + (test_system_path): Test it. + +2005-08-25 Nathaniel Smith + * file_io.cc (walk_tree): Return properly. 2005-08-25 Nathaniel Smith ======================================================================== --- app_state.cc e17ca6062893530171e755833363cdcb237fa658 +++ app_state.cc 2df6fe318b2aad02e24d2f1670727c2d875835c2 @@ -68,7 +68,10 @@ bookkeeping_path dump_path; get_local_dump_path(dump_path); L(F("setting dump path to %s\n") % dump_path); - global_sanity.filename = system_path(dump_path); + // the 'true' means that, e.g., if we're running checkout, then it's + // okay for dumps to go into our starting working dir's MT rather + // than the checked-out dir's MT. + global_sanity.filename = system_path(dump_path, true); } } load_rcfiles(); ======================================================================== --- paths.cc c9dd97711a5c2bb7f2fe432b5b3a8b078d3ed460 +++ paths.cc fbb3eba886c5d83d087ab056325d4f37415abfc9 @@ -364,10 +364,15 @@ // system_path /////////////////////////////////////////////////////////////////////////// -system_path::system_path(any_path const & other) +system_path::system_path(any_path const & other, bool in_true_working_copy) { I(!is_absolute_here(other.as_internal())); - data = (working_root.get() / other.as_internal()).as_internal(); + system_path wr; + if (in_true_working_copy) + wr = working_root.get(); + else + wr = working_root.get_but_unused(); + data = (wr / other.as_internal()).as_internal(); } static inline std::string const_system_path(utf8 const & path) @@ -803,9 +808,15 @@ initial_rel_path.set(file_path_internal("rel/initial"), true); BOOST_CHECK(system_path(system_path("foo/bar")).as_internal() == "/a/b/foo/bar"); + BOOST_CHECK(!working_root.used); BOOST_CHECK(system_path(system_path("/foo/bar")).as_internal() == "/foo/bar"); + BOOST_CHECK(!working_root.used); + BOOST_CHECK(system_path(file_path_internal("foo/bar"), true).as_internal() + == "/working/root/foo/bar"); + BOOST_CHECK(!working_root.used); BOOST_CHECK(system_path(file_path_internal("foo/bar")).as_internal() == "/working/root/foo/bar"); + BOOST_CHECK(working_root.used); BOOST_CHECK(system_path(file_path_external(std::string("foo/bar"))).as_external() == "/working/root/rel/initial/foo/bar"); BOOST_CHECK(system_path(file_path()).as_external() @@ -814,7 +825,6 @@ == "/working/root/MT/foo/bar"); BOOST_CHECK(system_path(bookkeeping_root).as_internal() == "/working/root/MT"); - initial_abs_path.unset(); working_root.unset(); initial_rel_path.unset(); ======================================================================== --- paths.hh dff7a05dac7f17af9054dd1331de7203e3db0810 +++ paths.hh 90103ad12a83f237c1fc7579e21562be87c533fd @@ -117,7 +117,18 @@ public: system_path() {}; system_path(system_path const & other) : any_path(other) {}; - explicit system_path(any_path const & other); + // the optional argument takes some explanation. this constructor takes a + // path relative to the working copy root. the question is how to interpret + // that path -- since it's possible to have multiple working copies over the + // course of a the program's execution (e.g., if someone runs 'checkout' + // while already in a working copy). if 'true' is passed (the default), + // then monotone will trigger an invariant if the working copy changes after + // we have already interpreted the path relative to some other working + // copy. if 'false' is passed, then the path is taken to be relative to + // whatever the current working copy is, and will continue to reference it + // even if the working copy later changes. + explicit system_path(any_path const & other, + bool in_true_working_copy = true); // this path can contain anything, and it will be absolutified and // tilde-expanded. it will considered to be relative to the directory // monotone started in. it should be in utf8.