# # patch "app_state.cc" # from [851f929f60678a14b02c741e3dee9157d13a7f32] # to [dae69a1502b8879ada55d439d0563a0c54a9b0cb] # # patch "app_state.hh" # from [5240bc3b5725c114cd4de8d3a4cba8a4c8144bed] # to [c205c128da42a2d24e189244604b6374b200e600] # # patch "commands.cc" # from [fc1efe3705f41c992c3780d1f900fd12704fdb8e] # to [2e264c8e9b607ab62e4818329f97dc660dad86d0] # # patch "restrictions.hh" # from [00d79bb7b71db313691400e14d2dc8f92f149781] # to [fe481d882a2c8a1b17f6a817a639076dc7cf7a88] # # patch "roster.cc" # from [72c64e3a7e3dba902d675a14d9ce425b93397614] # to [ae1b6731e45d4d54513538c5f3d28cedb58d85fc] # # patch "work.cc" # from [116e7d9c0506e448361e8c209e56553ff60882db] # to [a1e990002ae2c02ec68eb8496dbfb8cb08be73ef] # ======================================================================== --- app_state.cc 851f929f60678a14b02c741e3dee9157d13a7f32 +++ app_state.cc dae69a1502b8879ada55d439d0563a0c54a9b0cb @@ -186,12 +186,14 @@ } bool -app_state::restriction_includes(file_path const & path) +app_state::restriction_includes(split_path const & sp) { // FIXME: this was written before split_path, and only later kludged to // work with it. Could be much tidier if written with knowledge of // split_path. + file_path path(sp); + static file_path root = file_path_internal(""); split_path sp_root; root.split(sp_root); @@ -202,25 +204,23 @@ { if (excludes.find(sp_root) != excludes.end()) return false; - fs::path test = fs::path(path.as_external(), fs::native); + split_path test = sp; + while (!test.empty()) { - L(F("checking excluded path set for '%s'\n") % test.string()); + L(F("checking excluded path set for '%s'\n") % file_path(test)); - file_path p = file_path_internal(test.string()); - split_path sp; - p.split(sp); - path_set::const_iterator i = excludes.find(sp); + path_set::const_iterator i = excludes.find(test); if (i != excludes.end()) { L(F("path '%s' found in excluded path set; '%s' excluded\n") - % test.string() % path); + % file_path(test) % path); return false; } - test = test.branch_path(); + test.pop_back(); } } return true; @@ -228,35 +228,32 @@ bool user_supplied_depth = (depth != -1); - fs::path test = fs::path(path.as_external(), fs::native); + split_path test = sp; long branch_depth = 0; long max_depth = depth + 1; while (!test.empty()) { - L(F("checking restricted path set for '%s'\n") % test.string()); + L(F("checking restricted path set for '%s'\n") % file_path(test)); - file_path p = file_path_internal(test.string()); - split_path sp; - p.split(sp); - path_set::const_iterator i = restrictions.find(sp); - path_set::const_iterator j = excludes.find(sp); + path_set::const_iterator i = restrictions.find(test); + path_set::const_iterator j = excludes.find(test); if (i != restrictions.end()) { L(F("path '%s' found in restricted path set; '%s' included\n") - % test.string() % path); + % file_path(test) % path); return true; } else if (j != excludes.end()) { L(F("path '%s' found in excluded path set; '%s' excluded\n") - % test.string() % path); + % file_path(test) % path); return false; } if (user_supplied_depth && (max_depth == branch_depth)) return false; - test = test.branch_path(); + test.pop_back(); ++branch_depth; } ======================================================================== --- app_state.hh 5240bc3b5725c114cd4de8d3a4cba8a4c8144bed +++ app_state.hh c205c128da42a2d24e189244604b6374b200e600 @@ -90,7 +90,7 @@ void app_state::set_restriction(path_set const & valid_paths, std::vector const & paths, bool respect_ignore = true); - bool restriction_includes(file_path const & path); + bool restriction_includes(split_path const & path); // Set the branch name. If you only invoke set_branch, the branch // name is not sticky (and won't be written to the working copy and ======================================================================== --- commands.cc fc1efe3705f41c992c3780d1f900fd12704fdb8e +++ commands.cc 2e264c8e9b607ab62e4818329f97dc660dad86d0 @@ -1646,9 +1646,8 @@ for (path_set::const_iterator p = paths.begin(); p != paths.end(); ++p) { - file_path path(*p); - if (app.restriction_includes(path)) - cout << path << endl; + if (app.restriction_includes(*p)) + cout << file_path(*p) << endl; } } @@ -1707,7 +1706,7 @@ continue; } file_path fp(*i); - if (app.restriction_includes(fp) && !path_exists(fp)) + if (app.restriction_includes(*i) && !path_exists(fp)) missing.insert(*i); } } @@ -3268,7 +3267,7 @@ file_path fp(sp); // Only revert restriction-included files. - if (!app.restriction_includes(fp)) + if (!app.restriction_includes(sp)) continue; if (is_file_t(node)) ======================================================================== --- restrictions.hh 00d79bb7b71db313691400e14d2dc8f92f149781 +++ restrictions.hh fe481d882a2c8a1b17f6a817a639076dc7cf7a88 @@ -11,6 +11,13 @@ #include "roster.hh" #include "vocab.hh" +struct restriction +{ + roster_t base_roster; + roster_t current_roster; + roster_t restricted_roster; +}; + void extract_rearranged_paths(cset const & rearrangement, path_set & paths); ======================================================================== --- roster.cc 72c64e3a7e3dba902d675a14d9ce425b93397614 +++ roster.cc ae1b6731e45d4d54513538c5f3d28cedb58d85fc @@ -1798,7 +1798,7 @@ file_path fp(sp); // Only analyze restriction-included files. - if (app.restriction_includes(fp)) + if (app.restriction_includes(sp)) { if (is_dir_t(node) || inodeprint_unchanged(ipm, fp)) { @@ -1867,7 +1867,7 @@ file_path fp(sp); // Only analyze restriction-included files. - if (!app.restriction_includes(fp)) + if (!app.restriction_includes(sp)) continue; // Only analyze changed files (or all files if inodeprints mode ======================================================================== --- work.cc 116e7d9c0506e448361e8c209e56553ff60882db +++ work.cc a1e990002ae2c02ec68eb8496dbfb8cb08be73ef @@ -39,7 +39,7 @@ { split_path sp; path.split(sp); - if (app.restriction_includes(path) && known.find(sp) == known.end()) + if (app.restriction_includes(sp) && known.find(sp) == known.end()) { if (app.lua.hook_ignore_file(path)) ignored.insert(sp);