# # # patch "ChangeLog" # from [aeb0e8e1ec082c76814bab24edafb56eb8536481] # to [0c0772211b531a2ff890f8e85e578899543c47d0] # # patch "cset.cc" # from [ac5f2a4848a4c5661496ec4f5af706de1fb6a454] # to [a8497f9a82330f842cda2f242e97ef48e3a6b9fb] # # patch "cset.hh" # from [f2d58803ea89b51b5029a349c30acc3c6c3cf580] # to [7bd817258ac15fa2b6e4c3473e9b97858721969d] # # patch "roster.cc" # from [4547e72b235da17471b9781c3416e7eac2904027] # to [dcc79a92dabbe8dbd997284f89c5267e8cd455c8] # # patch "roster.hh" # from [0f6d33d17d3d1c804be21f2e8025d86e47f087f9] # to [80cfae3dd43ce8a9da8dc587ee6ecb8d00b32776] # # patch "work.cc" # from [a08b5b1fb78a4c8b31400df33b6aacab23ceee8f] # to [3ae2f27c4144ca392eb4200e488a234f6db7d4e7] # # patch "work.hh" # from [ac03773aaca77322a4f42edbfc71924f959a074c] # to [2e87d93b08c16ef877483f69594636c480d0f97f] # ============================================================ --- ChangeLog aeb0e8e1ec082c76814bab24edafb56eb8536481 +++ ChangeLog 0c0772211b531a2ff890f8e85e578899543c47d0 @@ -1,5 +1,18 @@ 2006-02-19 Matthew Gregan + * cset.hh (struct editable_tree): Add commit() member function to + editable_tree. + + * cset.cc (cset::apply_to): Call editable_tree::commit() after + applying any other changes. + + * roster.hh, roster.cc: Empty implementation of + editable_roster_base::commit(). + + * work.hh, work.cc: Implementation of + editable_working_tree::commit() that ensures all detached nodes + have been reattached. + * work.hh (struct editable_working_tree): Add map for tracking path name mappings across node detach operations. ============================================================ --- cset.cc ac5f2a4848a4c5661496ec4f5af706de1fb6a454 +++ cset.cc a8497f9a82330f842cda2f242e97ef48e3a6b9fb @@ -225,6 +225,8 @@ for (map, attr_value>::const_iterator i = attrs_set.begin(); i != attrs_set.end(); ++i) t.set_attr(i->first.first, i->first.second, i->second); + + t.commit(); } //////////////////////////////////////////////////////////////////// ============================================================ --- cset.hh f2d58803ea89b51b5029a349c30acc3c6c3cf580 +++ cset.hh 7bd817258ac15fa2b6e4c3473e9b97858721969d @@ -46,6 +46,8 @@ attr_key const & name, attr_value const & val) = 0; + virtual void commit() = 0; + virtual ~editable_tree() {} }; ============================================================ --- roster.cc 4547e72b235da17471b9781c3416e7eac2904027 +++ roster.cc dcc79a92dabbe8dbd997284f89c5267e8cd455c8 @@ -982,6 +982,11 @@ r.set_attr(pth, name, val); } +void +editable_roster_base::commit() +{ +} + namespace { struct true_node_id_source ============================================================ --- roster.hh 0f6d33d17d3d1c804be21f2e8025d86e47f087f9 +++ roster.hh 80cfae3dd43ce8a9da8dc587ee6ecb8d00b32776 @@ -277,6 +277,7 @@ virtual void set_attr(split_path const & pth, attr_key const & name, attr_value const & val); + virtual void commit(); protected: roster_t & r; node_id_source & nis; ============================================================ --- work.cc a08b5b1fb78a4c8b31400df33b6aacab23ceee8f +++ work.cc 3ae2f27c4144ca392eb4200e488a234f6db7d4e7 @@ -769,6 +769,7 @@ = rename_add_drop_map.find(pth); I(i != rename_add_drop_map.end()); P(F("dropping %s") % i->second); + safe_erase(rename_add_drop_map, pth); delete_file_or_dir_shallow(pth); } @@ -844,7 +845,10 @@ std::map::const_iterator i = rename_add_drop_map.find(src_pth); if (i != rename_add_drop_map.end()) - P(F("renaming %s to %s") % i->second % dst_pth); + { + P(F("renaming %s to %s") % i->second % dst_pth); + safe_erase(rename_add_drop_map, src_pth); + } else P(F("adding %s") % dst_pth); // This will complain if the move is actually impossible @@ -889,6 +893,12 @@ // FIXME_ROSTERS: call a lua hook } +void +editable_working_tree::commit() +{ + I(rename_add_drop_map.empty()); +} + editable_working_tree::~editable_working_tree() { } ============================================================ --- work.hh ac03773aaca77322a4f42edbfc71924f959a074c +++ work.hh 2e87d93b08c16ef877483f69594636c480d0f97f @@ -201,6 +201,8 @@ attr_key const & name, attr_value const & val); + virtual void commit(); + virtual ~editable_working_tree(); private: app_state & app;