# # # patch "cmd_ws_commit.cc" # from [2961dae76ba27d65381b9d863c5f50a27216ad16] # to [a5f6214c20c9d96fb892e71b2cefab917e47c822] # # patch "tests/undrop/__driver__.lua" # from [6c2c47bac4f86e09bfa3627f75632ee693630041] # to [507aeed4632bf912b27910e933aa10007142d007] # ============================================================ --- cmd_ws_commit.cc 2961dae76ba27d65381b9d863c5f50a27216ad16 +++ cmd_ws_commit.cc a5f6214c20c9d96fb892e71b2cefab917e47c822 @@ -394,6 +394,13 @@ CMD(undrop, "undrop", "", CMD_REF(worksp "Otherwise, it just removes the 'drop' from the manifest."), options::opts::recursive) { + // revert does not use the value of opts::recursive (it doesn't need to); + // we allow it as an option so the user can do: + // + // drop --recursive dir + // (realize mistake) + // undrop --recursive dir + revert(app, args, true); } ============================================================ --- tests/undrop/__driver__.lua 6c2c47bac4f86e09bfa3627f75632ee693630041 +++ tests/undrop/__driver__.lua 507aeed4632bf912b27910e933aa10007142d007 @@ -1,5 +1,5 @@ -- Test 'undrop' command --- fixes bug#13603 +-- fixes bug#13604 mtn_setup() @@ -39,6 +39,38 @@ check(not qgrep("patched unchanged", "s check(qgrep("patched changed", "stdout")) check(not qgrep("patched unchanged", "stdout")) --- FIXME: test recursive, errors +-- recursive option on drop, undrop, with a changed file +mkdir("dir1") +addfile("dir1/file1", "file1") +addfile("dir1/file2", "file2") +writefile("changed", "base") +commit() +writefile("dir1/file1", "file1-changed") +check(mtn("drop", "--recursive", "dir1"), 0, false, true) +check(qgrep("file dir1/file1 changed - it will be dropped but not deleted", "stderr")) +check(qgrep("directory dir1 not empty - it will be dropped but not deleted", "stderr")) +check(qgrep("dropping dir1/file2 from workspace", "stderr")) +check(qgrep("dropping dir1 from workspace", "stderr")) + +check(mtn("undrop", "--recursive", "dir1"), 0, false, true) +check(readfile("dir1/file1")=="file1-changed") +check(readfile("dir1/file2")=="file2") +check(mtn("status"), 0, true, false) +check(qgrep("patched dir1/file1", "stdout")) + +-- recursive option on drop, undrop, with no changed file +writefile("dir1/file1", "file1") + +check(mtn("drop", "--recursive", "dir1"), 0, false, true) +check(qgrep("dropping dir1/file1 from workspace", "stderr")) +check(qgrep("dropping dir1/file2 from workspace", "stderr")) +check(qgrep("dropping dir1 from workspace", "stderr")) + +check(mtn("undrop", "--recursive", "dir1"), 0, false, true) +check(readfile("dir1/file1")=="file1") +check(readfile("dir1/file2")=="file2") +check(mtn("status"), 0, true, false) +check(qgrep("no changes", "stdout")) + -- end of file