# # patch "commands.cc" # from [5a1211707b2a23f21a71bc37da519144c8381ce4] # to [d7e7b92d1e4ccf821940eadedec51e5e4af7aafc] # # patch "restrictions.cc" # from [796355f19d1f74c8080da8ea37bed01a3fd9c6b0] # to [d8b858b9238bbdfcc874f17e0a8e342e3d520f5d] # # patch "restrictions.hh" # from [edac33b08225c94ec8cdee860aece9d2fb05c68f] # to [00d79bb7b71db313691400e14d2dc8f92f149781] # # patch "roster.cc" # from [74b027c27b8f4dfa1d19ed2e9971273cbd173054] # to [98bd204e06e2108222d04f32c62350bee2ab24c1] # # patch "work.cc" # from [a0ff264fdddfaa222eaa72a6bd70aa6a6801fc65] # to [b2fa1d82afee362d21de6e861334cd2424fb3088] # # patch "work.hh" # from [e69fe80720ad44a1b9079de769cbd9075db1d2ac] # to [05e6b510752a602e407b64f73da50818837b2689] # ======================================================================== --- commands.cc 5a1211707b2a23f21a71bc37da519144c8381ce4 +++ commands.cc d7e7b92d1e4ccf821940eadedec51e5e4af7aafc @@ -1151,8 +1151,7 @@ static void find_unknown_and_ignored (app_state & app, bool want_ignored, vector const & args, path_set & unknown, path_set & ignored); -/* -// FIXME_ROSTERS: disabled until rewritten to use rosters + CMD(add, N_("working copy"), N_("[PATH]..."), N_("add files to working copy"), OPT_UNKNOWN) { @@ -1161,11 +1160,12 @@ app.require_working_copy(); - manifest_map m_old; - get_base_manifest(app, m_old); + revision_id base_rid; + roster_t base_roster; + cset work; - change_set::path_rearrangement work; - get_path_rearrangement(work); + get_base_revision(app, base_rid, base_roster); + get_work_cset(work); vector paths; for (vector::const_iterator i = args.begin(); i != args.end(); ++i) @@ -1181,15 +1181,18 @@ if (paths.size() == 0) return; - build_additions(paths, m_old, app, work); + build_additions(paths, base_roster, app, work); - put_path_rearrangement(work); + put_work_cset(work); update_any_attrs(app); } static void find_missing (app_state & app, vector const & args, path_set & missing); +/* +FIXME_ROSTERS + CMD(drop, N_("working copy"), N_("[PATH]..."), N_("drop files from working copy"), OPT_EXECUTE % OPT_MISSING) { @@ -1656,44 +1659,44 @@ } } -/* -// FIXME_ROSTERS: disabled until rewritten to use rosters - static void ls_known (app_state & app, vector const & args) { revision_set rs; - manifest_map m_old, m_new; + roster_t old_roster, new_roster; data tmp; app.require_working_copy(); - calculate_restricted_revision(app, args, rs, m_old, m_new); - - for (manifest_map::const_iterator p = m_new.begin(); p != m_new.end(); ++p) + path_set paths; + get_working_revision_and_rosters(app, args, rs, old_roster, new_roster); + new_roster.extract_path_set(paths); + + for (path_set::const_iterator p = paths.begin(); p != paths.end(); ++p) { - file_path const & path(p->first); + file_path path(*p); if (app.restriction_includes(path)) - cout << p->first << '\n'; + cout << path << endl; } } + static void find_unknown_and_ignored (app_state & app, bool want_ignored, vector const & args, path_set & unknown, path_set & ignored) { revision_set rev; - manifest_map m_old, m_new; - //path_set known, unknown, ignored; + roster_t old_roster, new_roster; path_set known; - calculate_restricted_revision(app, args, rev, m_old, m_new); + get_working_revision_and_rosters(app, args, rev, old_roster, new_roster); + new_roster.extract_path_set(known); - extract_path_set(m_new, known); file_itemizer u(app, known, unknown, ignored); walk_tree(file_path(), u); } + static void ls_unknown_or_ignored (app_state & app, bool want_ignored, vector const & args) { @@ -1704,47 +1707,37 @@ if (want_ignored) for (path_set::const_iterator i = ignored.begin(); i != ignored.end(); ++i) - cout << *i << endl; + cout << file_path(*i) << endl; else for (path_set::const_iterator i = unknown.begin(); i != unknown.end(); ++i) - cout << *i << endl; + cout << file_path(*i) << endl; } -// FIXME_ROSTERS: disabled until rewritten to use rosters + static void find_missing (app_state & app, vector const & args, path_set & missing) { - revision_set rev; - revision_id rid; - manifest_id mid; - manifest_map man; - change_set::path_rearrangement work, included, excluded; + revision_id base_rid; + roster_t base_roster; + cset included_work, excluded_work; path_set old_paths, new_paths; app.require_working_copy(); - get_base_revision(app, rid, mid, man); - get_path_rearrangement(work); - extract_path_set(man, old_paths); + get_base_roster_and_working_cset(app, args, base_rid, base_roster, + old_paths, new_paths, + included_work, excluded_work); - path_set valid_paths(old_paths); - - extract_rearranged_paths(work, valid_paths); - add_intermediate_paths(valid_paths); - app.set_restriction(valid_paths, args); - - restrict_path_rearrangement(work, included, excluded, app); - - apply_path_rearrangement(old_paths, included, new_paths); - for (path_set::const_iterator i = new_paths.begin(); i != new_paths.end(); ++i) { - if (app.restriction_includes(*i) && !path_exists(*i)) + file_path fp(*i); + if (app.restriction_includes(fp) && !path_exists(fp)) missing.insert(*i); } } + static void ls_missing (app_state & app, vector const & args) { @@ -1753,11 +1746,11 @@ for (path_set::const_iterator i = missing.begin(); i != missing.end(); ++i) { - cout << *i << endl; + cout << file_path(*i) << endl; } } -*/ + CMD(list, N_("informative"), N_("certs ID\n" "keys [PATTERN]\n" @@ -1791,8 +1784,6 @@ ls_tags(name, app, removed); else if (idx(args, 0)() == "vars") ls_vars(name, app, removed); -/* -// FIXME_ROSTERS: disabled until rewritten to use rosters else if (idx(args, 0)() == "known") ls_known(app, removed); else if (idx(args, 0)() == "unknown") @@ -1801,7 +1792,6 @@ ls_unknown_or_ignored(app, true, removed); else if (idx(args, 0)() == "missing") ls_missing(app, removed); -*/ else throw usage(name); } ======================================================================== --- restrictions.cc 796355f19d1f74c8080da8ea37bed01a3fd9c6b0 +++ restrictions.cc d8b858b9238bbdfcc874f17e0a8e342e3d520f5d @@ -125,7 +125,7 @@ // Project the old_paths through r_old + work, to find the new names of the // paths (if they survived work) -static void +void remap_paths(path_set const & old_paths, roster_t const & r_old, cset const & work, @@ -153,7 +153,6 @@ get_base_roster_and_working_cset(app_state & app, std::vector const & args, revision_id & old_revision_id, - manifest_id & old_manifest_id, roster_t & old_roster, path_set & old_paths, path_set & new_paths, @@ -192,12 +191,12 @@ rev.edges.clear(); get_base_roster_and_working_cset(app, args, old_revision_id, - old_manifest_id, old_roster, old_paths, new_paths, *cs, excluded); - + + calculate_ident(old_roster, old_manifest_id); build_restricted_roster(new_paths, old_roster, new_roster, app); calculate_ident(new_roster, rev.new_manifest); L(F("new manifest_id is %s\n") % rev.new_manifest); ======================================================================== --- restrictions.hh edac33b08225c94ec8cdee860aece9d2fb05c68f +++ restrictions.hh 00d79bb7b71db313691400e14d2dc8f92f149781 @@ -24,11 +24,16 @@ cset & excluded, app_state & app); +void +remap_paths(path_set const & old_paths, + roster_t const & r_old, + cset const & work, + path_set & new_paths); + void get_base_roster_and_working_cset(app_state & app, std::vector const & args, revision_id & old_revision_id, - manifest_id & old_manifest_id, roster_t & old_roster, path_set & old_paths, path_set & new_paths, ======================================================================== --- roster.cc 74b027c27b8f4dfa1d19ed2e9971273cbd173054 +++ roster.cc 98bd204e06e2108222d04f32c62350bee2ab24c1 @@ -1670,6 +1670,7 @@ void make_cset(roster_t const & from, roster_t const & to, cset & cs) { + cs.clear(); map::const_iterator from_i, to_i; parallel_state state = start; while (parallel_iter_incr(state, ======================================================================== --- work.cc a0ff264fdddfaa222eaa72a6bd70aa6a6801fc65 +++ work.cc b2fa1d82afee362d21de6e861334cd2424fb3088 @@ -13,6 +13,7 @@ #include "basic_io.hh" #include "cset.hh" #include "file_io.hh" +#include "platform.hh" #include "sanity.hh" #include "transforms.hh" #include "vocab.hh" @@ -40,23 +41,19 @@ } } -/* -// FIXME_ROSTERS: disabled until rewritten to use rosters class addition_builder : public tree_walker { app_state & app; - change_set::path_rearrangement & pr; - path_set ps; - attr_map & am_attrs; + roster_t & ros; + editable_roster_base & er; public: - addition_builder(app_state & a, - change_set::path_rearrangement & pr, - path_set & p, - attr_map & am) - : app(a), pr(pr), ps(p), am_attrs(am) + addition_builder(app_state & a, + roster_t & r, + editable_roster_base & e) + : app(a), ros(r), er(e) {} virtual void visit_file(file_path const & path); }; @@ -70,89 +67,72 @@ return; } - if (ps.find(path) != ps.end()) + split_path sp; + path.split(sp); + if (ros.has_node(sp)) { P(F("skipping %s, already accounted for in working copy\n") % path); return; } P(F("adding %s to working copy add set\n") % path); - ps.insert(path); - pr.added_files.insert(path); + node_id nid = the_null_node; + switch (get_path_status(path)) + { + case path::nonexistent: + return; + case path::file: + { + file_id ident; + I(ident_existing_file(path, ident, app.lua)); + nid = er.create_file_node(ident); + } + break; + case path::directory: + er.create_dir_node(); + break; + } + + I(nid != the_null_node); + er.attach_node(nid, sp); + map attrs; app.lua.hook_init_attributes(path, attrs); if (attrs.size() > 0) - am_attrs[path] = attrs; + { + for (map::const_iterator i = attrs.begin(); + i != attrs.end(); ++i) + { + er.set_attr(sp, attr_key(i->first), attr_value(i->second)); + } + } } void build_additions(vector const & paths, - manifest_map const & man, + roster_t const & base_roster, app_state & app, - change_set::path_rearrangement & pr) + cset & work) { - change_set::path_rearrangement pr_new, pr_concatenated; - change_set cs_new; + temp_node_id_source nis; + roster_t new_roster(base_roster); + editable_roster_base er(new_roster, nis); - path_set ps; - attr_map am_attrs; - extract_path_set(man, ps); - apply_path_rearrangement(pr, ps); + work.apply_to(er); + addition_builder build(app, new_roster, er); - addition_builder build(app, pr_new, ps, am_attrs); - for (vector::const_iterator i = paths.begin(); i != paths.end(); ++i) // NB.: walk_tree will handle error checking for non-existent paths walk_tree(*i, build); - if (am_attrs.size () > 0) - { - // add .mt-attrs to manifest if not already registered - file_path attr_path; - get_attr_path(attr_path); + work.clear(); + make_cset(base_roster, new_roster, work); +} - if ((man.find(attr_path) == man.end ()) && - (pr_new.added_files.find(attr_path) == pr_new.added_files.end())) - { - P(F("registering %s file in working copy\n") % attr_path); - pr.added_files.insert(attr_path); - } +/* +// FIXME_ROSTERS: disabled until rewritten to use rosters - // read attribute map if available - data attr_data; - attr_map attrs; - - if (path_exists(attr_path)) - { - read_data(attr_path, attr_data); - read_attr_map(attr_data, attrs); - } - - // add new attribute entries - for (attr_map::const_iterator i = am_attrs.begin(); - i != am_attrs.end(); ++i) - { - map m = i->second; - - for (map::const_iterator j = m.begin(); - j != m.end(); ++j) - { - P(F("adding attribute '%s' on file %s to %s\n") % j->first % i->first % attr_file_name); - attrs[i->first][j->first] = j->second; - } - } - - // write out updated map - write_attr_map(attr_data, attrs); - write_data(attr_path, attr_data); - } - - normalize_path_rearrangement(pr_new); - concatenate_rearrangements(pr, pr_new, pr_concatenated); - pr = pr_concatenated; -} - static bool known_path(file_path const & p, path_set const & ps, @@ -750,6 +730,8 @@ void update_any_attrs(app_state & app) { +/* +// FIXME_ROSTERS: disabled until rewritten to use rosters file_path fp; data attr_data; attr_map attr; @@ -761,4 +743,5 @@ read_data(fp, attr_data); read_attr_map(attr_data, attr); apply_attributes(app, attr); +*/ } ======================================================================== --- work.hh e69fe80720ad44a1b9079de769cbd9075db1d2ac +++ work.hh 05e6b510752a602e407b64f73da50818837b2689 @@ -58,15 +58,16 @@ : app(a), known(k), unknown(u), ignored(i) {} virtual void file_itemizer::visit_file(file_path const & path); }; -/* -// FIXME_ROSTERS: disabled until rewritten to use rosters void build_additions(std::vector const & args, - manifest_map const & m_old, - app_state & app, - change_set::path_rearrangement & pr); + roster_t const & base_roster, + app_state & app, + cset & work); +/* +// FIXME_ROSTERS: disabled until rewritten to use rosters + void build_deletions(std::vector const & args, manifest_map const & m_old,