# # # patch "restrictions.cc" # from [5ae2c8255b6eb1e65662d68d5889ac9d4d3c24c8] # to [939e4f36a1d0e03753dd7bfe987049a4ef9dfaae] # # patch "restrictions.hh" # from [f0b311b47b461a5f9479bef3c5dcb28f1eaf5131] # to [d0aa78679af9a425d5b8aa3a3858574a22588dc4] # ============================================================ --- restrictions.cc 5ae2c8255b6eb1e65662d68d5889ac9d4d3c24c8 +++ restrictions.cc 939e4f36a1d0e03753dd7bfe987049a4ef9dfaae @@ -140,12 +140,11 @@ // paths (if they survived work) void -remap_paths(path_set const & old_paths, +remap_paths_noclear(path_set const & old_paths, roster_t const & r_old, cset const & work, path_set & new_paths) { - new_paths.clear(); temp_node_id_source nis; roster_t r_tmp = r_old; editable_roster_base er(r_tmp, nis); @@ -164,41 +163,64 @@ } void +remap_paths(path_set const & old_paths, + roster_t const & r_old, + cset const & work, + path_set & new_paths) +{ + new_paths.clear(); + remap_paths_noclear(old_paths, r_old, work, new_paths); +} + +void get_base_roster_and_working_cset(app_state & app, std::vector const & args, - revision_id & old_revision_id, - roster_t & old_roster, - path_set & old_paths, - path_set & new_paths, - cset & included, - cset & excluded) + std::vector & edges, + path_set & new_paths) { - cset work; + parentage parents; + revision_set rs; + get_workspace_parentage_and_revision(app, parents, rs); + edges.clear(); + new_paths.clear(); - get_base_revision(app, old_revision_id, old_roster); - get_work_cset(work); + for (parentage::iterator i = parents.begin(); i != parents.end(); ++i) + { + edges.push_back(restricted_edge()); + roster_t & old_roster(edges.back().old_roster); + path_set & old_paths(edges.back().old_paths); + cset & included(edges.back().included); + cset & excluded(edges.back().excluded); + old_roster = i->second; + edges.back().old_id = i->first; - old_roster.extract_path_set(old_paths); + edge_map::iterator cs = rs.edges.find(i->first); + I(cs != rs.edges.end()); + cset & work(*(cs->second)); - path_set valid_paths(old_paths); - extract_rearranged_paths(work, valid_paths); - add_intermediate_paths(valid_paths); - app.set_restriction(valid_paths, args); - restrict_cset(work, included, excluded, app); - remap_paths(old_paths, old_roster, work, new_paths); + old_roster.extract_path_set(old_paths); - for (path_set::const_iterator i = included.dirs_added.begin(); - i != included.dirs_added.end(); ++i) - new_paths.insert(*i); + path_set valid_paths(old_paths); + extract_rearranged_paths(work, valid_paths); + add_intermediate_paths(valid_paths); + app.set_restriction(valid_paths, args); + + restrict_cset(work, included, excluded, app); + remap_paths_noclear(old_paths, old_roster, work, new_paths); + + for (path_set::const_iterator i = included.dirs_added.begin(); + i != included.dirs_added.end(); ++i) + new_paths.insert(*i); - for (std::map::const_iterator i = included.files_added.begin(); - i != included.files_added.end(); ++i) - new_paths.insert(i->first); + for (std::map::const_iterator i = included.files_added.begin(); + i != included.files_added.end(); ++i) + new_paths.insert(i->first); - for (std::map::const_iterator i = included.nodes_renamed.begin(); - i != included.nodes_renamed.end(); ++i) - new_paths.insert(i->second); + for (std::map::const_iterator i = included.nodes_renamed.begin(); + i != included.nodes_renamed.end(); ++i) + new_paths.insert(i->second); + } } void ============================================================ --- restrictions.hh f0b311b47b461a5f9479bef3c5dcb28f1eaf5131 +++ restrictions.hh d0aa78679af9a425d5b8aa3a3858574a22588dc4 @@ -54,15 +54,20 @@ cset const & work, path_set & new_paths); +struct restricted_edge +{ + revision_id old_id; + roster_t old_roster; + path_set old_paths; + cset included; + cset excluded; +}; + void get_base_roster_and_working_cset(app_state & app, std::vector const & args, - revision_id & old_revision_id, - roster_t & old_roster, - path_set & old_paths, - path_set & new_paths, - cset & included, - cset & excluded); + std::vector & edges, + path_set & new_paths); void get_working_revision_and_rosters(app_state & app,