# # # delete "m4/ax_create_stdint_h.m4" # # patch "automate.cc" # from [34994e5d2af05d4eef2ec546a443468de7b795dc] # to [52489d19dd4c75dae696c3e52859b480298d3900] # # patch "monotone.texi" # from [c425c814c2f46ef1996348a9626fcf13037f05f4] # to [785bdd5d6f359a68cd7de8c9fbf5a0362297f3b3] # # patch "tests/automate_inventory_path/__driver__.lua" # from [f36dc66d268bbcdf72cfec59864c31a50bc0b204] # to [f797cc043c33af87380b306cb7af71ad41756d81] # # patch "tests/test_utils_inventory.lua" # from [3968aeff9767239a46661682c5a96db9d1a3f6e7] # to [fa05a01424195cd1b145f6e564d161fd1446ae5d] # ============================================================ --- automate.cc 34994e5d2af05d4eef2ec546a443468de7b795dc +++ automate.cc 52489d19dd4c75dae696c3e52859b480298d3900 @@ -1,4 +1,4 @@ -// Copyright (C) 2004 Nathaniel Smith +// Copyright (C) 2004, 2007 Nathaniel Smith // // This program is made available under the GNU GPL version 2.0 or // greater. See the accompanying file COPYING for details. @@ -710,7 +710,24 @@ CMD_AUTOMATE(inventory, N_("[PATH]...") { basic_io::stanza st; inventory_item const & item = i->second; + std::vector states; + if (i->first.as_internal() == "") + { + // This is the workspace root directory. The default algorithm + // displays it wrong, so we treat is as a special case. + + st.push_str_pair(syms::path, "."); + st.push_str_pair(syms::old_type, "directory"); + st.push_str_pair(syms::new_type, "directory"); + st.push_str_pair(syms::fs_type, "directory"); + states.push_back("known"); + st.push_str_multi(syms::status, states); + pr.print_stanza(st); + continue; + } + + // Not the root directory st.push_file_pair(syms::path, i->first); if (item.old_node.exists) @@ -746,8 +763,6 @@ CMD_AUTOMATE(inventory, N_("[PATH]...") case path::nonexistent: st.push_str_pair(syms::fs_type, "none"); break; } - std::vector states; - if (item.old_node.exists && !item.new_node.exists) { if (item.new_path.as_internal().length() > 0) ============================================================ --- monotone.texi c425c814c2f46ef1996348a9626fcf13037f05f4 +++ monotone.texi 785bdd5d6f359a68cd7de8c9fbf5a0362297f3b3 @@ -6252,8 +6252,9 @@ @section Automation @table @strong @item Arguments: -A file path (optional). address@hidden FIXME: what does this mean? +A file path (optional). If present, only show inventory for the given +file. If it is a directory, show inventory for that directory and +sub-directories. @item Added in: ============================================================ --- tests/automate_inventory_path/__driver__.lua f36dc66d268bbcdf72cfec59864c31a50bc0b204 +++ tests/automate_inventory_path/__driver__.lua f797cc043c33af87380b306cb7af71ad41756d81 @@ -33,11 +33,11 @@ index = check_inventory (parsed, index, parsed = parse_basic_io(readfile("stdout")) index = check_inventory (parsed, index, -{ path = "", +{ path = ".", old_type = "directory", new_type = "directory", - fs_type = "none", - status = {"missing"}}) + fs_type = "directory", + status = {"known"}}) index = check_inventory (parsed, index, { path = "dir_a", @@ -84,11 +84,11 @@ index = check_inventory (parsed, index, index = 1 index = check_inventory (parsed, index, -{ path = "", +{ path = ".", old_type = "directory", new_type = "directory", - fs_type = "none", - status = {"missing"}}) + fs_type = "directory", + status = {"known"}}) index = check_inventory (parsed, index, { path = "dir_a", @@ -142,7 +142,7 @@ checkexp ("checked all", #parsed, index- checkexp ("checked all", #parsed, index-1) ---------- --- Rename a file from dir_a to dir_b, bookkeep-only +-- Rename a file from dir_a to dir_b, bookkeep-only; inventory dir_a check(mtn("rename", "--bookkeep-only", "dir_a/file_a", "dir_b/file_a"), 0, true, false) check(mtn("automate", "inventory", "dir_a"), 0, true, false) @@ -156,23 +156,20 @@ index = check_inventory (parsed, index, fs_type = "directory", status = {"known"}}) --- FIXME: currently get this: -index = check_inventory (parsed, index, +index = fail_check_inventory (4, parsed, index, { path = "dir_a/file_a", old_type = "file", + old_path = "dir_a/file_a", + new_type = "file", + new_path = "dir_b/file_a", fs_type = "file", - status = {"dropped", "unknown"}}) + status = {"known", "rename_source"}}) --- Should get this: --- index = check_inventory (parsed, index, --- { path = "dir_a/file_a", --- old_type = "file", --- old_path = "dir_a/file_a", --- new_type = "file", --- new_path = "dir_b/file_a", --- fs_type = "file", --- status = {"known", "renamed"}}) --- end FIXME +-- getting: +-- path "dir_a/file_a" +-- old_type "file" +-- fs_type "file" +-- status "dropped" "unknown" checkexp ("checked all", #parsed, index-1) @@ -187,24 +184,15 @@ index = check_inventory (parsed, index, fs_type = "directory", status = {"known"}}) --- FIXME: currently get this: -index = check_inventory (parsed, index, +index = fail_check_inventory (4, parsed, index, { path = "dir_b/file_a", + old_type = "file", + old_path = "dir_a/file_a", new_type = "file", fs_type = "none", - status = {"added", "missing"}}) + status = {"renamed", "missing"}}) +-- FIXME: not clear that "missing" is the right status here --- should get this: --- index = check_inventory (parsed, index, --- { path = "dir_b/file_a", --- old_type = "file", --- old_path = "dir_a/file_a", --- new_type = "file", --- fs_type = "none", --- status = {"renamed", "missing"}}) --- not clear that "missing" is the right status here --- end FIXME - index = check_inventory (parsed, index, { path = "dir_b/file_b", old_type = "file", @@ -229,23 +217,14 @@ index = check_inventory (parsed, index, fs_type = "directory", status = {"known"}}) --- FIXME: currently get this: -index = check_inventory (parsed, index, +index = fail_check_inventory (4, parsed, index, { path = "dir_a/file_a", old_type = "file", - fs_type = "none", - status = {"dropped"}}) + old_path = "dir_a/file_a", + new_type = "file", + new_path = "dir_b/file_a", + status = {"renamed"}}) --- Should get this: --- index = check_inventory (parsed, index, --- { path = "dir_a/file_a", --- old_type = "file", --- old_path = "dir_a/file_a", --- new_type = "file", --- new_path = "dir_b/file_a", --- status = {"renamed"}}) --- end FIXME - checkexp ("checked all", #parsed, index-1) check(mtn("automate", "inventory", "dir_b"), 0, true, false) @@ -259,24 +238,15 @@ index = check_inventory (parsed, index, fs_type = "directory", status = {"known"}}) --- FIXME: currently get this: -index = check_inventory (parsed, index, +index = fail_check_inventory (4, parsed, index, { path = "dir_b/file_a", + old_type = "file", + old_path = "dir_a/file_a", new_type = "file", - fs_type = "file", - status = {"added", "known"}}) + fs_type = "none", + status = {"renamed", "missing"}}) +-- FIXME: not clear that "missing" is the right status here --- should get this: --- index = check_inventory (parsed, index, --- { path = "dir_b/file_a", --- old_type = "file", --- old_path = "dir_a/file_a", --- new_type = "file", --- fs_type = "none", --- status = {"renamed", "missing"}}) --- not clear that "missing" is the right status here --- end FIXME - index = check_inventory (parsed, index, { path = "dir_b/file_b", old_type = "file", @@ -297,11 +267,11 @@ index = check_inventory (parsed, index, index = 1 index = check_inventory (parsed, index, -{ path = "", +{ path = ".", old_type = "directory", new_type = "directory", - fs_type = "none", - status = {"missing"}}) + fs_type = "directory", + status = {"known"}}) index = check_inventory (parsed, index, { path = "dir_a", @@ -317,22 +287,14 @@ index = check_inventory (parsed, index, fs_type = "directory", status = {"known"}}) --- FIXME: currently get this: -index = check_inventory (parsed, index, +index = fail_check_inventory (4, parsed, index, { path = "file_0", old_type = "file", + old_name = "file_0", + new_type = "file", + new_name = "dir_a/file_0", fs_type = "file", - status = {"dropped", "unknown"}}) --- should get this: --- index = check_inventory (parsed, index, --- { path = "file_0", --- old_type = "file", --- old_name = "file_0" --- new_type = "file", --- new_name = "dir_a/file_0", --- fs_type = "file", --- status = {"renamed"}}) --- end FIXME: + status = {"renamed"}}) -- skip tester-generated files index = index + 3 * 10 @@ -350,11 +312,11 @@ index = check_inventory (parsed, index, index = 1 index = check_inventory (parsed, index, -{ path = "", +{ path = ".", old_type = "directory", new_type = "directory", - fs_type = "none", - status = {"missing"}}) + fs_type = "directory", + status = {"known"}}) index = check_inventory (parsed, index, { path = "dir_a", @@ -370,22 +332,14 @@ index = check_inventory (parsed, index, fs_type = "directory", status = {"known"}}) --- FIXME: currently get this: -index = check_inventory (parsed, index, -{ path = "file_0", +index = fail_check_inventory (4, parsed, index, +{ path = "dir_a/file_0", old_type = "file", - fs_type = "none", - status = {"dropped"}}) --- should get this: --- index = check_inventory (parsed, index, --- { path = "dir_a/file_0", --- old_type = "file", --- old_name = "file_0" --- new_type = "file", --- new_name = "dir_a/file_0", --- fs_type = "file", --- status = {"renamed"}}) --- end FIXME: + old_name = "file_0", + new_type = "file", + new_name = "dir_a/file_0", + fs_type = "file", + status = {"renamed"}}) -- skip tester-generated files index = index + 3 * 10 ============================================================ --- tests/test_utils_inventory.lua 3968aeff9767239a46661682c5a96db9d1a3f6e7 +++ tests/test_utils_inventory.lua fa05a01424195cd1b145f6e564d161fd1446ae5d @@ -43,6 +43,12 @@ end err ("line '" .. line.name .. " " .. line.values .. "' not found") end +function fail_check_inventory (skip, parsed, parsed_index, stanza) +-- Skip this test, since it is currently failing; run rest of current test + + return parsed_index + skip +end -- check_inventory + function check_inventory (parsed, parsed_index, stanza) -- 'stanza' is a table for one stanza -- 'parsed_index' gives the first index for this stanza in 'parsed'