# # # patch "commands.cc" # from [f61366a34e5f0fbaf4e25253c67181b4740bb67b] # to [679c59d39816fb77b7c1e98d69fa580fffb63580] # # patch "roster.cc" # from [65d9f9f930511f393677d810ae21f16ab0fd5ed8] # to [9a4c19826701e0ad7c72d317550b56cd2bd9242f] # # patch "roster.hh" # from [636dd3bbc57a020653b485400165accd2fa23d76] # to [5162a38542d92b1a6b619a4f20e3f83c10b0506c] # ============================================================ --- commands.cc f61366a34e5f0fbaf4e25253c67181b4740bb67b +++ commands.cc 679c59d39816fb77b7c1e98d69fa580fffb63580 @@ -1160,8 +1160,9 @@ } -static void find_unknown_and_ignored (app_state & app, bool want_ignored, vector const & args, - path_set & unknown, path_set & ignored); +static void find_unknown_and_ignored(app_state & app, bool want_ignored, + vector const & args, + path_set & unknown, path_set & ignored); CMD(add, N_("working copy"), N_("[PATH]..."), @@ -1189,8 +1190,8 @@ perform_additions(paths, app); } -static void find_missing (app_state & app, - vector const & args, path_set & missing); +static void find_missing(app_state & app, + vector const & args, path_set & missing); CMD(drop, N_("working copy"), N_("[PATH]..."), N_("drop files from working copy"), OPT_EXECUTE % OPT_MISSING) @@ -1636,31 +1637,47 @@ } static void -ls_known (app_state & app, vector const & args) +ls_known(app_state & app, vector const & args) { - revision_set rs; + path_set paths; roster_t old_roster, new_roster; - data tmp; + temp_node_id_source nis; + restriction mask; app.require_working_copy(); - path_set paths; - get_working_revision_and_rosters(app, args, rs, old_roster, new_roster); - new_roster.extract_path_set(paths); - - // FIXME_RESTRICTIONS: this looks ok for roster restriction + get_base_and_current_roster_shape(old_roster, new_roster, nis, app); - for (path_set::const_iterator p = paths.begin(); p != paths.end(); ++p) + for (vector::const_iterator i = args.begin(); i != args.end(); ++i) { - if (app.restriction_includes(*p)) - cout << file_path(*p) << endl; + split_path sp; + file_path_external(*i).split(sp); + paths.insert(sp); } + + mask.add_nodes(new_roster, paths); + + // TODO: check for invalid paths that don't exist in either roster + + node_map const & nodes = new_roster.all_nodes(); + for (node_map::const_iterator i = nodes.begin(); i != nodes.end(); ++i) + { + node_id nid = i->first; + + if (!new_roster.is_root(nid) && mask.includes(new_roster, nid)) + { + split_path sp; + new_roster.get_name(nid, sp); + cout << file_path(sp) << endl; + } + } + } static void -find_unknown_and_ignored (app_state & app, bool want_ignored, vector const & args, - path_set & unknown, path_set & ignored) +find_unknown_and_ignored(app_state & app, bool want_ignored, vector const & args, + path_set & unknown, path_set & ignored) { revision_set rev; roster_t old_roster, new_roster; @@ -1675,7 +1692,7 @@ static void -ls_unknown_or_ignored (app_state & app, bool want_ignored, vector const & args) +ls_unknown_or_ignored(app_state & app, bool want_ignored, vector const & args) { app.require_working_copy(); @@ -1692,36 +1709,46 @@ static void -find_missing (app_state & app, vector const & args, path_set & missing) +find_missing(app_state & app, vector const & args, path_set & missing) { - revision_id base_rid; - roster_t base_roster; - cset included_work, excluded_work; - path_set old_paths, new_paths; + path_set paths; + roster_t old_roster, new_roster; + temp_node_id_source nis; + restriction mask; - app.require_working_copy(); - get_base_roster_and_working_cset(app, args, base_rid, base_roster, - old_paths, new_paths, - included_work, excluded_work); + get_base_and_current_roster_shape(old_roster, new_roster, nis, app); - // FIXME_RESTRICTIONS: this looks ok for roster restriction + for (vector::const_iterator i = args.begin(); i != args.end(); ++i) + { + split_path sp; + file_path_external(*i).split(sp); + paths.insert(sp); + } - for (path_set::const_iterator i = new_paths.begin(); i != new_paths.end(); ++i) + mask.add_nodes(new_roster, paths); + + // TODO: check for invalid paths that don't exist in either roster + + node_map const & nodes = new_roster.all_nodes(); + for (node_map::const_iterator i = nodes.begin(); i != nodes.end(); ++i) { - if (i->size() == 1) + node_id nid = i->first; + + if (!new_roster.is_root(nid) && mask.includes(new_roster, nid)) { - I(null_name(idx(*i, 0))); - continue; + split_path sp; + new_roster.get_name(nid, sp); + file_path fp(sp); + + if (!path_exists(fp)) + missing.insert(sp); } - file_path fp(*i); - if (app.restriction_includes(*i) && !path_exists(fp)) - missing.insert(*i); } } static void -ls_missing (app_state & app, vector const & args) +ls_missing(app_state & app, vector const & args) { path_set missing; find_missing(app, args, missing); @@ -3563,6 +3590,9 @@ nodes_changed, nodes_born, app); + + // FIXME_RESTRICTIONS: this looks ok for roster restriction + for (set::const_iterator n = nodes.begin(); n != nodes.end(); ++n) { if (nodes_changed.find(*n) != nodes_changed.end() ============================================================ --- roster.cc 65d9f9f930511f393677d810ae21f16ab0fd5ed8 +++ roster.cc 9a4c19826701e0ad7c72d317550b56cd2bd9242f @@ -531,6 +531,12 @@ } bool +roster_t::is_root(node_id n) const +{ + return has_root() && root_dir->self == n; +} + +bool roster_t::has_node(split_path const & sp) const { split_path dirname; ============================================================ --- roster.hh 636dd3bbc57a020653b485400165accd2fa23d76 +++ roster.hh 5162a38542d92b1a6b619a4f20e3f83c10b0506c @@ -178,6 +178,7 @@ bool has_root() const; bool has_node(split_path const & sp) const; bool has_node(node_id nid) const; + bool is_root(node_id nid) const; node_t get_node(split_path const & sp) const; node_t get_node(node_id nid) const; void get_name(node_id nid, split_path & sp) const;