# # # patch "automate.cc" # from [4b00111afabfc8338bcbf975109e1cbf34987246] # to [6e98956fbf8715bf05bfc97a23326f3d52934492] # # patch "cmd_diff_log.cc" # from [94fd0088550fa4c89967c03c33fdefa54bf15a67] # to [c4ecd6ff3761b52af0981acab1c1368531346298] # # patch "cmd_list.cc" # from [2fbe55a8c3d275301cbb1ddd8a73aec113c3ecee] # to [9596077c628cd73872865dba2de04a6208f0d6fd] # # patch "cmd_ws_commit.cc" # from [c1150f715d7c85d84903a45bfc10567c0a970c74] # to [3aaa809d698f2bef6b9275a1121ba9a762082ff5] # # patch "merge.cc" # from [1a06c3dfc96557c0608d1450917ca071dc4795b2] # to [e30832d15f6cbbf7d394af8c836fe96e36ef22c2] # # patch "paths.cc" # from [15e1bedcf560987bca705475f7a000b5ad52e691] # to [3ad115284f29028255846ea214381d342a77632f] # # patch "paths.hh" # from [54380109d0bb1555230575a011b1b9ef4dbc5141] # to [651d16d942ac079114409b40d3e2f21d2529b9ec] # # patch "restrictions.cc" # from [274328f9e9bfc21df9297e11023c3b1cd08ecdf9] # to [bb42700e6be89ba8456eb237e708343f1cd074f1] # # patch "revision.cc" # from [df17f8e950d6c5167382fcdedddb5ce5cab87b5c] # to [f840485a92a3fa9804903ea61eb45ed33344dcd5] # # patch "roster.cc" # from [229568f3e2669041881ff70ed119a89322d75548] # to [787958094de79f2d120a47ada655397a241f3d23] # # patch "roster.hh" # from [c79aa7425a84c5709c83ce730d823772066f12b2] # to [b7db1764e51b0a45e81539e1b7dc761c472b344a] # # patch "roster_merge.cc" # from [b17a6717d58bf2e10022ac4a1a1ec607d6f6fc65] # to [275a8079ced7fd414802f69fb1d1d7f7cfdb23a5] # # patch "work.cc" # from [644d6a7fef1bbd402c5470f032f824940ea4ab2b] # to [8a409fe325bc29ba61477021c35f5d70c0a2eb11] # ============================================================ --- automate.cc 4b00111afabfc8338bcbf975109e1cbf34987246 +++ automate.cc 6e98956fbf8715bf05bfc97a23326f3d52934492 @@ -721,22 +721,19 @@ CMD_AUTOMATE(inventory, "", i != inventory.end(); ++i) { string path_suffix; - split_path sp; - i->first.split(sp); - // ensure that directory nodes always get a trailing slash even // if they're missing from the workspace or have been deleted // but skip the root node which do not get this trailing slash appended - if (curr.has_node(sp)) + if (curr.has_node(i->first)) { - node_t n = curr.get_node(sp); + node_t n = curr.get_node(i->first); if (is_root_dir_t(n)) continue; if (is_dir_t(n)) path_suffix = "/"; } - else if (base.has_node(sp)) + else if (base.has_node(i->first)) { - node_t n = base.get_node(sp); + node_t n = base.get_node(i->first); if (is_root_dir_t(n)) continue; if (is_dir_t(n)) path_suffix = "/"; } @@ -1513,8 +1510,7 @@ CMD_AUTOMATE(get_content_changed, N_("RE F("no revision %s found in database") % ident); app.db.get_roster(ident, new_roster, mm); - split_path path; - file_path_external(idx(args,1)).split(path); + file_path path = file_path_external(idx(args,1)); N(new_roster.has_node(path), F("file %s is unknown for revision %s") % path % ident); @@ -1580,8 +1576,7 @@ CMD_AUTOMATE(get_corresponding_path, N_( F("no revision %s found in database") % old_ident); app.db.get_roster(old_ident, old_roster); - split_path path; - file_path_external(idx(args,1)).split(path); + file_path path = file_path_external(idx(args,1)); N(new_roster.has_node(path), F("file %s is unknown for revision %s") % path % ident); @@ -1589,11 +1584,10 @@ CMD_AUTOMATE(get_corresponding_path, N_( basic_io::printer prt; if (old_roster.has_node(node->self)) { - split_path old_path; + file_path old_path; basic_io::stanza st; old_roster.get_name(node->self, old_path); - file_path fp = file_path(old_path); - st.push_file_pair(basic_io::syms::file, fp); + st.push_file_pair(basic_io::syms::file, old_path); prt.print_stanza(st); } output.write(prt.buf.data(), prt.buf.size()); ============================================================ --- cmd_diff_log.cc 94fd0088550fa4c89967c03c33fdefa54bf15a67 +++ cmd_diff_log.cc c4ecd6ff3761b52af0981acab1c1368531346298 @@ -820,9 +820,9 @@ CMD(log, "log", "", CMD_REF(informative) print_this = true; if (app.opts.diffs) { - split_path sp; - roster.get_name(*n, sp); - diff_paths.insert(file_path(sp)); + file_path fp; + roster.get_name(*n, fp); + diff_paths.insert(fp); } } } ============================================================ --- cmd_list.cc 2fbe55a8c3d275301cbb1ddd8a73aec113c3ecee +++ cmd_list.cc 9596077c628cd73872865dba2de04a6208f0d6fd @@ -380,9 +380,9 @@ CMD(known, "known", "", CMD_REF(list), " if (!new_roster.is_root(nid) && mask.includes(new_roster, nid)) { - split_path sp; - new_roster.get_name(nid, sp); - print_paths.push_back(file_path(sp)); + file_path p; + new_roster.get_name(nid, p); + print_paths.push_back(p); } } @@ -481,12 +481,12 @@ CMD(changed, "changed", "", CMD_REF(list for (set::const_iterator i = nodes.begin(); i != nodes.end(); ++i) { - split_path sp; + file_path p; if (new_roster.has_node(*i)) - new_roster.get_name(*i, sp); + new_roster.get_name(*i, p); else - old_roster.get_name(*i, sp); - print_paths.insert(file_path(sp)); + old_roster.get_name(*i, p); + print_paths.insert(file_path(p)); } } ============================================================ --- cmd_ws_commit.cc c1150f715d7c85d84903a45bfc10567c0a970c74 +++ cmd_ws_commit.cc 3aaa809d698f2bef6b9275a1121ba9a762082ff5 @@ -218,13 +218,12 @@ CMD(revert, "revert", "", CMD_REF(worksp if (old_roster.is_root(nid)) continue; - split_path sp; - old_roster.get_name(nid, sp); - file_path fp(sp); - if (!mask.includes(old_roster, nid)) continue; + file_path fp; + old_roster.get_name(nid, fp); + if (is_file_t(node)) { file_t f = downcast_to_file_t(node); @@ -632,11 +631,9 @@ CMD(attr_drop, "drop", "", CMD_REF(attr) app.work.get_current_roster_shape(new_roster, nis); file_path path = file_path_external(idx(args, 0)); - split_path sp; - path.split(sp); - N(new_roster.has_node(sp), F("Unknown path '%s'") % path); - node_t node = new_roster.get_node(sp); + N(new_roster.has_node(path), F("Unknown path '%s'") % path); + node_t node = new_roster.get_node(path); // Clear all attrs (or a specific attr). if (args.size() == 1) @@ -681,11 +678,9 @@ CMD(attr_get, "get", "", CMD_REF(attr), app.work.get_current_roster_shape(new_roster, nis); file_path path = file_path_external(idx(args, 0)); - split_path sp; - path.split(sp); - N(new_roster.has_node(sp), F("Unknown path '%s'") % path); - node_t node = new_roster.get_node(sp); + N(new_roster.has_node(path), F("Unknown path '%s'") % path); + node_t node = new_roster.get_node(path); if (args.size() == 1) { @@ -733,11 +728,9 @@ CMD(attr_set, "set", "", CMD_REF(attr), app.work.get_current_roster_shape(new_roster, nis); file_path path = file_path_external(idx(args, 0)); - split_path sp; - path.split(sp); - N(new_roster.has_node(sp), F("Unknown path '%s'") % path); - node_t node = new_roster.get_node(sp); + N(new_roster.has_node(path), F("Unknown path '%s'") % path); + node_t node = new_roster.get_node(path); attr_key a_key = attr_key(idx(args, 1)()); attr_value a_value = attr_value(idx(args, 2)()); @@ -784,8 +777,7 @@ CMD_AUTOMATE(get_attributes, N_("PATH"), app.require_workspace(); // retrieve the path - split_path path; - file_path_external(idx(args,0)).split(path); + file_path path = file_path_external(idx(args,0)); roster_t base, current; parent_map parents; @@ -906,11 +898,9 @@ CMD_AUTOMATE(set_attribute, N_("PATH KEY app.work.get_current_roster_shape(new_roster, nis); file_path path = file_path_external(idx(args,0)); - split_path sp; - path.split(sp); - N(new_roster.has_node(sp), F("Unknown path '%s'") % path); - node_t node = new_roster.get_node(sp); + N(new_roster.has_node(path), F("Unknown path '%s'") % path); + node_t node = new_roster.get_node(path); attr_key a_key = attr_key(idx(args,1)()); attr_value a_value = attr_value(idx(args,2)()); @@ -952,11 +942,9 @@ CMD_AUTOMATE(drop_attribute, N_("PATH [K app.work.get_current_roster_shape(new_roster, nis); file_path path = file_path_external(idx(args,0)); - split_path sp; - path.split(sp); - N(new_roster.has_node(sp), F("Unknown path '%s'") % path); - node_t node = new_roster.get_node(sp); + N(new_roster.has_node(path), F("Unknown path '%s'") % path); + node_t node = new_roster.get_node(path); // Clear all attrs (or a specific attr). if (args.size() == 1) ============================================================ --- merge.cc 1a06c3dfc96557c0608d1450917ca071dc4795b2 +++ merge.cc e30832d15f6cbbf7d394af8c836fe96e36ef22c2 @@ -34,9 +34,7 @@ get_file_details(roster_t const & ros, n I(ros.has_node(nid)); file_t f = downcast_to_file_t(ros.get_node(nid)); fid = f->content; - split_path sp; - ros.get_name(nid, sp); - pth = file_path(sp); + ros.get_name(nid, pth); } void ============================================================ --- paths.cc 15e1bedcf560987bca705475f7a000b5ad52e691 +++ paths.cc 3ad115284f29028255846ea214381d342a77632f @@ -240,19 +240,6 @@ is_valid_internal(string const & path) && !in_bookkeeping_dir(path)); } -// equivalent to file_path_internal(path).split(sp), but -// avoids splitting the string twice -void -internal_string_to_split_path(string const & path, split_path & sp) -{ - I(utf8_validate(utf8(path))); - I(!in_bookkeeping_dir(path)); - sp.clear(); - sp.reserve(8); - sp.push_back(the_null_component); - I(fully_normalized_path_split(path, true, sp)); -} - // path::normalize() is deprecated in Boost 1.34, and also // doesn't remove leading or trailing dots any more. static fs::path ============================================================ --- paths.hh 54380109d0bb1555230575a011b1b9ef4dbc5141 +++ paths.hh 651d16d942ac079114409b40d3e2f21d2529b9ec @@ -296,10 +296,6 @@ void mark_std_paths_used(void); void mark_std_paths_used(void); -// equivalent to file_path_internal(path).split(sp) but more efficient. -void -internal_string_to_split_path(std::string const & path, split_path & sp); - // Local Variables: // mode: C++ // fill-column: 76 ============================================================ --- restrictions.cc 274328f9e9bfc21df9297e11023c3b1cd08ecdf9 +++ restrictions.cc bb42700e6be89ba8456eb237e708343f1cd074f1 @@ -39,14 +39,13 @@ map_nodes(map::const_iterator i = paths.begin(); i != paths.end(); ++i) { - split_path s; - i->split(s); - if (roster.has_node(s)) + if (roster.has_node(*i)) { known_paths.insert(*i); - node_id nid = roster.get_node(s)->self; + node_id nid = roster.get_node(*i)->self; - map::iterator n = node_map.find(nid); + map::iterator n + = node_map.find(nid); if (n != node_map.end()) N(n->second == status, F("conflicting include/exclude on path '%s'") % *i); @@ -237,8 +236,10 @@ node_restriction::includes(roster_t cons MM(roster); I(roster.has_node(nid)); + file_path fp; split_path sp; - roster.get_name(nid, sp); + roster.get_name(nid, fp); + fp.split(sp); if (empty()) { @@ -247,12 +248,12 @@ node_restriction::includes(roster_t cons int path_depth = sp.size() - 1; // -1 to not count root path_component if (path_depth <= depth + 1) { - L(FL("depth includes nid %d path '%s'") % nid % file_path(sp)); + L(FL("depth includes nid %d path '%s'") % nid % fp); return true; } else { - L(FL("depth excludes nid %d path '%s'") % nid % file_path(sp)); + L(FL("depth excludes nid %d path '%s'") % nid % fp); return false; } } @@ -284,12 +285,12 @@ node_restriction::includes(roster_t cons { case restricted_path::included: L(FL("explicit include of nid %d path '%s'") - % current % file_path(sp)); + % current % fp); return true; case restricted_path::excluded: L(FL("explicit exclude of nid %d path '%s'") - % current % file_path(sp)); + % current % fp); return false; } } @@ -302,7 +303,7 @@ node_restriction::includes(roster_t cons if (included_paths.empty()) { L(FL("default include of nid %d path '%s'") - % nid % file_path(sp)); + % nid % fp); return true; } else @@ -311,7 +312,7 @@ node_restriction::includes(roster_t cons { // printing this slows down "log ". L(FL("(debug) default exclude of nid %d path '%s'") - % nid % file_path(sp)); + % nid % fp); } return false; } @@ -403,29 +404,29 @@ using std::string; // x's and y's are directories // and this is rather painful -split_path sp_root; -split_path sp_f; -split_path sp_g; +file_path fp_root = file_path_internal(""); +file_path fp_f = file_path_internal("f"); +file_path fp_g = file_path_internal("g"); -split_path sp_x; -split_path sp_xf; -split_path sp_xg; -split_path sp_xx; -split_path sp_xxf; -split_path sp_xxg; -split_path sp_xy; -split_path sp_xyf; -split_path sp_xyg; +file_path fp_x = file_path_internal("x"); +file_path fp_xf = file_path_internal("x/f"); +file_path fp_xg = file_path_internal("x/g"); +file_path fp_xx = file_path_internal("x/x"); +file_path fp_xxf = file_path_internal("x/x/f"); +file_path fp_xxg = file_path_internal("x/x/g"); +file_path fp_xy = file_path_internal("x/y"); +file_path fp_xyf = file_path_internal("x/y/f"); +file_path fp_xyg = file_path_internal("x/y/g"); -split_path sp_y; -split_path sp_yf; -split_path sp_yg; -split_path sp_yx; -split_path sp_yxf; -split_path sp_yxg; -split_path sp_yy; -split_path sp_yyf; -split_path sp_yyg; +file_path fp_y = file_path_internal("y"); +file_path fp_yf = file_path_internal("y/f"); +file_path fp_yg = file_path_internal("y/g"); +file_path fp_yx = file_path_internal("y/x"); +file_path fp_yxf = file_path_internal("y/x/f"); +file_path fp_yxg = file_path_internal("y/x/g"); +file_path fp_yy = file_path_internal("y/y"); +file_path fp_yyf = file_path_internal("y/y/f"); +file_path fp_yyg = file_path_internal("y/y/g"); node_id nid_root; node_id nid_f; @@ -472,30 +473,6 @@ static void setup(roster_t & roster) { temp_node_id_source nis; - file_path_internal("").split(sp_root); - file_path_internal("f").split(sp_f); - file_path_internal("g").split(sp_g); - - file_path_internal("x").split(sp_x); - file_path_internal("x/f").split(sp_xf); - file_path_internal("x/g").split(sp_xg); - file_path_internal("x/x").split(sp_xx); - file_path_internal("x/x/f").split(sp_xxf); - file_path_internal("x/x/g").split(sp_xxg); - file_path_internal("x/y").split(sp_xy); - file_path_internal("x/y/f").split(sp_xyf); - file_path_internal("x/y/g").split(sp_xyg); - - file_path_internal("y").split(sp_y); - file_path_internal("y/f").split(sp_yf); - file_path_internal("y/g").split(sp_yg); - file_path_internal("y/x").split(sp_yx); - file_path_internal("y/x/f").split(sp_yxf); - file_path_internal("y/x/g").split(sp_yxg); - file_path_internal("y/y").split(sp_yy); - file_path_internal("y/y/f").split(sp_yyf); - file_path_internal("y/y/g").split(sp_yyg); - // these directories must exist for the path_restrictions to be valid. it // is a bit lame to be creating directories arbitrarily like this. perhaps // unit_tests should run in a unit_tests.dir or something. @@ -529,29 +506,29 @@ static void setup(roster_t & roster) nid_yyf = roster.create_file_node(fid_yxf, nis); nid_yyg = roster.create_file_node(fid_yxg, nis); - roster.attach_node(nid_root, sp_root); - roster.attach_node(nid_f, sp_f); - roster.attach_node(nid_g, sp_g); + roster.attach_node(nid_root, fp_root); + roster.attach_node(nid_f, fp_f); + roster.attach_node(nid_g, fp_g); - roster.attach_node(nid_x, sp_x); - roster.attach_node(nid_xf, sp_xf); - roster.attach_node(nid_xg, sp_xg); - roster.attach_node(nid_xx, sp_xx); - roster.attach_node(nid_xxf, sp_xxf); - roster.attach_node(nid_xxg, sp_xxg); - roster.attach_node(nid_xy, sp_xy); - roster.attach_node(nid_xyf, sp_xyf); - roster.attach_node(nid_xyg, sp_xyg); + roster.attach_node(nid_x, fp_x); + roster.attach_node(nid_xf, fp_xf); + roster.attach_node(nid_xg, fp_xg); + roster.attach_node(nid_xx, fp_xx); + roster.attach_node(nid_xxf, fp_xxf); + roster.attach_node(nid_xxg, fp_xxg); + roster.attach_node(nid_xy, fp_xy); + roster.attach_node(nid_xyf, fp_xyf); + roster.attach_node(nid_xyg, fp_xyg); - roster.attach_node(nid_y, sp_y); - roster.attach_node(nid_yf, sp_yf); - roster.attach_node(nid_yg, sp_yg); - roster.attach_node(nid_yx, sp_yx); - roster.attach_node(nid_yxf, sp_yxf); - roster.attach_node(nid_yxg, sp_yxg); - roster.attach_node(nid_yy, sp_yy); - roster.attach_node(nid_yyf, sp_yyf); - roster.attach_node(nid_yyg, sp_yyg); + roster.attach_node(nid_y, fp_y); + roster.attach_node(nid_yf, fp_yf); + roster.attach_node(nid_yg, fp_yg); + roster.attach_node(nid_yx, fp_yx); + roster.attach_node(nid_yxf, fp_yxf); + roster.attach_node(nid_yxg, fp_yxg); + roster.attach_node(nid_yy, fp_yy); + roster.attach_node(nid_yyf, fp_yyf); + roster.attach_node(nid_yyg, fp_yyg); } @@ -596,29 +573,29 @@ UNIT_TEST(restrictions, empty_restrictio UNIT_TEST_CHECK(pmask.empty()); - UNIT_TEST_CHECK(pmask.includes(sp_root)); - UNIT_TEST_CHECK(pmask.includes(sp_f)); - UNIT_TEST_CHECK(pmask.includes(sp_g)); + UNIT_TEST_CHECK(pmask.includes(fp_root)); + UNIT_TEST_CHECK(pmask.includes(fp_f)); + UNIT_TEST_CHECK(pmask.includes(fp_g)); - UNIT_TEST_CHECK(pmask.includes(sp_x)); - UNIT_TEST_CHECK(pmask.includes(sp_xf)); - UNIT_TEST_CHECK(pmask.includes(sp_xg)); - UNIT_TEST_CHECK(pmask.includes(sp_xx)); - UNIT_TEST_CHECK(pmask.includes(sp_xxf)); - UNIT_TEST_CHECK(pmask.includes(sp_xxg)); - UNIT_TEST_CHECK(pmask.includes(sp_xy)); - UNIT_TEST_CHECK(pmask.includes(sp_xyf)); - UNIT_TEST_CHECK(pmask.includes(sp_xyg)); + UNIT_TEST_CHECK(pmask.includes(fp_x)); + UNIT_TEST_CHECK(pmask.includes(fp_xf)); + UNIT_TEST_CHECK(pmask.includes(fp_xg)); + UNIT_TEST_CHECK(pmask.includes(fp_xx)); + UNIT_TEST_CHECK(pmask.includes(fp_xxf)); + UNIT_TEST_CHECK(pmask.includes(fp_xxg)); + UNIT_TEST_CHECK(pmask.includes(fp_xy)); + UNIT_TEST_CHECK(pmask.includes(fp_xyf)); + UNIT_TEST_CHECK(pmask.includes(fp_xyg)); - UNIT_TEST_CHECK(pmask.includes(sp_y)); - UNIT_TEST_CHECK(pmask.includes(sp_yf)); - UNIT_TEST_CHECK(pmask.includes(sp_yg)); - UNIT_TEST_CHECK(pmask.includes(sp_yx)); - UNIT_TEST_CHECK(pmask.includes(sp_yxf)); - UNIT_TEST_CHECK(pmask.includes(sp_yxg)); - UNIT_TEST_CHECK(pmask.includes(sp_yy)); - UNIT_TEST_CHECK(pmask.includes(sp_yyf)); - UNIT_TEST_CHECK(pmask.includes(sp_yyg)); + UNIT_TEST_CHECK(pmask.includes(fp_y)); + UNIT_TEST_CHECK(pmask.includes(fp_yf)); + UNIT_TEST_CHECK(pmask.includes(fp_yg)); + UNIT_TEST_CHECK(pmask.includes(fp_yx)); + UNIT_TEST_CHECK(pmask.includes(fp_yxf)); + UNIT_TEST_CHECK(pmask.includes(fp_yxg)); + UNIT_TEST_CHECK(pmask.includes(fp_yy)); + UNIT_TEST_CHECK(pmask.includes(fp_yyf)); + UNIT_TEST_CHECK(pmask.includes(fp_yyg)); } UNIT_TEST(restrictions, simple_include) @@ -668,29 +645,29 @@ UNIT_TEST(restrictions, simple_include) UNIT_TEST_CHECK(!pmask.empty()); - UNIT_TEST_CHECK(!pmask.includes(sp_root)); - UNIT_TEST_CHECK(!pmask.includes(sp_f)); - UNIT_TEST_CHECK(!pmask.includes(sp_g)); + UNIT_TEST_CHECK(!pmask.includes(fp_root)); + UNIT_TEST_CHECK(!pmask.includes(fp_f)); + UNIT_TEST_CHECK(!pmask.includes(fp_g)); - UNIT_TEST_CHECK(!pmask.includes(sp_x)); - UNIT_TEST_CHECK(!pmask.includes(sp_xf)); - UNIT_TEST_CHECK(!pmask.includes(sp_xg)); - UNIT_TEST_CHECK( pmask.includes(sp_xx)); - UNIT_TEST_CHECK( pmask.includes(sp_xxf)); - UNIT_TEST_CHECK( pmask.includes(sp_xxg)); - UNIT_TEST_CHECK(!pmask.includes(sp_xy)); - UNIT_TEST_CHECK(!pmask.includes(sp_xyf)); - UNIT_TEST_CHECK(!pmask.includes(sp_xyg)); + UNIT_TEST_CHECK(!pmask.includes(fp_x)); + UNIT_TEST_CHECK(!pmask.includes(fp_xf)); + UNIT_TEST_CHECK(!pmask.includes(fp_xg)); + UNIT_TEST_CHECK( pmask.includes(fp_xx)); + UNIT_TEST_CHECK( pmask.includes(fp_xxf)); + UNIT_TEST_CHECK( pmask.includes(fp_xxg)); + UNIT_TEST_CHECK(!pmask.includes(fp_xy)); + UNIT_TEST_CHECK(!pmask.includes(fp_xyf)); + UNIT_TEST_CHECK(!pmask.includes(fp_xyg)); - UNIT_TEST_CHECK(!pmask.includes(sp_y)); - UNIT_TEST_CHECK(!pmask.includes(sp_yf)); - UNIT_TEST_CHECK(!pmask.includes(sp_yg)); - UNIT_TEST_CHECK(!pmask.includes(sp_yx)); - UNIT_TEST_CHECK(!pmask.includes(sp_yxf)); - UNIT_TEST_CHECK(!pmask.includes(sp_yxg)); - UNIT_TEST_CHECK( pmask.includes(sp_yy)); - UNIT_TEST_CHECK( pmask.includes(sp_yyf)); - UNIT_TEST_CHECK( pmask.includes(sp_yyg)); + UNIT_TEST_CHECK(!pmask.includes(fp_y)); + UNIT_TEST_CHECK(!pmask.includes(fp_yf)); + UNIT_TEST_CHECK(!pmask.includes(fp_yg)); + UNIT_TEST_CHECK(!pmask.includes(fp_yx)); + UNIT_TEST_CHECK(!pmask.includes(fp_yxf)); + UNIT_TEST_CHECK(!pmask.includes(fp_yxg)); + UNIT_TEST_CHECK( pmask.includes(fp_yy)); + UNIT_TEST_CHECK( pmask.includes(fp_yyf)); + UNIT_TEST_CHECK( pmask.includes(fp_yyg)); } UNIT_TEST(restrictions, simple_exclude) @@ -740,29 +717,29 @@ UNIT_TEST(restrictions, simple_exclude) UNIT_TEST_CHECK(!pmask.empty()); - UNIT_TEST_CHECK( pmask.includes(sp_root)); - UNIT_TEST_CHECK( pmask.includes(sp_f)); - UNIT_TEST_CHECK( pmask.includes(sp_g)); + UNIT_TEST_CHECK( pmask.includes(fp_root)); + UNIT_TEST_CHECK( pmask.includes(fp_f)); + UNIT_TEST_CHECK( pmask.includes(fp_g)); - UNIT_TEST_CHECK( pmask.includes(sp_x)); - UNIT_TEST_CHECK( pmask.includes(sp_xf)); - UNIT_TEST_CHECK( pmask.includes(sp_xg)); - UNIT_TEST_CHECK(!pmask.includes(sp_xx)); - UNIT_TEST_CHECK(!pmask.includes(sp_xxf)); - UNIT_TEST_CHECK(!pmask.includes(sp_xxg)); - UNIT_TEST_CHECK( pmask.includes(sp_xy)); - UNIT_TEST_CHECK( pmask.includes(sp_xyf)); - UNIT_TEST_CHECK( pmask.includes(sp_xyg)); + UNIT_TEST_CHECK( pmask.includes(fp_x)); + UNIT_TEST_CHECK( pmask.includes(fp_xf)); + UNIT_TEST_CHECK( pmask.includes(fp_xg)); + UNIT_TEST_CHECK(!pmask.includes(fp_xx)); + UNIT_TEST_CHECK(!pmask.includes(fp_xxf)); + UNIT_TEST_CHECK(!pmask.includes(fp_xxg)); + UNIT_TEST_CHECK( pmask.includes(fp_xy)); + UNIT_TEST_CHECK( pmask.includes(fp_xyf)); + UNIT_TEST_CHECK( pmask.includes(fp_xyg)); - UNIT_TEST_CHECK( pmask.includes(sp_y)); - UNIT_TEST_CHECK( pmask.includes(sp_yf)); - UNIT_TEST_CHECK( pmask.includes(sp_yg)); - UNIT_TEST_CHECK( pmask.includes(sp_yx)); - UNIT_TEST_CHECK( pmask.includes(sp_yxf)); - UNIT_TEST_CHECK( pmask.includes(sp_yxg)); - UNIT_TEST_CHECK(!pmask.includes(sp_yy)); - UNIT_TEST_CHECK(!pmask.includes(sp_yyf)); - UNIT_TEST_CHECK(!pmask.includes(sp_yyg)); + UNIT_TEST_CHECK( pmask.includes(fp_y)); + UNIT_TEST_CHECK( pmask.includes(fp_yf)); + UNIT_TEST_CHECK( pmask.includes(fp_yg)); + UNIT_TEST_CHECK( pmask.includes(fp_yx)); + UNIT_TEST_CHECK( pmask.includes(fp_yxf)); + UNIT_TEST_CHECK( pmask.includes(fp_yxg)); + UNIT_TEST_CHECK(!pmask.includes(fp_yy)); + UNIT_TEST_CHECK(!pmask.includes(fp_yyf)); + UNIT_TEST_CHECK(!pmask.includes(fp_yyg)); } UNIT_TEST(restrictions, include_exclude) @@ -814,29 +791,29 @@ UNIT_TEST(restrictions, include_exclude) UNIT_TEST_CHECK(!pmask.empty()); - UNIT_TEST_CHECK(!pmask.includes(sp_root)); - UNIT_TEST_CHECK(!pmask.includes(sp_f)); - UNIT_TEST_CHECK(!pmask.includes(sp_g)); + UNIT_TEST_CHECK(!pmask.includes(fp_root)); + UNIT_TEST_CHECK(!pmask.includes(fp_f)); + UNIT_TEST_CHECK(!pmask.includes(fp_g)); - UNIT_TEST_CHECK( pmask.includes(sp_x)); - UNIT_TEST_CHECK( pmask.includes(sp_xf)); - UNIT_TEST_CHECK( pmask.includes(sp_xg)); - UNIT_TEST_CHECK(!pmask.includes(sp_xx)); - UNIT_TEST_CHECK(!pmask.includes(sp_xxf)); - UNIT_TEST_CHECK(!pmask.includes(sp_xxg)); - UNIT_TEST_CHECK( pmask.includes(sp_xy)); - UNIT_TEST_CHECK( pmask.includes(sp_xyf)); - UNIT_TEST_CHECK( pmask.includes(sp_xyg)); + UNIT_TEST_CHECK( pmask.includes(fp_x)); + UNIT_TEST_CHECK( pmask.includes(fp_xf)); + UNIT_TEST_CHECK( pmask.includes(fp_xg)); + UNIT_TEST_CHECK(!pmask.includes(fp_xx)); + UNIT_TEST_CHECK(!pmask.includes(fp_xxf)); + UNIT_TEST_CHECK(!pmask.includes(fp_xxg)); + UNIT_TEST_CHECK( pmask.includes(fp_xy)); + UNIT_TEST_CHECK( pmask.includes(fp_xyf)); + UNIT_TEST_CHECK( pmask.includes(fp_xyg)); - UNIT_TEST_CHECK( pmask.includes(sp_y)); - UNIT_TEST_CHECK( pmask.includes(sp_yf)); - UNIT_TEST_CHECK( pmask.includes(sp_yg)); - UNIT_TEST_CHECK( pmask.includes(sp_yx)); - UNIT_TEST_CHECK( pmask.includes(sp_yxf)); - UNIT_TEST_CHECK( pmask.includes(sp_yxg)); - UNIT_TEST_CHECK(!pmask.includes(sp_yy)); - UNIT_TEST_CHECK(!pmask.includes(sp_yyf)); - UNIT_TEST_CHECK(!pmask.includes(sp_yyg)); + UNIT_TEST_CHECK( pmask.includes(fp_y)); + UNIT_TEST_CHECK( pmask.includes(fp_yf)); + UNIT_TEST_CHECK( pmask.includes(fp_yg)); + UNIT_TEST_CHECK( pmask.includes(fp_yx)); + UNIT_TEST_CHECK( pmask.includes(fp_yxf)); + UNIT_TEST_CHECK( pmask.includes(fp_yxg)); + UNIT_TEST_CHECK(!pmask.includes(fp_yy)); + UNIT_TEST_CHECK(!pmask.includes(fp_yyf)); + UNIT_TEST_CHECK(!pmask.includes(fp_yyg)); } UNIT_TEST(restrictions, exclude_include) @@ -891,29 +868,29 @@ UNIT_TEST(restrictions, exclude_include) UNIT_TEST_CHECK(!pmask.empty()); - UNIT_TEST_CHECK(!pmask.includes(sp_root)); - UNIT_TEST_CHECK(!pmask.includes(sp_f)); - UNIT_TEST_CHECK(!pmask.includes(sp_g)); + UNIT_TEST_CHECK(!pmask.includes(fp_root)); + UNIT_TEST_CHECK(!pmask.includes(fp_f)); + UNIT_TEST_CHECK(!pmask.includes(fp_g)); - UNIT_TEST_CHECK(!pmask.includes(sp_x)); - UNIT_TEST_CHECK(!pmask.includes(sp_xf)); - UNIT_TEST_CHECK(!pmask.includes(sp_xg)); - UNIT_TEST_CHECK( pmask.includes(sp_xx)); - UNIT_TEST_CHECK( pmask.includes(sp_xxf)); - UNIT_TEST_CHECK( pmask.includes(sp_xxg)); - UNIT_TEST_CHECK(!pmask.includes(sp_xy)); - UNIT_TEST_CHECK(!pmask.includes(sp_xyf)); - UNIT_TEST_CHECK(!pmask.includes(sp_xyg)); + UNIT_TEST_CHECK(!pmask.includes(fp_x)); + UNIT_TEST_CHECK(!pmask.includes(fp_xf)); + UNIT_TEST_CHECK(!pmask.includes(fp_xg)); + UNIT_TEST_CHECK( pmask.includes(fp_xx)); + UNIT_TEST_CHECK( pmask.includes(fp_xxf)); + UNIT_TEST_CHECK( pmask.includes(fp_xxg)); + UNIT_TEST_CHECK(!pmask.includes(fp_xy)); + UNIT_TEST_CHECK(!pmask.includes(fp_xyf)); + UNIT_TEST_CHECK(!pmask.includes(fp_xyg)); - UNIT_TEST_CHECK(!pmask.includes(sp_y)); - UNIT_TEST_CHECK(!pmask.includes(sp_yf)); - UNIT_TEST_CHECK(!pmask.includes(sp_yg)); - UNIT_TEST_CHECK(!pmask.includes(sp_yx)); - UNIT_TEST_CHECK(!pmask.includes(sp_yxf)); - UNIT_TEST_CHECK(!pmask.includes(sp_yxg)); - UNIT_TEST_CHECK( pmask.includes(sp_yy)); - UNIT_TEST_CHECK( pmask.includes(sp_yyf)); - UNIT_TEST_CHECK( pmask.includes(sp_yyg)); + UNIT_TEST_CHECK(!pmask.includes(fp_y)); + UNIT_TEST_CHECK(!pmask.includes(fp_yf)); + UNIT_TEST_CHECK(!pmask.includes(fp_yg)); + UNIT_TEST_CHECK(!pmask.includes(fp_yx)); + UNIT_TEST_CHECK(!pmask.includes(fp_yxf)); + UNIT_TEST_CHECK(!pmask.includes(fp_yxg)); + UNIT_TEST_CHECK( pmask.includes(fp_yy)); + UNIT_TEST_CHECK( pmask.includes(fp_yyf)); + UNIT_TEST_CHECK( pmask.includes(fp_yyg)); } UNIT_TEST(restrictions, invalid_roster_paths) @@ -995,29 +972,29 @@ UNIT_TEST(restrictions, include_depth_0) UNIT_TEST_CHECK(!pmask.empty()); - UNIT_TEST_CHECK(!pmask.includes(sp_root)); - UNIT_TEST_CHECK(!pmask.includes(sp_f)); - UNIT_TEST_CHECK(!pmask.includes(sp_g)); + UNIT_TEST_CHECK(!pmask.includes(fp_root)); + UNIT_TEST_CHECK(!pmask.includes(fp_f)); + UNIT_TEST_CHECK(!pmask.includes(fp_g)); - UNIT_TEST_CHECK( pmask.includes(sp_x)); - UNIT_TEST_CHECK( pmask.includes(sp_xf)); - UNIT_TEST_CHECK( pmask.includes(sp_xg)); - UNIT_TEST_CHECK( pmask.includes(sp_xx)); - UNIT_TEST_CHECK(!pmask.includes(sp_xxf)); - UNIT_TEST_CHECK(!pmask.includes(sp_xxg)); - UNIT_TEST_CHECK( pmask.includes(sp_xy)); - UNIT_TEST_CHECK(!pmask.includes(sp_xyf)); - UNIT_TEST_CHECK(!pmask.includes(sp_xyg)); + UNIT_TEST_CHECK( pmask.includes(fp_x)); + UNIT_TEST_CHECK( pmask.includes(fp_xf)); + UNIT_TEST_CHECK( pmask.includes(fp_xg)); + UNIT_TEST_CHECK( pmask.includes(fp_xx)); + UNIT_TEST_CHECK(!pmask.includes(fp_xxf)); + UNIT_TEST_CHECK(!pmask.includes(fp_xxg)); + UNIT_TEST_CHECK( pmask.includes(fp_xy)); + UNIT_TEST_CHECK(!pmask.includes(fp_xyf)); + UNIT_TEST_CHECK(!pmask.includes(fp_xyg)); - UNIT_TEST_CHECK( pmask.includes(sp_y)); - UNIT_TEST_CHECK( pmask.includes(sp_yf)); - UNIT_TEST_CHECK( pmask.includes(sp_yg)); - UNIT_TEST_CHECK( pmask.includes(sp_yx)); - UNIT_TEST_CHECK(!pmask.includes(sp_yxf)); - UNIT_TEST_CHECK(!pmask.includes(sp_yxg)); - UNIT_TEST_CHECK( pmask.includes(sp_yy)); - UNIT_TEST_CHECK(!pmask.includes(sp_yyf)); - UNIT_TEST_CHECK(!pmask.includes(sp_yyg)); + UNIT_TEST_CHECK( pmask.includes(fp_y)); + UNIT_TEST_CHECK( pmask.includes(fp_yf)); + UNIT_TEST_CHECK( pmask.includes(fp_yg)); + UNIT_TEST_CHECK( pmask.includes(fp_yx)); + UNIT_TEST_CHECK(!pmask.includes(fp_yxf)); + UNIT_TEST_CHECK(!pmask.includes(fp_yxg)); + UNIT_TEST_CHECK( pmask.includes(fp_yy)); + UNIT_TEST_CHECK(!pmask.includes(fp_yyf)); + UNIT_TEST_CHECK(!pmask.includes(fp_yyg)); } UNIT_TEST(restrictions, include_depth_0_empty_restriction) @@ -1069,29 +1046,29 @@ UNIT_TEST(restrictions, include_depth_0_ UNIT_TEST_CHECK( pmask.empty()); - UNIT_TEST_CHECK( pmask.includes(sp_root)); - UNIT_TEST_CHECK( pmask.includes(sp_f)); - UNIT_TEST_CHECK( pmask.includes(sp_g)); + UNIT_TEST_CHECK( pmask.includes(fp_root)); + UNIT_TEST_CHECK( pmask.includes(fp_f)); + UNIT_TEST_CHECK( pmask.includes(fp_g)); - UNIT_TEST_CHECK( pmask.includes(sp_x)); - UNIT_TEST_CHECK(!pmask.includes(sp_xf)); - UNIT_TEST_CHECK(!pmask.includes(sp_xg)); - UNIT_TEST_CHECK(!pmask.includes(sp_xx)); - UNIT_TEST_CHECK(!pmask.includes(sp_xxf)); - UNIT_TEST_CHECK(!pmask.includes(sp_xxg)); - UNIT_TEST_CHECK(!pmask.includes(sp_xy)); - UNIT_TEST_CHECK(!pmask.includes(sp_xyf)); - UNIT_TEST_CHECK(!pmask.includes(sp_xyg)); + UNIT_TEST_CHECK( pmask.includes(fp_x)); + UNIT_TEST_CHECK(!pmask.includes(fp_xf)); + UNIT_TEST_CHECK(!pmask.includes(fp_xg)); + UNIT_TEST_CHECK(!pmask.includes(fp_xx)); + UNIT_TEST_CHECK(!pmask.includes(fp_xxf)); + UNIT_TEST_CHECK(!pmask.includes(fp_xxg)); + UNIT_TEST_CHECK(!pmask.includes(fp_xy)); + UNIT_TEST_CHECK(!pmask.includes(fp_xyf)); + UNIT_TEST_CHECK(!pmask.includes(fp_xyg)); - UNIT_TEST_CHECK( pmask.includes(sp_y)); - UNIT_TEST_CHECK(!pmask.includes(sp_yf)); - UNIT_TEST_CHECK(!pmask.includes(sp_yg)); - UNIT_TEST_CHECK(!pmask.includes(sp_yx)); - UNIT_TEST_CHECK(!pmask.includes(sp_yxf)); - UNIT_TEST_CHECK(!pmask.includes(sp_yxg)); - UNIT_TEST_CHECK(!pmask.includes(sp_yy)); - UNIT_TEST_CHECK(!pmask.includes(sp_yyf)); - UNIT_TEST_CHECK(!pmask.includes(sp_yyg)); + UNIT_TEST_CHECK( pmask.includes(fp_y)); + UNIT_TEST_CHECK(!pmask.includes(fp_yf)); + UNIT_TEST_CHECK(!pmask.includes(fp_yg)); + UNIT_TEST_CHECK(!pmask.includes(fp_yx)); + UNIT_TEST_CHECK(!pmask.includes(fp_yxf)); + UNIT_TEST_CHECK(!pmask.includes(fp_yxg)); + UNIT_TEST_CHECK(!pmask.includes(fp_yy)); + UNIT_TEST_CHECK(!pmask.includes(fp_yyf)); + UNIT_TEST_CHECK(!pmask.includes(fp_yyg)); } UNIT_TEST(restrictions, include_depth_1) @@ -1145,29 +1122,29 @@ UNIT_TEST(restrictions, include_depth_1) UNIT_TEST_CHECK(!pmask.empty()); - UNIT_TEST_CHECK(!pmask.includes(sp_root)); - UNIT_TEST_CHECK(!pmask.includes(sp_f)); - UNIT_TEST_CHECK(!pmask.includes(sp_g)); + UNIT_TEST_CHECK(!pmask.includes(fp_root)); + UNIT_TEST_CHECK(!pmask.includes(fp_f)); + UNIT_TEST_CHECK(!pmask.includes(fp_g)); - UNIT_TEST_CHECK( pmask.includes(sp_x)); - UNIT_TEST_CHECK( pmask.includes(sp_xf)); - UNIT_TEST_CHECK( pmask.includes(sp_xg)); - UNIT_TEST_CHECK( pmask.includes(sp_xx)); - UNIT_TEST_CHECK( pmask.includes(sp_xxf)); - UNIT_TEST_CHECK( pmask.includes(sp_xxg)); - UNIT_TEST_CHECK( pmask.includes(sp_xy)); - UNIT_TEST_CHECK( pmask.includes(sp_xyf)); - UNIT_TEST_CHECK( pmask.includes(sp_xyg)); + UNIT_TEST_CHECK( pmask.includes(fp_x)); + UNIT_TEST_CHECK( pmask.includes(fp_xf)); + UNIT_TEST_CHECK( pmask.includes(fp_xg)); + UNIT_TEST_CHECK( pmask.includes(fp_xx)); + UNIT_TEST_CHECK( pmask.includes(fp_xxf)); + UNIT_TEST_CHECK( pmask.includes(fp_xxg)); + UNIT_TEST_CHECK( pmask.includes(fp_xy)); + UNIT_TEST_CHECK( pmask.includes(fp_xyf)); + UNIT_TEST_CHECK( pmask.includes(fp_xyg)); - UNIT_TEST_CHECK( pmask.includes(sp_y)); - UNIT_TEST_CHECK( pmask.includes(sp_yf)); - UNIT_TEST_CHECK( pmask.includes(sp_yg)); - UNIT_TEST_CHECK( pmask.includes(sp_yx)); - UNIT_TEST_CHECK( pmask.includes(sp_yxf)); - UNIT_TEST_CHECK( pmask.includes(sp_yxg)); - UNIT_TEST_CHECK( pmask.includes(sp_yy)); - UNIT_TEST_CHECK( pmask.includes(sp_yyf)); - UNIT_TEST_CHECK( pmask.includes(sp_yyg)); + UNIT_TEST_CHECK( pmask.includes(fp_y)); + UNIT_TEST_CHECK( pmask.includes(fp_yf)); + UNIT_TEST_CHECK( pmask.includes(fp_yg)); + UNIT_TEST_CHECK( pmask.includes(fp_yx)); + UNIT_TEST_CHECK( pmask.includes(fp_yxf)); + UNIT_TEST_CHECK( pmask.includes(fp_yxg)); + UNIT_TEST_CHECK( pmask.includes(fp_yy)); + UNIT_TEST_CHECK( pmask.includes(fp_yyf)); + UNIT_TEST_CHECK( pmask.includes(fp_yyg)); } #endif // BUILD_UNIT_TESTS ============================================================ --- revision.cc df17f8e950d6c5167382fcdedddb5ce5cab87b5c +++ revision.cc f840485a92a3fa9804903ea61eb45ed33344dcd5 @@ -1313,8 +1313,10 @@ anc_graph::fixup_node_identities(parent_ if (!parent_roster->has_node(n)) continue; + file_path fp; + parent_roster->get_name(n, fp); split_path sp; - parent_roster->get_name(n, sp); + fp.split(sp); // Try remapping the name. if (node_to_old_rev.find(j->first) != node_to_old_rev.end()) ============================================================ --- roster.cc 229568f3e2669041881ff70ed119a89322d75548 +++ roster.cc 787958094de79f2d120a47ada655397a241f3d23 @@ -580,8 +580,10 @@ node_t node_t -roster_t::get_node(split_path const & sp) const +roster_t::get_node(file_path const & p) const { + split_path sp; + p.split(sp); split_path dirname; path_component basename; dirname_basename(sp, dirname, basename); @@ -616,8 +618,10 @@ bool } bool -roster_t::has_node(split_path const & sp) const +roster_t::has_node(file_path const & p) const { + split_path sp; + p.split(sp); split_path dirname; path_component basename; dirname_basename(sp, dirname, basename); @@ -655,10 +659,10 @@ void void -roster_t::get_name(node_id nid, split_path & sp) const +roster_t::get_name(node_id nid, file_path & p) const { + split_path sp; I(!null_node(nid)); - sp.clear(); while (!null_node(nid)) { node_t n = get_node(nid); @@ -666,6 +670,7 @@ roster_t::get_name(node_id nid, split_pa nid = n->parent; } reverse(sp.begin(), sp.end()); + p = file_path(sp); } @@ -694,11 +699,13 @@ node_id // this records the old location into the old_locations member, to prevent the // same node from being re-attached at the same place. node_id -roster_t::detach_node(split_path const & pth) +roster_t::detach_node(file_path const & p) { + split_path sp; + p.split(sp); split_path dirname; path_component basename; - dirname_basename(pth, dirname, basename); + dirname_basename(sp, dirname, basename); I(has_root()); if (dirname.empty()) @@ -804,13 +811,15 @@ void } void -roster_t::attach_node(node_id nid, split_path const & dst) +roster_t::attach_node(node_id nid, file_path const & p) { + split_path sp; + p.split(sp); split_path dirname; path_component basename; - dirname_basename(dst, dirname, basename); + dirname_basename(sp, dirname, basename); - MM(dst); + MM(sp); if (dirname.empty()) // attaching the root node @@ -856,7 +865,7 @@ void } void -roster_t::apply_delta(split_path const & pth, +roster_t::apply_delta(file_path const & pth, file_id const & old_id, file_id const & new_id) { @@ -877,7 +886,7 @@ void void -roster_t::clear_attr(split_path const & pth, +roster_t::clear_attr(file_path const & pth, attr_key const & name) { set_attr(pth, name, make_pair(false, attr_value())); @@ -892,7 +901,7 @@ void } void -roster_t::set_attr(split_path const & pth, +roster_t::set_attr(file_path const & pth, attr_key const & name, attr_value const & val) { @@ -901,7 +910,7 @@ void void -roster_t::set_attr(split_path const & pth, +roster_t::set_attr(file_path const & pth, attr_key const & name, pair const & val) { @@ -931,7 +940,7 @@ bool } bool -roster_t::get_attr(split_path const & pth, +roster_t::get_attr(file_path const & pth, attr_key const & name, attr_value & val) const { @@ -1075,9 +1084,7 @@ editable_roster_base::detach_node(file_p editable_roster_base::detach_node(file_path const & src) { // L(FL("detach_node('%s')") % file_path(src)); - split_path sp; - src.split(sp); - return r.detach_node(sp); + return r.detach_node(src); } void @@ -1111,9 +1118,7 @@ editable_roster_base::attach_node(node_i // L(FL("attach_node(%d, '%s')") % nid % file_path(dst)); MM(dst); MM(this->r); - split_path sd; - dst.split(sd); - r.attach_node(nid, sd); + r.attach_node(nid, dst); } void @@ -1122,9 +1127,7 @@ editable_roster_base::apply_delta(file_p file_id const & new_id) { // L(FL("apply_delta('%s', '%s', '%s')") % file_path(pth) % old_id % new_id); - split_path sp; - pth.split(sp); - r.apply_delta(sp, old_id, new_id); + r.apply_delta(pth, old_id, new_id); } void @@ -1132,9 +1135,7 @@ editable_roster_base::clear_attr(file_pa attr_key const & name) { // L(FL("clear_attr('%s', '%s')") % file_path(pth) % name); - split_path sp; - pth.split(sp); - r.clear_attr(sp, name); + r.clear_attr(pth, name); } void @@ -1143,9 +1144,7 @@ editable_roster_base::set_attr(file_path attr_value const & val) { // L(FL("set_attr('%s', '%s', '%s')") % file_path(pth) % name % val); - split_path sp; - pth.split(sp); - r.set_attr(sp, name, val); + r.set_attr(pth, name, val); } void @@ -1208,13 +1207,13 @@ namespace for (set::const_iterator i = a_new.begin(); i != a_new.end(); ++i) { node_id const aid = *i; - split_path sp; + file_path p; // SPEEDUP?: climb out only so far as is necessary to find a shared // id? possibly faster (since usually will get a hit immediately), // but may not be worth the effort (since it doesn't take that long to // get out in any case) - a.get_name(aid, sp); - node_id bid = b.get_node(sp)->self; + a.get_name(aid, p); + node_id bid = b.get_node(p)->self; if (b_new.find(bid) != b_new.end()) { I(temp_node(bid)); @@ -1237,13 +1236,13 @@ namespace for (set::const_iterator i = b_new.begin(); i != b_new.end(); i++) { node_id const bid = *i; - split_path sp; + file_path p; // SPEEDUP?: climb out only so far as is necessary to find a shared // id? possibly faster (since usually will get a hit immediately), // but may not be worth the effort (since it doesn't take that long to // get out in any case) - b.get_name(bid, sp); - node_id aid = a.get_node(sp)->self; + b.get_name(bid, p); + node_id aid = a.get_node(p)->self; I(a_new.find(aid) == a_new.end()); b.replace_node_id(bid, aid); } @@ -1702,9 +1701,7 @@ namespace { file_id const & old_id, file_id const & new_id) { this->editable_roster_base::apply_delta(pth, old_id, new_id); - split_path sp; - pth.split(sp); - node_id nid = r.get_node(sp)->self; + node_id nid = r.get_node(pth)->self; marking_map::iterator marking = markings.find(nid); I(marking != markings.end()); marking->second.file_content.clear(); @@ -1735,9 +1732,7 @@ namespace { void handle_attr(file_path const & pth, attr_key const & name) { - split_path sp; - pth.split(sp); - node_id nid = r.get_node(sp)->self; + node_id nid = r.get_node(pth)->self; marking_map::iterator marking = markings.find(nid); map >::iterator am = marking->second.attrs.find(name); if (am == marking->second.attrs.end()) @@ -2000,31 +1995,31 @@ namespace node_id nid, node_t n, cset & cs) { - split_path sp; - from.get_name(nid, sp); - safe_insert(cs.nodes_deleted, sp); + file_path pth; + from.get_name(nid, pth); + safe_insert(cs.nodes_deleted, pth); } void delta_only_in_to(roster_t const & to, node_id nid, node_t n, cset & cs) { - split_path sp; - to.get_name(nid, sp); + file_path pth; + to.get_name(nid, pth); if (is_file_t(n)) { safe_insert(cs.files_added, - make_pair(sp, downcast_to_file_t(n)->content)); + make_pair(pth, downcast_to_file_t(n)->content)); } else { - safe_insert(cs.dirs_added, sp); + safe_insert(cs.dirs_added, pth); } for (full_attr_map_t::const_iterator i = n->attrs.begin(); i != n->attrs.end(); ++i) if (i->second.first) safe_insert(cs.attrs_set, - make_pair(make_pair(sp, i->first), i->second.second)); + make_pair(make_pair(pth, i->first), i->second.second)); } void delta_in_both(node_id nid, @@ -2038,13 +2033,13 @@ namespace if (shallow_equal(from_n, to_n, false)) return; - split_path from_sp, to_sp; - from.get_name(nid, from_sp); - to.get_name(nid, to_sp); + file_path from_p, to_p; + from.get_name(nid, from_p); + to.get_name(nid, to_p); // Compare name and path. if (from_n->name != to_n->name || from_n->parent != to_n->parent) - safe_insert(cs.nodes_renamed, make_pair(from_sp, to_sp)); + safe_insert(cs.nodes_renamed, make_pair(from_p, to_p)); // Compare file content. if (is_file_t(from_n)) @@ -2054,7 +2049,7 @@ namespace if (!(from_f->content == to_f->content)) { safe_insert(cs.deltas_applied, - make_pair(to_sp, make_pair(from_f->content, + make_pair(to_p, make_pair(from_f->content, to_f->content))); } } @@ -2070,14 +2065,14 @@ namespace && i.left_data().first) { safe_insert(cs.attrs_cleared, - make_pair(to_sp, i.left_key())); + make_pair(to_p, i.left_key())); } else if ((i.state() == parallel::in_right || (i.state() == parallel::in_both && !i.left_data().first)) && i.right_data().first) { safe_insert(cs.attrs_set, - make_pair(make_pair(to_sp, i.right_key()), + make_pair(make_pair(to_p, i.right_key()), i.right_data().second)); } else if (i.state() == parallel::in_both @@ -2086,7 +2081,7 @@ namespace && i.right_data().second != i.left_data().second) { safe_insert(cs.attrs_set, - make_pair(make_pair(to_sp, i.right_key()), + make_pair(make_pair(to_p, i.right_key()), i.right_data().second)); } } @@ -2137,11 +2132,11 @@ equal_up_to_renumbering(roster_t const & for (node_map::const_iterator i = a.all_nodes().begin(); i != a.all_nodes().end(); ++i) { - split_path sp; - a.get_name(i->first, sp); - if (!b.has_node(sp)) + file_path p; + a.get_name(i->first, p); + if (!b.has_node(p)) return false; - node_t b_n = b.get_node(sp); + node_t b_n = b.get_node(p); // we already know names are the same if (!same_type(i->second, b_n)) return false; @@ -2236,7 +2231,7 @@ class editable_roster_for_check private: temp_node_id_source nis; - map > > detached_dirs; + map > > detached_dirs; }; editable_roster_for_check::editable_roster_for_check(roster_t & r) @@ -2264,9 +2259,7 @@ editable_roster_for_check::detach_node(f node_id editable_roster_for_check::detach_node(file_path const & src) { - split_path sp; - src.split(sp); - node_t n = r.get_node(sp); + node_t n = r.get_node(src); if (is_dir_t(n)) { dir_t dir = downcast_to_dir_t(n); @@ -2277,7 +2270,7 @@ editable_roster_for_check::detach_node(f children.push_back(i->first); } detached_dirs.insert(make_pair(dir->self, - make_pair(sp, children))); + make_pair(src, children))); } return this->editable_roster_base::detach_node(src); @@ -2289,18 +2282,17 @@ editable_roster_for_check::drop_detached node_t n = r.get_node(nid); if (is_dir_t(n) && !downcast_to_dir_t(n)->children.empty()) { - map > >::const_iterator + map > >::const_iterator i = detached_dirs.find(nid); I(i != detached_dirs.end()); - split_path dir = i->second.first; + file_path dir = i->second.first; for (vector::const_iterator p = i->second.second.begin(); p != i->second.second.end(); ++p) { - split_path child(dir); - child.push_back(*p); - W(F("restriction includes deletion of '%s' but excludes deletion of '%s'") - % dir % child); + W(F("restriction includes deletion of '%s' " + "but excludes deletion of '%s'") + % dir % (dir / (*p)())); problems++; } } @@ -2403,19 +2395,15 @@ select_nodes_modified_by_cset(cset const for (set::const_iterator i = modified_prestate_nodes.begin(); i != modified_prestate_nodes.end(); ++i) { - split_path s; - i->split(s); - I(old_roster.has_node(s)); - nodes_modified.insert(old_roster.get_node(s)->self); + I(old_roster.has_node(*i)); + nodes_modified.insert(old_roster.get_node(*i)->self); } for (set::const_iterator i = modified_poststate_nodes.begin(); i != modified_poststate_nodes.end(); ++i) { - split_path s; - i->split(s); - I(new_roster.has_node(s)); - nodes_modified.insert(new_roster.get_node(s)->self); + I(new_roster.has_node(*i)); + nodes_modified.insert(new_roster.get_node(*i)->self); } } @@ -2445,10 +2433,10 @@ get_content_paths(roster_t const & roste node_t node = roster.get_node(i->first); if (is_file_t(node)) { - split_path sp; - roster.get_name(i->first, sp); + file_path p; + roster.get_name(i->first, p); file_t file = downcast_to_file_t(node); - paths.insert(make_pair(file->content, file_path(sp))); + paths.insert(make_pair(file->content, p)); } } } @@ -2549,23 +2537,15 @@ roster_t::print_to(basic_io::printer & p basic_io::stanza st; { - //split_path pth; - //get_name(curr->self, pth); - //file_path fp = file_path(pth); - if (is_dir_t(curr)) { - // L(FL("printing dir %s") % fp); - //st.push_file_pair(basic_io::syms::dir, fp); st.push_str_pair(basic_io::syms::dir, i.path()); } else { file_t ftmp = downcast_to_file_t(curr); - //st.push_file_pair(basic_io::syms::file, fp); st.push_str_pair(basic_io::syms::file, i.path()); st.push_hex_pair(basic_io::syms::content, ftmp->content.inner()); - // L(FL("printing file %s") % fp); } } @@ -2688,9 +2668,7 @@ roster_t::parse_from(basic_io::parser & else { I(!pth.empty()); - split_path sp; - internal_string_to_split_path(pth, sp); - attach_node(n->self, sp); + attach_node(n->self, file_path_internal(pth)); } // Non-dormant attrs @@ -2836,21 +2814,19 @@ do_testing_on_one_roster(roster_t const int n; MM(n); n = r.all_nodes().size(); int dfs_counted = 0; MM(dfs_counted); - split_path root_name; - file_path().split(root_name); - for (dfs_iter i(downcast_to_dir_t(r.get_node(root_name))); !i.finished(); ++i) + for (dfs_iter i(downcast_to_dir_t(r.get_node(file_path()))); + !i.finished(); ++i) ++dfs_counted; I(n == dfs_counted); // Test dfs_iter's path calculations. - for (dfs_iter i(downcast_to_dir_t(r.get_node(root_name)), true); + for (dfs_iter i(downcast_to_dir_t(r.get_node(file_path())), true); !i.finished(); ++i) { file_path from_iter = file_path_internal(i.path()); - split_path sp; + file_path from_getname; node_t curr = *i; - r.get_name(curr->self, sp); - file_path from_getname(sp); + r.get_name(curr->self, from_getname); I(from_iter == from_getname); } @@ -3079,7 +3055,9 @@ void perform_random_action(roster_t & r, { node_t n = random_element(r.all_nodes(), rng)->second; split_path pth; - r.get_name(n->self, pth); + file_path fp; + r.get_name(n->self, fp); + fp.split(pth); // L(FL("considering acting on '%s'") % file_path(pth)); switch (rng.uniform(7)) @@ -3122,8 +3100,10 @@ void perform_random_action(roster_t & r, case 4: { node_t n2 = random_element(r.all_nodes(), rng)->second; + file_path fp2; split_path pth2; - r.get_name(n2->self, pth2); + r.get_name(n2->self, fp2); + fp2.split(pth2); if (n == n2) continue; @@ -4886,10 +4866,11 @@ create_random_unification_task(roster_t } split_path pth; - left.get_name(left_n->self, pth); + file_path fp; + left.get_name(left_n->self, fp); + I(right.has_node(fp)); + fp.split(pth); - I(right.has_node(pth)); - if (is_file_t(left_n) || (pth.size() > 1 && rng.flip())) // Add a sibling of an existing entry. pth[pth.size() - 1] = new_component(rng); ============================================================ --- roster.hh c79aa7425a84c5709c83ce730d823772066f12b2 +++ roster.hh b7db1764e51b0a45e81539e1b7dc761c472b344a @@ -179,16 +179,16 @@ public: roster_t(roster_t const & other); roster_t & operator=(roster_t const & other); bool has_root() const; - bool has_node(split_path const & sp) const; + bool has_node(file_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(file_path const & sp) const; node_t get_node(node_id nid) const; - void get_name(node_id nid, split_path & sp) const; + void get_name(node_id nid, file_path & sp) const; void replace_node_id(node_id from, node_id to); // editable_tree operations - node_id detach_node(split_path const & src); + node_id detach_node(file_path const & src); void drop_detached_node(node_id nid); node_id create_dir_node(node_id_source & nis); void create_dir_node(node_id nid); @@ -197,17 +197,17 @@ public: void create_file_node(file_id const & content, node_id nid); void insert_node(node_t n); - void attach_node(node_id nid, split_path const & dst); + void attach_node(node_id nid, file_path const & dst); void attach_node(node_id nid, node_id parent, path_component name); - void apply_delta(split_path const & pth, + void apply_delta(file_path const & pth, file_id const & old_id, file_id const & new_id); - void clear_attr(split_path const & pth, + void clear_attr(file_path const & pth, attr_key const & name); - void set_attr(split_path const & pth, + void set_attr(file_path const & pth, attr_key const & name, attr_value const & val); - void set_attr(split_path const & pth, + void set_attr(file_path const & pth, attr_key const & name, std::pair const & val); @@ -223,7 +223,7 @@ public: // misc. - bool get_attr(split_path const & pth, + bool get_attr(file_path const & pth, attr_key const & key, attr_value & val) const; ============================================================ --- roster_merge.cc b17a6717d58bf2e10022ac4a1a1ec607d6f6fc65 +++ roster_merge.cc 275a8079ced7fd414802f69fb1d1d7f7cfdb23a5 @@ -594,18 +594,18 @@ roster_merge(roster_t const & left_paren { // we can't have an illegal _MTN dir unless we have a root node in the // first place... - split_path bookkeeping_root_split; - bookkeeping_root_split.push_back(the_null_component); - bookkeeping_root_split.push_back(bookkeeping_root_component); - if (result.roster.has_node(bookkeeping_root_split)) + dir_t result_root = result.roster.root(); + + if (result_root->has_child(bookkeeping_root_component)) { illegal_name_conflict conflict; - node_t n = result.roster.get_node(bookkeeping_root_split); + node_t n = result_root->get_child(bookkeeping_root_component); conflict.nid = n->self; conflict.parent_name.first = n->parent; conflict.parent_name.second = n->name; I(n->name == bookkeeping_root_component); - I(n->self == result.roster.detach_node(bookkeeping_root_split)); + + result.roster.detach_node(n->self); result.illegal_name_conflicts.push_back(conflict); } } @@ -862,12 +862,16 @@ struct name_shared_stuff : public virtua // NB result is writeable -- we can scribble on it roster_merge_result & result, scalar_val expected_val) { - split_path name; switch (expected_val) { case scalar_a: case scalar_b: - result.roster.get_name(thing_nid, name); - I(name == path_for(expected_val)); + { + file_path fp; + split_path name; + result.roster.get_name(thing_nid, fp); + fp.split(name); + I(name == path_for(expected_val)); + } break; case scalar_conflict: node_name_conflict const & c = idx(result.node_name_conflicts, 0); ============================================================ --- work.cc 644d6a7fef1bbd402c5470f032f824940ea4ab2b +++ work.cc 8a409fe325bc29ba61477021c35f5d70c0a2eb11 @@ -452,9 +452,8 @@ workspace::maybe_update_inodeprints() if (all_same) { - split_path sp; - new_roster.get_name(nid, sp); - file_path fp(sp); + file_path fp; + new_roster.get_name(nid, fp); hexenc ip; if (inodeprint_file(fp, ip)) ipm_new.insert(inodeprint_entry(fp, ip)); @@ -1093,9 +1092,8 @@ workspace::classify_roster_paths(roster_ node_id nid = i->first; node_t node = i->second; - split_path sp; - ros.get_name(nid, sp); - file_path fp(sp); + file_path fp; + ros.get_name(nid, fp); // if this node is a file, check the inodeprint cache for changes if (!is_dir_t(node) && inodeprint_unchanged(ipm, fp)) @@ -1171,9 +1169,8 @@ workspace::update_current_roster_from_fi if (!mask.includes(ros, nid)) continue; - split_path sp; - ros.get_name(nid, sp); - file_path fp(sp); + file_path fp; + ros.get_name(nid, fp); const path::status status(get_path_status(fp)); @@ -1239,10 +1236,8 @@ workspace::find_missing(roster_t const & if (!new_roster_shape.is_root(nid) && mask.includes(new_roster_shape, nid)) { - split_path sp; - new_roster_shape.get_name(nid, sp); - file_path fp(sp); - + file_path fp; + new_roster_shape.get_name(nid, fp); if (!path_exists(fp)) missing.insert(fp); } @@ -1286,9 +1281,7 @@ workspace::perform_additions(setfirst, sp); + file_path fp; + new_roster.get_name(i->first, fp); node_t n = i->second; for (full_attr_map_t::const_iterator j = n->attrs.begin(); j != n->attrs.end(); ++j) if (j->second.first) - lua.hook_apply_attribute (j->first(), file_path(sp), + lua.hook_apply_attribute (j->first(), fp, j->second.second()); } }