# # # patch "cmd_diff_log.cc" # from [19a9ea13bfa486f332ead5ea68de4f1f21b6b2e0] # to [514fdfadc25f734f33896ad77d3fde5e8b902296] # # patch "restrictions.cc" # from [6db7f7243f247cd8c5f3b1eef3881abaf97819ed] # to [6beea3ceb592066b0502df44305d85189c289fc7] # # patch "restrictions.hh" # from [68b20076ec219d0e6f796cb0ea05a83fefc539ce] # to [6cc851724aa78f04c22327a1a82dfe4facbca43a] # # patch "tests/log_dir/__driver__.lua" # from [b9b1ce5d34a1ab22e4b681c059c9f97595a221bd] # to [533928ec6a0f7aadb5b2f9dca4a0bc8fb35d2277] # # patch "tests/log_with_restriction/__driver__.lua" # from [e3954443c89014806e43c95cf27eae40774479da] # to [21a1887296a0fb3a33b8320b746e911d9cb4b9b1] # ============================================================ --- cmd_diff_log.cc 19a9ea13bfa486f332ead5ea68de4f1f21b6b2e0 +++ cmd_diff_log.cc 514fdfadc25f734f33896ad77d3fde5e8b902296 @@ -144,7 +144,7 @@ dump_diffs(lua_hooks & lua, file_path left_path, right_path; left_roster.get_name(i.left_key(), left_path); // right_path is null - + file_id left_id, right_id; left_id = downcast_to_file_t(i.left_data())->content; // right_id is null @@ -157,7 +157,7 @@ dump_diffs(lua_hooks & lua, if (show_encloser) lua.hook_get_encloser_pattern(left_path, encloser); - dump_diff(lua, + dump_diff(lua, left_path, right_path, left_id, right_id, left_data, right_data, @@ -173,7 +173,7 @@ dump_diffs(lua_hooks & lua, file_path left_path, right_path; // left_path is null right_roster.get_name(i.right_key(), right_path); - + file_id left_id, right_id; // left_id is null right_id = downcast_to_file_t(i.right_data())->content; @@ -186,7 +186,7 @@ dump_diffs(lua_hooks & lua, if (show_encloser) lua.hook_get_encloser_pattern(right_path, encloser); - dump_diff(lua, + dump_diff(lua, left_path, right_path, left_id, right_id, left_data, right_data, @@ -199,7 +199,7 @@ dump_diffs(lua_hooks & lua, // moved/renamed/patched/attribute changes if (is_file_t(i.left_data())) { - + file_id left_id, right_id; left_id = downcast_to_file_t(i.left_data())->content; right_id = downcast_to_file_t(i.right_data())->content; @@ -210,7 +210,7 @@ dump_diffs(lua_hooks & lua, file_path left_path, right_path; left_roster.get_name(i.left_key(), left_path); right_roster.get_name(i.right_key(), right_path); - + data left_data, right_data; get_data(db, left_path, left_id, left_from_db, left_data); get_data(db, right_path, right_id, right_from_db, right_data); @@ -219,7 +219,7 @@ dump_diffs(lua_hooks & lua, if (show_encloser) lua.hook_get_encloser_pattern(right_path, encloser); - dump_diff(lua, + dump_diff(lua, left_path, right_path, left_id, right_id, left_data, right_data, @@ -514,7 +514,7 @@ log_certs(vector const & certs, os I(name == date_cert_name); os << date_t(i->value()).as_formatted_localtime(date_fmt); } - + first = false; } } @@ -695,7 +695,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, - ignored_file(work)); + ignored_file(work), + restriction::explicit_includes); } else { @@ -707,7 +708,9 @@ 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.opts.depth, roster, + path_always_false(), + restriction::explicit_includes); } } @@ -900,7 +903,7 @@ CMD(log, "log", "", CMD_REF(informative) restricted_roster, mask); dump_diffs(app.lua, db, parent_roster, restricted_roster, - out, app.opts.diff_format, + out, app.opts.diff_format, app.opts.external_diff_args_given, app.opts.external_diff_args, true, true, ============================================================ --- restrictions.cc 6db7f7243f247cd8c5f3b1eef3881abaf97819ed +++ restrictions.cc 6beea3ceb592066b0502df44305d85189c289fc7 @@ -250,11 +250,15 @@ node_restriction::node_restriction(vecto vector const & excludes, long depth, roster_t const & roster, - path_predicate const & ignore) + path_predicate const & ignore, + include_rules const & rules) : restriction(includes, excludes, depth) { map_nodes(node_map, roster, included_paths, excluded_paths, known_paths); - add_parents(node_map, roster); + + if (rules == implicit_includes) + add_parents(node_map, roster); + validate_paths(included_paths, excluded_paths, unknown_unignored_node(known_paths, ignore)); } @@ -286,7 +290,8 @@ node_restriction::node_restriction(vecto long depth, parent_map const & rosters1, roster_t const & roster2, - path_predicate const & ignore) + path_predicate const & ignore, + include_rules const & rules) : restriction(includes, excludes, depth) { for (parent_map::const_iterator i = rosters1.begin(); @@ -295,10 +300,13 @@ node_restriction::node_restriction(vecto included_paths, excluded_paths, known_paths); map_nodes(node_map, roster2, included_paths, excluded_paths, known_paths); - for (parent_map::const_iterator i = rosters1.begin(); - i != rosters1.end(); i++) - add_parents(node_map, parent_roster(i)); - add_parents(node_map, roster2); + if (rules == implicit_includes) + { + for (parent_map::const_iterator i = rosters1.begin(); + i != rosters1.end(); i++) + add_parents(node_map, parent_roster(i)); + add_parents(node_map, roster2); + } validate_paths(included_paths, excluded_paths, unknown_unignored_node(known_paths, ignore)); ============================================================ --- restrictions.hh 68b20076ec219d0e6f796cb0ea05a83fefc539ce +++ restrictions.hh 6cc851724aa78f04c22327a1a82dfe4facbca43a @@ -60,7 +60,7 @@ namespace restricted_path { included, excluded, - required, + required, included_required, excluded_required }; @@ -74,7 +74,7 @@ class restriction enum include_rules { - explicit_includes, + explicit_includes, implicit_includes }; @@ -99,7 +99,8 @@ class node_restriction : public restrict long depth, roster_t const & roster, path_predicate const & ignore_file - = path_always_false()); + = path_always_false(), + include_rules const & rules = implicit_includes); node_restriction(std::vector const & includes, std::vector const & excludes, @@ -116,7 +117,8 @@ class node_restriction : public restrict parent_map const & rosters1, roster_t const & roster2, path_predicate const & ignore_file - = path_always_false()); + = path_always_false(), + include_rules const & rules = implicit_includes); bool includes(roster_t const & roster, node_id nid) const; ============================================================ --- tests/log_dir/__driver__.lua b9b1ce5d34a1ab22e4b681c059c9f97595a221bd +++ tests/log_dir/__driver__.lua 533928ec6a0f7aadb5b2f9dca4a0bc8fb35d2277 @@ -44,8 +44,8 @@ for n,x in pairs{[""] = {0,0,0,0,0,0,0} for n,x in pairs{[""] = {0,0,0,0,0,0,0}, ["."] = {0,0,0,0,0,0,0}, - dir1 = {0,0,1,0,0,1,1}, - dir2 = {0,1,0,0,1,0,0}} do + dir1 = {1,0,1,0,0,1,1}, + dir2 = {1,1,0,0,1,0,0}} do if n == "" then check(mtn("log", "--no-graph"), 0, true) else ============================================================ --- tests/log_with_restriction/__driver__.lua e3954443c89014806e43c95cf27eae40774479da +++ tests/log_with_restriction/__driver__.lua 21a1887296a0fb3a33b8320b746e911d9cb4b9b1 @@ -104,9 +104,8 @@ rename("stdout", "revs") check(grep("^Revision:", "log"), 0, true, false) rename("stdout", "revs") -check(numlines("revs") == 4) +check(numlines("revs") == 3) -check(grep("^Revision: " .. rev_root, "log"), 0, true) check(grep("^Revision: " .. rev_foo1, "log"), 0, true) check(grep("^Revision: " .. rev_foo2, "log"), 0, true) check(grep("^Revision: " .. rev_foo3, "log"), 0, true)