# # # patch "ChangeLog" # from [fd4a4aebed76c09d3cde57ac8c3656e5b3eb8e23] # to [9d8422bd809fb902310f86cddb12359cd1e2932b] # # patch "automate.cc" # from [4255b14ad2e82300f70b1f65ed602b3f43d7e7bb] # to [d84bcc2a3343891d6702ac80c8c00672aea6037b] # # patch "tests/automate_inventory/__driver__.lua" # from [4b1d3ecdabb21c35cb2d8cb6ae8847efab6d3852] # to [21d9c672d0dc7c25066da114ac100a25060e6838] # # patch "work.cc" # from [95c5685d05ca64884882a7653f75a0bbff65f587] # to [a2c77eaa2a690c6e1325a39a789f1fe890e1deda] # ============================================================ --- ChangeLog fd4a4aebed76c09d3cde57ac8c3656e5b3eb8e23 +++ ChangeLog 9d8422bd809fb902310f86cddb12359cd1e2932b @@ -1,5 +1,13 @@ 2006-12-14 Thomas Keller + * work.cc: handle missing directories properly in + classify_roster_paths + * automate.cc: trailing slash also for missing directories + * tests/...: adapted automate_inventory test which now tests + for unknown, added (but missing) and dropped (uncommitted) dirs + +2006-12-14 Thomas Keller + * POTFILES.in: added missing restrictions.cc * restrictions.cc: pluralized "%d missing paths" ============================================================ --- automate.cc 4255b14ad2e82300f70b1f65ed602b3f43d7e7bb +++ automate.cc d84bcc2a3343891d6702ac80c8c00672aea6037b @@ -770,14 +770,21 @@ AUTOMATE(inventory, "", options::opts::n string path_suffix; + // ensure that directory nodes always get a trailing slash even + // if they're missing from the workspace or have been deleted + // but skip the root node which do not get this trailing slash appended if (curr.has_node(i->first)) { - // Explicitly skip the root dir for now. The trailing / dir - // format isn't going to work here. node_t n = curr.get_node(i->first); if (is_root_dir_t(n)) continue; if (is_dir_t(n)) path_suffix = "/"; } + else if (base.has_node(i->first)) + { + node_t n = base.get_node(i->first); + if (is_root_dir_t(n)) continue; + if (is_dir_t(n)) path_suffix = "/"; + } else if (directory_exists(file_path(i->first))) { path_suffix = "/"; ============================================================ --- tests/automate_inventory/__driver__.lua 4b1d3ecdabb21c35cb2d8cb6ae8847efab6d3852 +++ tests/automate_inventory/__driver__.lua 21d9c672d0dc7c25066da114ac100a25060e6838 @@ -150,4 +150,28 @@ check(grep('^ RP 0 1 renamed$', "stdout" check(grep('^R 1 0 original$', "stdout"), 0, false, false) check(grep('^ RP 0 1 renamed$', "stdout"), 0, false, false) +-- check if unknown/missing/dropped directories are recognized as such + +mkdir("new_dir") +check(mtn("automate", "inventory", "--rcfile=inventory_hooks.lua"), 0, true, false) +check(grep('^ U 0 0 new_dir\/$', "stdout"), 0, false, false) + +check(mtn("add", "new_dir"), 0, false, false) +remove("new_dir"); + +check(mtn("automate", "inventory", "--rcfile=inventory_hooks.lua"), 0, true, false) +check(grep('^ AM 0 0 new_dir\/$', "stdout"), 0, false, false) + +mkdir("new_dir") +commit() + +check(mtn("automate", "inventory", "--rcfile=inventory_hooks.lua"), 0, true, false) +check(grep('^ 0 0 new_dir\/$', "stdout"), 0, false, false) + +remove("new_dir") +check(mtn("drop", "new_dir"), 0, false, false) + +check(mtn("automate", "inventory", "--rcfile=inventory_hooks.lua"), 0, true, false) +check(grep('^D 0 0 new_dir\/$', "stdout"), 0, false, false) + +-- some tests for renaming directories are still missing here! --- need tests for deleted and renamed directories, once these actually work! ============================================================ --- work.cc 95c5685d05ca64884882a7653f75a0bbff65f587 +++ work.cc a2c77eaa2a690c6e1325a39a789f1fe890e1deda @@ -901,7 +901,10 @@ workspace::classify_roster_paths(roster_ if (is_dir_t(node) || inodeprint_unchanged(ipm, fp)) { // dirs don't have content changes - unchanged.insert(sp); + if (directory_exists(fp)) + unchanged.insert(sp); + else + missing.insert(sp); } else {