# # patch "cset.cc" # from [0aad7d92b8558c82b8524889fb5f340c1bbd342b] # to [e17e0de97ecfc7d477a3804dbd5d93e047b92639] # # patch "roster.cc" # from [60a83365b8f023a351a1dea19a94e9c8ae5cb411] # to [1f6ef7086ae2bb3eef676cd35e795b20420367e7] # ======================================================================== --- cset.cc 0aad7d92b8558c82b8524889fb5f340c1bbd342b +++ cset.cc e17e0de97ecfc7d477a3804dbd5d93e047b92639 @@ -622,9 +622,50 @@ split_path sp1, sp2; file_path().split(sp1); file_path_internal("baz").split(sp2); + cs.dirs_added.insert(sp1); cs.nodes_renamed.insert(std::make_pair(sp1, sp2)); BOOST_CHECK_THROW(cs.apply_to(tree), std::logic_error); } + { + L(F("TEST: can't delete non-empty directory")); + setup_roster(r, f1, nis); + cset cs; MM(cs); + split_path sp; + file_path_internal("foo").split(sp); + cs.nodes_deleted.insert(sp); + BOOST_CHECK_THROW(cs.apply_to(tree), std::logic_error); + } + { + L(F("TEST: can't delete root")); + // for this test, make sure root has no contents + r = roster_t(); + cset cs; MM(cs); + split_path sp; + file_path().split(sp); + cs.nodes_deleted.insert(sp); + BOOST_CHECK_THROW(cs.apply_to(tree), std::logic_error); + } + { + L(F("TEST: can't delete and replace root")); + // for this test, make sure root has no contents + r = roster_t(); + cset cs; MM(cs); + split_path sp; + file_path().split(sp); + cs.nodes_deleted.insert(sp); + cs.dirs_added.insert(sp); + BOOST_CHECK_THROW(cs.apply_to(tree), std::logic_error); + } + { + L(F("TEST: attach node with no root directory present")); + // for this test, make sure root has no contents + r = roster_t(); + cset cs; MM(cs); + split_path sp; + file_path_internal("blah/blah/blah").split(sp); + cs.dirs_added.insert(sp); + BOOST_CHECK_THROW(cs.apply_to(tree), std::logic_error); + } } void ======================================================================== --- roster.cc 60a83365b8f023a351a1dea19a94e9c8ae5cb411 +++ roster.cc 1f6ef7086ae2bb3eef676cd35e795b20420367e7 @@ -457,7 +457,8 @@ } -// FIXME: why does this do two loops? why does it pass 'true' to shallow_equal? +// FIXME_ROSTERS: why does this do two loops? why does it pass 'true' to +// shallow_equal? // -- njs bool roster_t::operator==(roster_t const & other) const @@ -499,16 +500,17 @@ path_component basename; dirname_basename(sp, dirname, basename); + MM(sp); + MM(*this); + + I(has_root()); + if (dirname.empty()) { I(null_name(basename)); return root_dir; } - MM(sp); - MM(*this); - - I(has_root()); dir_t d = root_dir; for (split_path::const_iterator i = dirname.begin()+1; i != dirname.end(); ++i) d = downcast_to_dir_t(d->get_child(*i)); @@ -610,7 +612,7 @@ node_id root_id = root_dir->self; safe_insert(old_locations, make_pair(root_id, make_pair(root_dir->parent, root_dir->name))); - // cleare set the root_dir shared_pointer + // clear ("reset") the root_dir shared_pointer root_dir.reset(); return root_id; }