# # # patch "work.hh" # from [4bfc4c2a48bf132b3701704c046ba77bdcb6302c] # to [80f605552faf385ace2990609034c056b0d7db8a] # ============================================================ --- work.hh 4bfc4c2a48bf132b3701704c046ba77bdcb6302c +++ work.hh 80f605552faf385ace2990609034c056b0d7db8a @@ -102,27 +102,39 @@ struct workspace // write out a new (partial) revision describing the current workspace; // the important pieces of this are the base revision id and the "shape" // changeset (representing tree rearrangements). - void put_work_rev(revision_t const & rev); + void set_work_state(parent_map const & parents, + roster_t const & new_roster); + void set_work_state_to_new_root(); + void set_work_state_unchanged(revision_id const & parent_id); // read the (partial) revision describing the current workspace. void get_work_rev(revision_t & rev); + // if this workspace has exactly one parent, give its revision id; + // otherwise, error out. + void get_unique_base_rid(revision_id & rid); + // convenience wrappers around the above functions. + // This returns a map whose keys are revision_ids and whose values are + // rosters, there being one such pair for each parent of the current + // revision. + // + // Usually you will need both the parents and the current roster, in which + // case it is more efficient to use get_current_roster_shape (below). + void get_parent_rosters(parent_map & parents); + // This returns the current roster, except it does not bother updating the // hashes in that roster -- the "shape" is correct, all files and dirs // exist and under the correct names -- but do not trust file content // hashes. If you need the current roster with correct file content // hashes, call update_current_roster_from_filesystem on the result of // this function. Under almost all conditions, NIS should be a - // temp_node_id_source. - void get_current_roster_shape(roster_t & ros, node_id_source & nis); + // temp_node_id_source. (It also returns the parent rosters, because this + // is free.) + void get_current_roster_shape(parent_map & parents, + roster_t & ros, node_id_source & nis); - // This returns a map whose keys are revision_ids and whose values are - // rosters, there being one such pair for each parent of the current - // revision. - void get_parent_rosters(parent_map & parents); - // Inspect the workspace and classify all the paths in it according to // what ROS thinks of them. void classify_roster_paths(roster_t const & ros, @@ -201,6 +213,7 @@ private: // lua hooks, we don't have to know about app_state. workspace(database & db, lua_hooks & lua) : db(db), lua(lua) {}; private: + void put_work_rev(revision_t const & rev); database & db; lua_hooks & lua; };