# # patch "commands.cc" # from [90adbc1395e018f6f314b3bc52861c1a4e583ac1] # to [775992428125d132d64e7e06b52b1363b5fb7194] # # patch "work.cc" # from [493d24e8cf99f2b1a8aee4fba24c90ff431b99e9] # to [d4d35c96d2580fa04568041deb8e1e786df1dfa8] # # patch "work.hh" # from [feb30004fbb3fa070deea09ab603cd73c45d2079] # to [28d98ab9888bd1305d1f0110f3fb08f616f4846a] # ======================================================================== --- commands.cc 90adbc1395e018f6f314b3bc52861c1a4e583ac1 +++ commands.cc 775992428125d132d64e7e06b52b1363b5fb7194 @@ -1160,12 +1160,6 @@ app.require_working_copy(); - roster_t base_roster; - cset work; - - get_base_roster(app, base_roster); - get_work_cset(work); - path_set paths; if (app.unknown) { @@ -1180,11 +1174,7 @@ paths.insert(sp); } - build_additions(paths, base_roster, app, work); - - put_work_cset(work); - - update_any_attrs(app); + perform_additions(paths, app); } static void find_missing (app_state & app, @@ -1198,12 +1188,6 @@ app.require_working_copy(); - roster_t base_roster; - cset work; - - get_base_roster(app, base_roster); - get_work_cset(work); - path_set paths; if (app.missing) find_missing(app, args, paths); @@ -1215,11 +1199,7 @@ paths.insert(sp); } - build_deletions(paths, base_roster, app, work); - - put_work_cset(work); - - update_any_attrs(app); + perform_deletions(paths, app); } ALIAS(rm, drop); ======================================================================== --- work.cc 493d24e8cf99f2b1a8aee4fba24c90ff431b99e9 +++ work.cc d4d35c96d2580fa04568041deb8e1e786df1dfa8 @@ -145,20 +145,15 @@ } void -build_additions(path_set const & paths, - roster_t const & base_roster, - app_state & app, - cset & work) +perform_additions(path_set const & paths, app_state & app) { if (paths.empty()) return; temp_node_id_source nis; - roster_t new_roster(base_roster); - editable_roster_base er(new_roster, nis); + roster_t base_roster, new_roster; + get_base_and_current_roster(base_roster, new_roster, nis, app); - work.apply_to(er); - if (!new_roster.has_root()) { split_path root; @@ -173,25 +168,22 @@ // NB.: walk_tree will handle error checking for non-existent paths walk_tree(file_path(*i), build); - work.clear(); - make_cset(base_roster, new_roster, work); + cset new_work; + make_cset(base_roster, new_roster, new_work); + put_work_cset(new_work); + update_any_attrs(new_work); } void -build_deletions(path_set const & paths, - roster_t const & base_roster, - app_state & app, - cset & work) +perform_deletions(path_set const & paths, app_state & app) { if (paths.empty()) return; temp_node_id_source nis; - roster_t new_roster(base_roster); - editable_roster_base er(new_roster, nis); + roster_t base_roster, new_roster; + get_base_and_current_roster(base_roster, current_roster, nis, app); - work.apply_to(er); - // we traverse the the paths backwards, so that we always hit deep paths // before shallow paths (because path_set is lexicographically sorted). // this is important in cases like @@ -215,16 +207,16 @@ F("cannot remove %s/, it is not empty") % name); } P(F("adding %s to working copy delete set\n") % name); - node_id nid = new_roster.detach_node(*i); - I(nid == n->self); - new_roster.drop_detached_node(nid); + new_roster.drop_detached_node(new_roster.detach_node(*i)); if (app.execute && path_exists(name)) delete_file_or_dir_shallow(name); } } - work.clear(); - make_cset(base_roster, new_roster, work); + cset new_work; + make_cset(base_roster, new_roster, new_work); + put_work_cset(new_work); + update_any_attrs(app); } /* @@ -440,9 +432,23 @@ cset cs; get_work_cset(cs); editable_roster_base er(ros, nis); - cs.apply_to(es); + cs.apply_to(er); } +void +get_base_and_current_roster(roster_t & base_roster, + roster_t & current_roster, + node_id_source & nis, + app_state & app) +{ + get_base_roster(app, base_roster); + current_roster = base_roster; + cset cs; + get_work_cset(cs); + editable_roster_base er(current_roster, nis); + cs.apply_to(er); +} + // user log file string const user_log_file_name("log"); ======================================================================== --- work.hh feb30004fbb3fa070deea09ab603cd73c45d2079 +++ work.hh 28d98ab9888bd1305d1f0110f3fb08f616f4846a @@ -60,17 +60,11 @@ virtual void visit_file(file_path const & path); }; -void -build_additions(path_set const & targets, - roster_t const & base_roster, - app_state & app, - cset & work); +void +perform_additions(path_set const & targets, app_state & app); -void -build_deletions(path_set const & targets, - roster_t const & base_roster, - app_state & app, - cset & work); +void +perform_deletions(path_set const & targets, app_state & app); /* // FIXME_ROSTERS: disabled until rewritten to use rosters @@ -100,13 +94,18 @@ revision_id & rid, roster_t & ros, marking_map & mm); -void get_base_revision(app_state & app, - revision_id & rid, - roster_t & ros); +void get_base_revision(revision_id & rid, + roster_t & ros, + app_state & app); void get_base_roster(app_state & app, roster_t & ros); void get_current_roster(roster_t & ros, node_id_source & nis, app_state & app); +void get_base_and_current_roster(roster_t & base_roster, + roster_t & current_roster, + node_id_source & nis, + app_state & app); + // the "user log" is a file the user can edit as they program to record // changes they make to their source code. Upon commit the file is read // and passed to the edit_comment lua hook. If the commit is a success,