# # # patch "automate.cc" # from [33634801cd1993a76ec4dd447f1584f2679d0eea] # to [e688920b10fa396e5905dabff6de466f7a044158] # # patch "cmd_diff_log.cc" # from [a52cb5ad052e0db410a963f065532f8010688ad5] # to [6212181d5e3d7b90182b1253cf5a7006d8256af2] # # patch "cmd_list.cc" # from [55a0d5daa3bd6f68a7bb6d06191af37a0cc97c05] # to [866bc63bb2443fc1260f2cebcfdfbdfc9a358e02] # # patch "cmd_merging.cc" # from [0f8c0d8308a37a4477d1d2eb1d696144d8ab2fe0] # to [63784e8d2c75c976e83e63303e09e455c562ce55] # # patch "cmd_ws_commit.cc" # from [edaf65d2c5ef37448d14ca60863af76ca22d49cf] # to [2211926e7f74fc2957d46014cf7020e681c09a6f] # # patch "restrictions.cc" # from [9a37177b1a374c1973c01da3d4729e3a5d854453] # to [1f3d1281e74f437845fb5aba55cdd694b365c1be] # # patch "restrictions.hh" # from [d588f4ba6876b51d61d3f37f4836bf2272434310] # to [cee8935494decf51ba9845f71885cb4436040814] # # patch "work.cc" # from [bcea6fae446e61352e4a12e0259a9094970a9829] # to [62af314cb6091e9fea62941b6c0a528477141320] # # patch "work.hh" # from [8ba21b48a4ac6d7c479b6116f0da96dcbf902f66] # to [e4907e90a0310dd2c7e790bbac983fd4f7c6b493] # ============================================================ --- automate.cc 33634801cd1993a76ec4dd447f1584f2679d0eea +++ automate.cc e688920b10fa396e5905dabff6de466f7a044158 @@ -656,16 +656,16 @@ struct inventory_itemizer : public tree_ { path_restriction const & mask; inventory_map & inventory; - app_state & app; inodeprint_map ipm; - inventory_itemizer(path_restriction const & m, inventory_map & i, app_state & a) : - mask(m), inventory(i), app(a) + inventory_itemizer(path_restriction const & m, inventory_map & i, + workspace & work) : + mask(m), inventory(i) { - if (app.work.in_inodeprints_mode()) + if (work.in_inodeprints_mode()) { data dat; - app.work.read_inodeprints(dat); + work.read_inodeprints(dat); read_inodeprint_map(dat, ipm); } } @@ -704,9 +704,10 @@ static void } static void -inventory_filesystem(path_restriction const & mask, inventory_map & inventory, app_state & app) +inventory_filesystem(path_restriction const & mask, inventory_map & inventory, + workspace & work) { - inventory_itemizer itemizer(mask, inventory, app); + inventory_itemizer itemizer(mask, inventory, work); file_path const root; // The constructor file_path() returns ""; the root directory. walk_tree // does not visit that node, so set fs_type now, if it meets the @@ -734,7 +735,7 @@ static void } static void -inventory_print_states(app_state & app, file_path const & fs_path, +inventory_print_states(workspace & work, file_path const & fs_path, inventory_item const & item, roster_t const & old_roster, roster_t const & new_roster, basic_io::stanza & st) { @@ -786,7 +787,7 @@ inventory_print_states(app_state & app, { if (!item.new_node.exists) { - if (app.lua.hook_ignore_file(fs_path)) + if (work.ignore_file(fs_path)) states.push_back("ignored"); else states.push_back("unknown"); @@ -897,11 +898,12 @@ CMD_AUTOMATE(inventory, N_("[PATH]...") vector includes = args_to_paths(args); vector excludes = args_to_paths(app.opts.exclude_patterns); - node_restriction nmask(includes, excludes, app.opts.depth, old_roster, new_roster, app); + node_restriction nmask(includes, excludes, app.opts.depth, + old_roster, new_roster, app.work); inventory_rosters(old_roster, new_roster, nmask, inventory); - path_restriction pmask(includes, excludes, app.opts.depth, app); - inventory_filesystem(pmask, inventory, app); + path_restriction pmask(includes, excludes, app.opts.depth, app.work); + inventory_filesystem(pmask, inventory, app.work); basic_io::printer pr; @@ -947,7 +949,8 @@ CMD_AUTOMATE(inventory, N_("[PATH]...") case path::nonexistent: st.push_str_pair(syms::fs_type, "none"); break; } - inventory_print_states(app, i->first, item, old_roster, new_roster, st); + inventory_print_states(app.work, i->first, item, + old_roster, new_roster, st); inventory_print_changes(item, old_roster, st); pr.print_stanza(st); ============================================================ --- cmd_diff_log.cc a52cb5ad052e0db410a963f065532f8010688ad5 +++ cmd_diff_log.cc 6212181d5e3d7b90182b1253cf5a7006d8256af2 @@ -378,7 +378,7 @@ prepare_diff(cset & included, node_restriction mask(args_to_paths(args), args_to_paths(app.opts.exclude_patterns), app.opts.depth, - old_roster, new_roster, app); + old_roster, new_roster, app.work); app.work.update_current_roster_from_filesystem(new_roster, mask); @@ -406,7 +406,7 @@ prepare_diff(cset & included, node_restriction mask(args_to_paths(args), args_to_paths(app.opts.exclude_patterns), app.opts.depth, - old_roster, new_roster, app); + old_roster, new_roster, app.work); app.work.update_current_roster_from_filesystem(new_roster, mask); @@ -438,7 +438,7 @@ prepare_diff(cset & included, node_restriction mask(args_to_paths(args), args_to_paths(app.opts.exclude_patterns), app.opts.depth, - old_roster, new_roster, app); + old_roster, new_roster, app.work); // FIXME: this is *possibly* a UI bug, insofar as we // look at the restriction name(s) you provided on the command @@ -689,7 +689,8 @@ CMD(log, "log", "", CMD_REF(informative) mask = node_restriction(args_to_paths(args), args_to_paths(app.opts.exclude_patterns), - app.opts.depth, parents, new_roster, app); + app.opts.depth, parents, new_roster, + app.work); } else { @@ -700,7 +701,7 @@ CMD(log, "log", "", CMD_REF(informative) mask = node_restriction(args_to_paths(args), args_to_paths(app.opts.exclude_patterns), - app.opts.depth, roster, app); + app.opts.depth, roster, app.work); } } ============================================================ --- cmd_list.cc 55a0d5daa3bd6f68a7bb6d06191af37a0cc97c05 +++ cmd_list.cc 866bc63bb2443fc1260f2cebcfdfbdfc9a358e02 @@ -383,7 +383,7 @@ CMD(known, "known", "", CMD_REF(list), " node_restriction mask(args_to_paths(args), args_to_paths(app.opts.exclude_patterns), app.opts.depth, - new_roster, app); + new_roster, app.work); // to be printed sorted vector print_paths; @@ -417,7 +417,7 @@ CMD(unknown, "unknown", "ignored", CMD_R vector roots = args_to_paths(args); path_restriction mask(roots, args_to_paths(app.opts.exclude_patterns), - app.opts.depth, app); + app.opts.depth, app.work); set unknown, ignored; // if no starting paths have been specified use the workspace root @@ -449,7 +449,7 @@ CMD(missing, "missing", "", CMD_REF(list node_restriction mask(args_to_paths(args), args_to_paths(app.opts.exclude_patterns), app.opts.depth, - current_roster_shape, app); + current_roster_shape, app.work); set missing; app.work.find_missing(current_roster_shape, mask, missing); @@ -478,7 +478,7 @@ CMD(changed, "changed", "", CMD_REF(list node_restriction mask(args_to_paths(args), args_to_paths(app.opts.exclude_patterns), app.opts.depth, - parents, new_roster, app); + parents, new_roster, app.work); revision_t rrev; make_restricted_revision(parents, new_roster, mask, rrev); ============================================================ --- cmd_merging.cc 0f8c0d8308a37a4477d1d2eb1d696144d8ab2fe0 +++ cmd_merging.cc 63784e8d2c75c976e83e63303e09e455c562ce55 @@ -934,7 +934,7 @@ CMD(pluck, "pluck", "", CMD_REF(workspac node_restriction mask(args_to_paths(args), args_to_paths(app.opts.exclude_patterns), app.opts.depth, - *from_roster, to_true_roster, app); + *from_roster, to_true_roster, app.work); roster_t restricted_roster; make_restricted_roster(*from_roster, to_true_roster, ============================================================ --- cmd_ws_commit.cc edaf65d2c5ef37448d14ca60863af76ca22d49cf +++ cmd_ws_commit.cc 2211926e7f74fc2957d46014cf7020e681c09a6f @@ -171,7 +171,7 @@ CMD(revert, "revert", "", CMD_REF(worksp node_restriction mask(args_to_paths(args), args_to_paths(app.opts.exclude_patterns), app.opts.depth, - old_roster, new_roster, app); + old_roster, new_roster, app.work); if (app.opts.missing) { @@ -197,7 +197,7 @@ CMD(revert, "revert", "", CMD_REF(worksp // replace the original mask with a more restricted one mask = node_restriction(missing_files, std::vector(), app.opts.depth, - old_roster, new_roster, app); + old_roster, new_roster, app.work); } // We want the restricted roster to include all the changes @@ -359,7 +359,7 @@ CMD(mkdir, "mkdir", "", CMD_REF(workspac // we'll treat this as a user (fatal) error. it really wouldn't make // sense to add a dir to .mtn-ignore and then try to add it to the // project with a mkdir statement, but one never can tell... - N(app.opts.no_ignore || !app.lua.hook_ignore_file(fp), + N(app.opts.no_ignore || !app.work.ignore_file(fp), F("ignoring directory '%s' [see .mtn-ignore]") % fp); paths.insert(fp); @@ -391,7 +391,7 @@ CMD(add, "add", "", CMD_REF(workspace), if (app.opts.unknown) { path_restriction mask(roots, args_to_paths(app.opts.exclude_patterns), - app.opts.depth, app); + app.opts.depth, app.work); set ignored; // if no starting paths have been specified use the workspace root @@ -427,7 +427,7 @@ CMD(drop, "drop", "rm", CMD_REF(workspac node_restriction mask(args_to_paths(args), args_to_paths(app.opts.exclude_patterns), app.opts.depth, - current_roster_shape, app); + current_roster_shape, app.work); app.work.find_missing(current_roster_shape, mask, paths); } else @@ -510,7 +510,7 @@ CMD(status, "status", "", CMD_REF(inform node_restriction mask(args_to_paths(args), args_to_paths(app.opts.exclude_patterns), app.opts.depth, - old_rosters, new_roster, app); + old_rosters, new_roster, app.work); app.work.update_current_roster_from_filesystem(new_roster, mask); make_restricted_revision(old_rosters, new_roster, mask, rev); @@ -1018,7 +1018,7 @@ CMD(commit, "commit", "ci", CMD_REF(work node_restriction mask(args_to_paths(args), args_to_paths(app.opts.exclude_patterns), app.opts.depth, - old_rosters, new_roster, app); + old_rosters, new_roster, app.work); app.work.update_current_roster_from_filesystem(new_roster, mask); make_restricted_revision(old_rosters, new_roster, mask, restricted_rev, ============================================================ --- restrictions.cc 9a37177b1a374c1973c01da3d4729e3a5d854453 +++ restrictions.cc 1f3d1281e74f437845fb5aba55cdd694b365c1be @@ -15,7 +15,17 @@ #include "revision.hh" #include "safe_map.hh" #include "transforms.hh" +#include "work.hh" +#include "file_io.hh" + +#ifdef BUILD_UNIT_TESTS +// This must appear above the using-declarations, or we get errors deep +// within botan because "set" doesn't mean what botan thinks it means. #include "app_state.hh" +#include "unit_tests.hh" +#include "roster.hh" +#include "sanity.hh" +#endif using std::make_pair; using std::map; @@ -75,7 +85,7 @@ validate_roster_paths(set con validate_roster_paths(set const & included_paths, set const & excluded_paths, set const & known_paths, - app_state & app) + workspace & work) { int bad = 0; @@ -87,7 +97,7 @@ validate_roster_paths(set con // rosters if (known_paths.find(*i) == known_paths.end()) { - if (!app.lua.hook_ignore_file(*i)) + if (!work.ignore_file(*i)) { bad++; W(F("restriction includes unknown path '%s'") % *i); @@ -111,7 +121,7 @@ validate_workspace_paths(set void validate_workspace_paths(set const & included_paths, set const & excluded_paths, - app_state & app) + workspace & work) { int bad = 0; @@ -124,7 +134,7 @@ validate_workspace_paths(set // ignored paths are allowed into the restriction but are not // considered invalid if they are found in none of the restriction's // rosters - if (!path_exists(*i) && !app.lua.hook_ignore_file(*i)) + if (!path_exists(*i) && !work.ignore_file(*i)) { bad++; W(F("restriction includes unknown path '%s'") % *i); @@ -159,7 +169,7 @@ node_restriction::node_restriction(std:: std::vector const & excludes, long depth, roster_t const & roster, - app_state & a) : + workspace & w) : restriction(includes, excludes, depth) { map_nodes(node_map, roster, included_paths, known_paths, @@ -167,7 +177,7 @@ node_restriction::node_restriction(std:: map_nodes(node_map, roster, excluded_paths, known_paths, restricted_path::excluded); - validate_roster_paths(included_paths, excluded_paths, known_paths, a); + validate_roster_paths(included_paths, excluded_paths, known_paths, w); } node_restriction::node_restriction(std::vector const & includes, @@ -175,7 +185,7 @@ node_restriction::node_restriction(std:: long depth, roster_t const & roster1, roster_t const & roster2, - app_state & a) : + workspace & w) : restriction(includes, excludes, depth) { map_nodes(node_map, roster1, included_paths, known_paths, @@ -188,7 +198,7 @@ node_restriction::node_restriction(std:: map_nodes(node_map, roster2, excluded_paths, known_paths, restricted_path::excluded); - validate_roster_paths(included_paths, excluded_paths, known_paths, a); + validate_roster_paths(included_paths, excluded_paths, known_paths, w); } node_restriction::node_restriction(std::vector const & includes, @@ -196,7 +206,7 @@ node_restriction::node_restriction(std:: long depth, parent_map const & rosters1, roster_t const & roster2, - app_state & a) : + workspace & w) : restriction(includes, excludes, depth) { for (parent_map::const_iterator i = rosters1.begin(); @@ -214,20 +224,20 @@ node_restriction::node_restriction(std:: map_nodes(node_map, roster2, excluded_paths, known_paths, restricted_path::excluded); - validate_roster_paths(included_paths, excluded_paths, known_paths, a); + validate_roster_paths(included_paths, excluded_paths, known_paths, w); } path_restriction::path_restriction(std::vector const & includes, std::vector const & excludes, long depth, - app_state & a) : + workspace & w) : restriction(includes, excludes, depth) { map_paths(path_map, included_paths, restricted_path::included); map_paths(path_map, excluded_paths, restricted_path::excluded); - validate_workspace_paths(included_paths, excluded_paths, a); + validate_workspace_paths(included_paths, excluded_paths, w); } bool @@ -392,10 +402,6 @@ path_restriction::includes(file_path con /////////////////////////////////////////////////////////////////////// #ifdef BUILD_UNIT_TESTS -#include "app_state.hh" -#include "unit_tests.hh" -#include "roster.hh" -#include "sanity.hh" using std::string; @@ -610,7 +616,7 @@ UNIT_TEST(restrictions, simple_include) // check restricted nodes - node_restriction nmask(includes, excludes, -1, roster, app); + node_restriction nmask(includes, excludes, -1, roster, app.work); UNIT_TEST_CHECK(!nmask.empty()); @@ -640,7 +646,7 @@ UNIT_TEST(restrictions, simple_include) // check restricted paths - path_restriction pmask(includes, excludes, -1, app); + path_restriction pmask(includes, excludes, -1, app.work); UNIT_TEST_CHECK(!pmask.empty()); @@ -682,7 +688,7 @@ UNIT_TEST(restrictions, simple_exclude) // check restricted nodes - node_restriction nmask(includes, excludes, -1, roster, app); + node_restriction nmask(includes, excludes, -1, roster, app.work); UNIT_TEST_CHECK(!nmask.empty()); @@ -712,7 +718,7 @@ UNIT_TEST(restrictions, simple_exclude) // check restricted paths - path_restriction pmask(includes, excludes, -1, app); + path_restriction pmask(includes, excludes, -1, app.work); UNIT_TEST_CHECK(!pmask.empty()); @@ -756,7 +762,7 @@ UNIT_TEST(restrictions, include_exclude) // check restricted nodes - node_restriction nmask(includes, excludes, -1, roster, app); + node_restriction nmask(includes, excludes, -1, roster, app.work); UNIT_TEST_CHECK(!nmask.empty()); @@ -786,7 +792,7 @@ UNIT_TEST(restrictions, include_exclude) // check restricted paths - path_restriction pmask(includes, excludes, -1, app); + path_restriction pmask(includes, excludes, -1, app.work); UNIT_TEST_CHECK(!pmask.empty()); @@ -833,7 +839,7 @@ UNIT_TEST(restrictions, exclude_include) // check restricted nodes - node_restriction nmask(includes, excludes, -1, roster, app); + node_restriction nmask(includes, excludes, -1, roster, app.work); UNIT_TEST_CHECK(!nmask.empty()); @@ -863,7 +869,7 @@ UNIT_TEST(restrictions, exclude_include) // check restricted paths - path_restriction pmask(includes, excludes, -1, app); + path_restriction pmask(includes, excludes, -1, app.work); UNIT_TEST_CHECK(!pmask.empty()); @@ -902,7 +908,8 @@ UNIT_TEST(restrictions, invalid_roster_p excludes.push_back(file_path_internal("bar")); app_state app; - UNIT_TEST_CHECK_THROW(node_restriction(includes, excludes, -1, roster, app), + UNIT_TEST_CHECK_THROW(node_restriction(includes, excludes, -1, roster, + app.work), informative_failure); } @@ -916,7 +923,7 @@ UNIT_TEST(restrictions, invalid_workspac excludes.push_back(file_path_internal("bar")); app_state app; - UNIT_TEST_CHECK_THROW(path_restriction(includes, excludes, -1, app), + UNIT_TEST_CHECK_THROW(path_restriction(includes, excludes, -1, app.work), informative_failure); } @@ -937,7 +944,7 @@ UNIT_TEST(restrictions, include_depth_0) // check restricted nodes - node_restriction nmask(includes, excludes, depth, roster, app); + node_restriction nmask(includes, excludes, depth, roster, app.work); UNIT_TEST_CHECK(!nmask.empty()); @@ -967,7 +974,7 @@ UNIT_TEST(restrictions, include_depth_0) // check restricted paths - path_restriction pmask(includes, excludes, depth, app); + path_restriction pmask(includes, excludes, depth, app.work); UNIT_TEST_CHECK(!pmask.empty()); @@ -1011,7 +1018,7 @@ UNIT_TEST(restrictions, include_depth_0_ // check restricted nodes - node_restriction nmask(includes, excludes, depth, roster, app); + node_restriction nmask(includes, excludes, depth, roster, app.work); UNIT_TEST_CHECK( nmask.empty()); @@ -1041,7 +1048,7 @@ UNIT_TEST(restrictions, include_depth_0_ // check restricted paths - path_restriction pmask(includes, excludes, depth, app); + path_restriction pmask(includes, excludes, depth, app.work); UNIT_TEST_CHECK( pmask.empty()); @@ -1087,7 +1094,7 @@ UNIT_TEST(restrictions, include_depth_1) // check restricted nodes - node_restriction nmask(includes, excludes, depth, roster, app); + node_restriction nmask(includes, excludes, depth, roster, app.work); UNIT_TEST_CHECK(!nmask.empty()); @@ -1117,7 +1124,7 @@ UNIT_TEST(restrictions, include_depth_1) // check restricted paths - path_restriction pmask(includes, excludes, depth, app); + path_restriction pmask(includes, excludes, depth, app.work); UNIT_TEST_CHECK(!pmask.empty()); ============================================================ --- restrictions.hh d588f4ba6876b51d61d3f37f4836bf2272434310 +++ restrictions.hh cee8935494decf51ba9845f71885cb4436040814 @@ -30,7 +30,7 @@ #include "vocab.hh" #include "database.hh" // for parent_map -class app_state; +class workspace; // between any two related revisions, A and B, there is a set of changes (a // cset) that describes the operations required to get from A to B. for example: @@ -81,21 +81,21 @@ class node_restriction : public restrict std::vector const & excludes, long depth, roster_t const & roster, - app_state & a); + workspace & work); node_restriction(std::vector const & includes, std::vector const & excludes, long depth, roster_t const & roster1, roster_t const & roster2, - app_state & a); + workspace & work); node_restriction(std::vector const & includes, std::vector const & excludes, long depth, parent_map const & rosters1, roster_t const & roster2, - app_state & a); + workspace & work); bool includes(roster_t const & roster, node_id nid) const; @@ -122,7 +122,7 @@ class path_restriction : public restrict path_restriction(std::vector const & includes, std::vector const & excludes, long depth, - app_state & a); + workspace & work); bool includes(file_path const & sp) const; ============================================================ --- work.cc bcea6fae446e61352e4a12e0259a9094970a9829 +++ work.cc 62af314cb6091e9fea62941b6c0a528477141320 @@ -485,23 +485,40 @@ workspace::maybe_update_inodeprints() write_inodeprints(dat); } +bool +workspace::ignore_file(file_path const & path) +{ + return lua.hook_ignore_file(path); +} + +void +workspace::init_attributes(file_path const & path, editable_roster_base & er) +{ + map attrs; + lua.hook_init_attributes(path, attrs); + if (attrs.size() > 0) + for (map::const_iterator i = attrs.begin(); + i != attrs.end(); ++i) + er.set_attr(path, attr_key(i->first), attr_value(i->second)); +} + // objects and routines for manipulating the workspace itself namespace { struct file_itemizer : public tree_walker { database & db; - lua_hooks & lua; + workspace & work; set & known; set & unknown; set & ignored; path_restriction const & mask; - file_itemizer(database & db, lua_hooks & lua, + file_itemizer(database & db, workspace & work, set & k, set & u, set & i, path_restriction const & r) - : db(db), lua(lua), known(k), unknown(u), ignored(i), mask(r) {} + : db(db), work(work), known(k), unknown(u), ignored(i), mask(r) {} virtual bool visit_dir(file_path const & path); virtual void visit_file(file_path const & path); }; @@ -519,7 +536,7 @@ file_itemizer::visit_file(file_path cons { if (mask.includes(path) && known.find(path) == known.end()) { - if (lua.hook_ignore_file(path) || db.is_dbfile(path)) + if (work.ignore_file(path) || db.is_dbfile(path)) ignored.insert(path); else unknown.insert(path); @@ -570,15 +587,15 @@ addition_builder : public tree_walker { database & db; - lua_hooks & lua; + workspace & work; roster_t & ros; editable_roster_base & er; bool respect_ignore; public: - addition_builder(database & db, lua_hooks & lua, + addition_builder(database & db, workspace & work, roster_t & r, editable_roster_base & e, bool i = true) - : db(db), lua(lua), ros(r), er(e), respect_ignore(i) + : db(db), work(work), ros(r), er(e), respect_ignore(i) {} virtual bool visit_dir(file_path const & path); virtual void visit_file(file_path const & path); @@ -622,12 +639,7 @@ addition_builder::add_nodes_for(file_pat I(nid != the_null_node); er.attach_node(nid, path); - map attrs; - lua.hook_init_attributes(path, attrs); - if (attrs.size() > 0) - for (map::const_iterator i = attrs.begin(); - i != attrs.end(); ++i) - er.set_attr(path, attr_key(i->first), attr_value(i->second)); + work.init_attributes(path, er); } @@ -641,7 +653,7 @@ addition_builder::visit_file(file_path c void addition_builder::visit_file(file_path const & path) { - if ((respect_ignore && lua.hook_ignore_file(path)) || db.is_dbfile(path)) + if ((respect_ignore && work.ignore_file(path)) || db.is_dbfile(path)) { P(F("skipping ignorable file %s") % path); return; @@ -660,9 +672,9 @@ struct editable_working_tree : public ed struct editable_working_tree : public editable_tree { - editable_working_tree(lua_hooks & lua, content_merge_adaptor const & source, + editable_working_tree(workspace & work, content_merge_adaptor const & source, bool const messages) - : lua(lua), source(source), next_nid(1), root_dir_attached(true), + : work(work), source(source), next_nid(1), root_dir_attached(true), messages(messages) {}; @@ -686,7 +698,7 @@ private: virtual ~editable_working_tree(); private: - lua_hooks & lua; + workspace & work; content_merge_adaptor const & source; node_id next_nid; std::map rename_add_drop_map; @@ -1037,10 +1049,10 @@ add_parent_dirs(file_path const & dst, r static void add_parent_dirs(file_path const & dst, roster_t & ros, node_id_source & nis, - database & db, lua_hooks & lua) + database & db, workspace & work) { editable_roster_base er(ros, nis); - addition_builder build(db, lua, ros, er); + addition_builder build(db, work, ros, er); // FIXME: this is a somewhat odd way to use the builder build.visit_dir(dst.dirname()); @@ -1174,7 +1186,7 @@ workspace::find_unknown_and_ignored(path get_current_roster_shape(new_roster, nis); new_roster.extract_path_set(known); - file_itemizer u(db, lua, known, unknown, ignored, mask); + file_itemizer u(db, *this, known, unknown, ignored, mask); for (vector::const_iterator i = roots.begin(); i != roots.end(); ++i) { @@ -1202,7 +1214,7 @@ workspace::perform_additions(set::const_iterator i = paths.begin(); i != paths.end(); ++i) { @@ -1391,7 +1403,7 @@ workspace::perform_rename(set } renames.insert(make_pair(src, dpath)); - add_parent_dirs(dpath, new_roster, nis, db, lua); + add_parent_dirs(dpath, new_roster, nis, db, *this); } else { @@ -1414,7 +1426,7 @@ workspace::perform_rename(set renames.insert(make_pair(*i, d)); - add_parent_dirs(d, new_roster, nis, db, lua); + add_parent_dirs(d, new_roster, nis, db, *this); } } @@ -1555,7 +1567,7 @@ workspace::perform_content_update(cset c mkdir_p(detached); - editable_working_tree ewt(lua, ca, messages); + editable_working_tree ewt(*this, ca, messages); update.apply_to(ewt); delete_dir_shallow(detached); ============================================================ --- work.hh 8ba21b48a4ac6d7c479b6116f0da96dcbf902f66 +++ work.hh e4907e90a0310dd2c7e790bbac983fd4f7c6b493 @@ -97,6 +97,7 @@ struct workspace bool messages = true); void update_any_attrs(); + void init_attributes(file_path const & path, editable_roster_base & er); bool has_changes(); @@ -195,9 +196,16 @@ struct workspace void enable_inodeprints(); void maybe_update_inodeprints(); - // constructor and locals. by caching pointers to the database and the - // lua hooks, we don't have to know about app_state. - workspace(database & db, lua_hooks & lua) : db(db), lua(lua) {}; + // the 'ignore file', .mtn-ignore in the root of the workspace, contains a + // set of regular expressions that match pathnames. any file or directory + // that exists, is unknown, and matches one of these regexps is treated as + // if it did not exist, instead of being an unknown file. + bool ignore_file(file_path const & path); + + // constructor and locals. + workspace(database & db, lua_hooks & lua) + : db(db), lua(lua) + {} private: database & db; lua_hooks & lua; @@ -212,3 +220,4 @@ private: // vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s: #endif // __WORK_HH__ +