# # # add_file "tests/automate_inventory_ignore_dirs/expected_2.stderr" # content [139fa2659365d1899a757ff8ef6191e6263064fe] # # add_file "tests/automate_inventory_ignore_dirs/expected_2.stdout" # content [cd896018adbe95b59dd286c8f78080bb99073af7] # # patch "HACKING" # from [b05dd82114101d138b4d85bd2cb401f8e9c98572] # to [a94eadea2457641d2d23ddd8dab732b207197bfb] # # patch "automate.cc" # from [bdfc6fb15de61d76c2401161b5918a2e31d58f8a] # to [43388fabb98737e3183612523d7f4a76d0d20427] # # patch "database.cc" # from [9e10e5d55233691379b3c4855ff77de8aced5ada] # to [0e55fc85ea2dfec7e34ed8de385881c60ea4316f] # # patch "luaext_parse_basic_io.cc" # from [e0dd6eaf52ad9523b67eae29bf67b26afd09f628] # to [1e504c774c37a0a8b924146bf4c8b972d2134ff4] # # patch "monotone.texi" # from [a8cd250cd2d04d8be45a74e15dc3164f9ceee921] # to [2b13a4dfe71e19312c85b10086c0adf5f38e19d5] # # patch "options_list.hh" # from [78fbe7c5728513ee672b75d6dcefbc2f508ba915] # to [cd0ff5a0d051b4644c02a5f81ed262a512c65360] # # patch "roster.cc" # from [932a1eaa645faae04e0523ac971c997bcdeacb4f] # to [9cebdc581039f2d117abc2c90c4230b2c9635166] # # patch "tester.cc" # from [da1589e5c3cc77aa51b5658a71b613e6b1ec64db] # to [144b85b2298949c9bbc303644bf972c36fd80c26] # # patch "tests/automate_inventory_ignore_dirs/__driver__.lua" # from [96a76f43b12f8d6113c7ce0f43a4fc473bf042c3] # to [6233a5c18211c0718b96af2800b393076a7585ae] # # patch "tests/automate_inventory_ignore_dirs/expected.stderr" # from [41fc6d7fb22c6a3040b0ba0c7708be080a4a8716] # to [5a2123381f2129c6ea4b4a2646a35da60663d635] # # patch "tests/automate_inventory_ignore_dirs/local_hooks.lua" # from [e6cf0fd64140311801fb6ecc380cdeb7dfd3e1ac] # to [1fcc22bbcc34898a69aaafcdeec3c06bf69c152f] # ============================================================ --- tests/automate_inventory_ignore_dirs/expected_2.stderr 139fa2659365d1899a757ff8ef6191e6263064fe +++ tests/automate_inventory_ignore_dirs/expected_2.stderr 139fa2659365d1899a757ff8ef6191e6263064fe @@ -0,0 +1,6 @@ +ignore_file: 'keys': false +ignore_file: 'source': false +ignore_file: 'source/ignored_dir': true +ignore_file: 'source/ignored_1': true +ignore_file: 'source/ignored_dir/oops': true +mtn: warning: 'source/ignored_dir/oops' is both known and ignored; it will be shown as 'missing'. Check .mtn-ignore. ============================================================ --- tests/automate_inventory_ignore_dirs/expected_2.stdout cd896018adbe95b59dd286c8f78080bb99073af7 +++ tests/automate_inventory_ignore_dirs/expected_2.stdout cd896018adbe95b59dd286c8f78080bb99073af7 @@ -0,0 +1,31 @@ + path "source" +new_type "directory" + fs_type "directory" + status "added" "known" + + path "source/ignored_1" +fs_type "file" + status "ignored" + + path "source/ignored_dir" +new_type "directory" + fs_type "directory" + status "added" "known" + + path "source/ignored_dir/oops" +new_type "file" + fs_type "none" + status "added" "missing" + changes "content" + + path "source/source_1" +new_type "file" + fs_type "file" + status "added" "known" + changes "content" + + path "source/source_2" +new_type "file" + fs_type "file" + status "added" "known" + changes "content" ============================================================ --- HACKING b05dd82114101d138b4d85bd2cb401f8e9c98572 +++ HACKING a94eadea2457641d2d23ddd8dab732b207197bfb @@ -31,7 +31,7 @@ The appropriate astyle options are: The appropriate astyle options are: -astyle --style=gnu -s2 -p +astyle --style=gnu -s2 -p monotone's source includes a number of third party libraries. These have been imported from upstream, and should retain the original coding style of @@ -283,7 +283,7 @@ have a convention for their position and Because many functions take some of these objects as arguments, we have a convention for their position and order: all such arguments -appear first within the overall argument list, and in the order of +appear first within the overall argument list, and in the order of the list below. * "app_state" is being phased out; it used to be an umbrella object @@ -302,6 +302,9 @@ the list below. appear in function arguments. Instead, pass down specific fields that are relevant to the lower-level code. + * When adding new options, separate words with dash "-" not + underscore "_"; dash is easier to type. + * "lua_hooks" holds the Lua interpreter handle and all the associated state, in particular all the hook functions that the user may override. It is, unfortunately, not possible to pass around single ============================================================ --- automate.cc bdfc6fb15de61d76c2401161b5918a2e31d58f8a +++ automate.cc 43388fabb98737e3183612523d7f4a76d0d20427 @@ -17,7 +17,7 @@ #include #include -#include +#include "lexical_cast.hh" #include #include "app_state.hh" @@ -880,7 +880,17 @@ inventory_determine_states(workspace & w if (item.fs_type == path::nonexistent) { if (item.new_node.exists) - states.push_back("missing"); + { + states.push_back("missing"); + + // If this node is in a directory that is ignored in .mtn-ignore, + // we will output this warning. Note that we don't detect a known + // file that is ignored but not in an ignored directory. + if (work.ignore_file(fs_path)) + W(F("'%s' is both known and ignored; " + "it will be shown as 'missing'. Check .mtn-ignore.") + % fs_path); + } } else // exists on filesystem { ============================================================ --- database.cc 9e10e5d55233691379b3c4855ff77de8aced5ada +++ database.cc 0e55fc85ea2dfec7e34ed8de385881c60ea4316f @@ -2162,7 +2162,7 @@ database::get_common_ancestors(std::set< { set ancestors, all_common_ancestors; vector frontier; - for (set::const_iterator i = revs.begin(); + for (set::const_iterator i = revs.begin(); i != revs.end(); ++i) { I(revision_exists(*i)); @@ -2199,7 +2199,7 @@ database::get_common_ancestors(std::set< all_common_ancestors = common; } } - + for (set::const_iterator i = all_common_ancestors.begin(); i != all_common_ancestors.end(); ++i) { @@ -2357,7 +2357,7 @@ database::put_revision(revision_id const I(rev.made_for == made_for_database); rev.check_sane(); - // Phase 1: confirm the revision makes sense, and we the required files + // Phase 1: confirm the revision makes sense, and the required files // actually exist for (edge_map::const_iterator i = rev.edges.begin(); i != rev.edges.end(); ++i) ============================================================ --- luaext_parse_basic_io.cc e0dd6eaf52ad9523b67eae29bf67b26afd09f628 +++ luaext_parse_basic_io.cc 1e504c774c37a0a8b924146bf4c8b972d2134ff4 @@ -11,6 +11,9 @@ LUAEXT(parse_basic_io, ) LUAEXT(parse_basic_io, ) { + // This has no notion of a 'stanza'. It assumes a 'line' is a symbol + // followed by one or more string or hex values. It returns a table of + // lines. vector > > res; const string str(luaL_checkstring(L, -1), lua_strlen(L, -1)); basic_io::input_source in(str, "monotone_parse_basic_io_for_lua"); ============================================================ --- monotone.texi a8cd250cd2d04d8be45a74e15dc3164f9ceee921 +++ monotone.texi 2b13a4dfe71e19312c85b10086c0adf5f38e19d5 @@ -7140,6 +7140,10 @@ @section Automation @var{path} has been deleted in the workspace, but still exists in the revision manifest. +A file will also be labeled @option{missing} if it is in a directory +that is ignored due to a regular expression in @file{.mtn-ignore}, but +is also in the revision manifest. A warning is issued in this case. + @item ignored @var{path} is ignored by monotone. ============================================================ --- options_list.hh 78fbe7c5728513ee672b75d6dcefbc2f508ba915 +++ options_list.hh cd0ff5a0d051b4644c02a5f81ed262a512c65360 @@ -12,7 +12,7 @@ * 'options::opts::name'. * * OPTSET_REL(parent, child) - * Declare a relationship between to optsets, so that if the parent + * Declare a relationship between two optsets, so that if the parent * is reset or allowed for a command the child will also be. * * OPTVAR(optset, type, name, default) ============================================================ --- roster.cc 932a1eaa645faae04e0523ac971c997bcdeacb4f +++ roster.cc 9cebdc581039f2d117abc2c90c4230b2c9635166 @@ -2796,7 +2796,7 @@ void calculate_ident(roster_t const & ro #include "roster_delta.hh" #include -#include +#include "lexical_cast.hh" using std::logic_error; using std::search; ============================================================ --- tester.cc da1589e5c3cc77aa51b5658a71b613e6b1ec64db +++ tester.cc 144b85b2298949c9bbc303644bf972c36fd80c26 @@ -8,7 +8,7 @@ #include "sanity.hh" #include "botan/botan.h" #include "botan_pipe_cache.hh" -#include +#include "lexical_cast.hh" #include #ifdef WIN32 ============================================================ --- tests/automate_inventory_ignore_dirs/__driver__.lua 96a76f43b12f8d6113c7ce0f43a4fc473bf042c3 +++ tests/automate_inventory_ignore_dirs/__driver__.lua 6233a5c18211c0718b96af2800b393076a7585ae @@ -13,7 +13,7 @@ function sortContentsByLine(input) end table.insert(lines, string.sub(input, theStart)) table.sort(lines) - + local len = table.getn(lines) local output = lines[1] for i = 2, len do @@ -25,8 +25,6 @@ check(get("local_hooks.lua")) mtn_setup() check(get("local_hooks.lua")) -check(get("expected.stderr")) -check(get("expected.stdout")) include ("common/test_utils_inventory.lua") @@ -45,14 +43,29 @@ writefile ("source/ignored_dir/file_2", writefile ("source/ignored_dir/file_1", "ignored file 1") writefile ("source/ignored_dir/file_2", "ignored file 2") -check(mtn("automate", "inventory", "--rcfile=local_hooks.lua", "source"), 0, true, false) - +check(mtn("automate", "inventory", "--rcfile=local_hooks.lua", "source"), 0, true, true) canonicalize("stdout") -canonicalize("ts-stderr") +canonicalize("stderr") +check(get("expected.stdout")) check (readfile("expected.stdout") == readfile("stdout")) -check (sortContentsByLine(readfile("expected.stderr")) == sortContentsByLine(readfile("ts-stderr"))) +check(get("expected.stderr")) +check (sortContentsByLine(readfile("expected.stderr")) == sortContentsByLine(readfile("stderr"))) +-- However, if we then add a file in the ignored directory, it will +-- be reported as 'missing'. So we output a warning for this. +addfile("source/ignored_dir/oops", "commited ignored file!") + +check(mtn("automate", "inventory", "--rcfile=local_hooks.lua", "source"), 0, true, true) +canonicalize("stdout") +canonicalize("stderr") + +check(get("expected_2.stdout")) +check (readfile("expected_2.stdout") == readfile("stdout")) + +check(get("expected_2.stderr")) +check (sortContentsByLine(readfile("expected_2.stderr")) == sortContentsByLine(readfile("stderr"))) + -- end of file ============================================================ --- tests/automate_inventory_ignore_dirs/expected.stderr 41fc6d7fb22c6a3040b0ba0c7708be080a4a8716 +++ tests/automate_inventory_ignore_dirs/expected.stderr 5a2123381f2129c6ea4b4a2646a35da60663d635 @@ -1,5 +1,5 @@ -ignore_file: 'keys': -ignore_file: 'source': -ignore_file: 'source/ignored_dir': -ignore_file: 'source/ignored_1': -ignore_file: 'source/ignored_dir': +ignore_file: 'keys': false +ignore_file: 'source': false +ignore_file: 'source/ignored_dir': true +ignore_file: 'source/ignored_1': true +ignore_file: 'source/ignored_dir': true ============================================================ --- tests/automate_inventory_ignore_dirs/local_hooks.lua e6cf0fd64140311801fb6ecc380cdeb7dfd3e1ac +++ tests/automate_inventory_ignore_dirs/local_hooks.lua 1fcc22bbcc34898a69aaafcdeec3c06bf69c152f @@ -1,7 +1,15 @@ function ignore_file(name) function ignore_file(name) - io.stderr:write("ignore_file: '" .. name .. "':\n") + local result = false; + io.stderr:write("ignore_file: '" .. name .. "':") - if (name == "source/ignored_dir") then return true end - if (name == "source/ignored_1") then return true end - return false + if (name == "source/ignored_dir") then result = true end + if (name == "source/ignored_dir/oops") then result = true end + if (name == "source/ignored_1") then result = true end + + if result then + io.stderr:write(" true\n") + else + io.stderr:write(" false\n") + end + return result end