#
#
# patch "ChangeLog"
# from [258fa7ece1afa815ba9cfa7ac924aff2f66de342]
# to [b91bf3c2fc1d68f628396966635ce03b366c78ce]
#
# patch "restrictions.cc"
# from [80183dbc99249d83cbcde3fe8d59a0a9585cd0f9]
# to [543a6747d29e43971e5499b002e7e5975cac596a]
#
# patch "restrictions.hh"
# from [79ef3d493453af0098cfb11618e6fce1e8bb8f6d]
# to [b73366c297d5fc949d873b0449d8cb1448f53bb1]
#
# patch "tests/t_restriction_excludes_parent.at"
# from [1d7f70ad7393b27b6ad40728ff6eded71de6281f]
# to [47287111c7d5732ff50a467e6514ad0c99c00a41]
#
============================================================
--- ChangeLog 258fa7ece1afa815ba9cfa7ac924aff2f66de342
+++ ChangeLog b91bf3c2fc1d68f628396966635ce03b366c78ce
@@ -1,3 +1,10 @@
+2006-03-03 Derek Scherger
+
+ * restrictions.cc (check_for_missing_additions): new function
+ (remap_paths): make static
+ (get_base_roster_and_working_cset): call check_for_missing_additions
+ * tests/t_restriction_excludes_parent.at: un-XFAIL
+
2006-03-02 Derek Scherger
testsuite.at: fix broken include of t_restriction_excludes_parent.at
============================================================
--- restrictions.cc 80183dbc99249d83cbcde3fe8d59a0a9585cd0f9
+++ restrictions.cc 543a6747d29e43971e5499b002e7e5975cac596a
@@ -125,10 +125,53 @@
}
+static void
+check_for_missing_additions(cset const & work, roster_t const & roster)
+{
+ path_set added;
+ int missing = 0;
+
+ for (path_set::const_iterator i = work.dirs_added.begin();
+ i != work.dirs_added.end(); ++i)
+ {
+ split_path dir(*i);
+ added.insert(dir);
+
+ if (dir.size() > 1)
+ {
+ dir.pop_back();
+
+ if (!roster.has_node(dir) && added.find(dir) == added.end())
+ {
+ missing++;
+ W(F("restriction excludes directory '%s'") % dir);
+ }
+ }
+ }
+
+ for (std::map::const_iterator i = work.files_added.begin();
+ i != work.files_added.end(); ++i)
+ {
+ split_path dir(i->first);
+ I(dir.size() > 1);
+ dir.pop_back();
+
+ if (!roster.has_node(dir) && added.find(dir) == added.end())
+ {
+ missing++;
+ W(F("restriction excludes directory '%s'") % dir);
+ }
+ }
+
+ N(missing == 0,
+ F("invalid restriction excludes required directories"));
+
+}
+
// Project the old_paths through r_old + work, to find the new names of the
// paths (if they survived work)
-void
+static void
remap_paths(path_set const & old_paths,
roster_t const & r_old,
cset const & work,
@@ -175,6 +218,9 @@
app.set_restriction(valid_paths, args);
restrict_cset(work, included, excluded, app);
+
+ check_for_missing_additions(included, old_roster);
+
remap_paths(old_paths, old_roster, work, new_paths);
for (path_set::const_iterator i = included.dirs_added.begin();
============================================================
--- restrictions.hh 79ef3d493453af0098cfb11618e6fce1e8bb8f6d
+++ restrictions.hh b73366c297d5fc949d873b0449d8cb1448f53bb1
@@ -41,12 +41,6 @@
cset & excluded,
app_state & app);
-void
-remap_paths(path_set const & old_paths,
- roster_t const & r_old,
- cset const & work,
- path_set & new_paths);
-
void
get_base_roster_and_working_cset(app_state & app,
std::vector const & args,
============================================================
--- tests/t_restriction_excludes_parent.at 1d7f70ad7393b27b6ad40728ff6eded71de6281f
+++ tests/t_restriction_excludes_parent.at 47287111c7d5732ff50a467e6514ad0c99c00a41
@@ -1,8 +1,6 @@
AT_SETUP([restriction excludes parent dir])
MONOTONE_SETUP
-# this test is a bug report
-#
# - restricting a new project excludes the root directory addition
# - restricting to things below a newly added directory excludes the directory
# - excluding added directories but including things they contain is bad
@@ -15,13 +13,11 @@
# --depth=0 should probably mean "directory without contents" rather than
# "directory and all immediate children"
-AT_XFAIL_IF(true)
-
ADD_FILE(file, [file
])
# exclude newly added root dir but include file below it
-AT_CHECK(MONOTONE st file, [3], [ignore], [ignore])
+AT_CHECK(MONOTONE st file, [1], [ignore], [ignore])
COMMIT(testbranch)
@@ -32,10 +28,6 @@
# exclude newly added foo dir but include bar below it
-AT_CHECK(MONOTONE st foo/bar, [3], [ignore], [ignore])
+AT_CHECK(MONOTONE st foo/bar, [1], [ignore], [ignore])
-# note that return status [3] above indicates a crash
-
-AT_CHECK(false)
-
AT_CLEANUP