#
# patch "ChangeLog"
# from [ee91d46179bc8840666957153affde72c853e587]
# to [6f56a0eef7a9d00b2e300b92be8507a894285c29]
#
# patch "app_state.cc"
# from [7fb51954421323439c2f12876ed81b71e7eaf634]
# to [5bc99c87e13eb345e410ce009fcba04f02b4e445]
#
# patch "app_state.hh"
# from [2ec009494567db9c8b00030a7bf18e089ba5195a]
# to [e28a8f9201d8853d20f11a9885d48b3e8e49af86]
#
# patch "commands.cc"
# from [a88a358ca82a243cdf894c906e39d1dd04f7af7c]
# to [ab102f3d6e50d2a96a1f53358114a3b993adcf4d]
#
# patch "monotone.cc"
# from [84917aadd0dde082ea12e1e9e848576841e3f247]
# to [680736d9faab980e378c6cdd7a95db8a8af5cac3]
#
# patch "monotone.texi"
# from [ad41028e3431d1b52cf14e03eb22d73e54fbab24]
# to [043ea0030fb5d5b3cdab0ff487a39ae06c8a731a]
#
# patch "options.hh"
# from [e2be96021f06d474833fcb306e5a7cfea37ce52a]
# to [daefb56b56cc6796aa40f0756f599078759a645a]
#
# patch "tests/t_drop_missing.at"
# from [8d6e97afdf06c47331b40bd01953b1e097c5a30e]
# to [76df22384469606ea77735754609229018a6f6a5]
#
========================================================================
--- ChangeLog ee91d46179bc8840666957153affde72c853e587
+++ ChangeLog 6f56a0eef7a9d00b2e300b92be8507a894285c29
@@ -1,5 +1,15 @@
2005-10-13 Emile Snyder
+ * app_state.{cc,hh}: new missing class member for --missing flag.
+ * commands.cc (CMD(drop), ls_missing, find_missing): use new
+ --missing flag to drop any files already deleted in the working copy.
+ * monotone.cc (coptions, cpp_main): add the --missing flag handling.
+ * options.hh: add OPT_MISSING.
+ * monotone.texi: document it.
+ * tests/t_drop_missing.at: test it.
+
+2005-10-13 Emile Snyder
+
* database.cc (complete): implementation for h:branch selector to
find heads of a branch.
* selectors.{cc,hh}: add sel_head with selector character 'h'.
========================================================================
--- app_state.cc 7fb51954421323439c2f12876ed81b71e7eaf634
+++ app_state.cc 5bc99c87e13eb345e410ce009fcba04f02b4e445
@@ -38,7 +38,7 @@
rcfiles(true), diffs(false),
no_merges(false), set_default(false), verbose(false), search_root("/"),
depth(-1), last(-1), diff_format(unified_diff), diff_args_provided(false),
- use_lca(false), execute(false), bind_address(""), bind_port("")
+ use_lca(false), execute(false), bind_address(""), bind_port(""), missing(false)
{
db.set_app(this);
}
========================================================================
--- app_state.hh 2ec009494567db9c8b00030a7bf18e089ba5195a
+++ app_state.hh e28a8f9201d8853d20f11a9885d48b3e8e49af86
@@ -64,6 +64,7 @@
bool execute;
utf8 bind_address;
utf8 bind_port;
+ bool missing;
========================================================================
--- commands.cc a88a358ca82a243cdf894c906e39d1dd04f7af7c
+++ commands.cc ab102f3d6e50d2a96a1f53358114a3b993adcf4d
@@ -1168,10 +1168,12 @@
update_any_attrs(app);
}
-CMD(drop, N_("working copy"), N_("PATH..."),
- N_("drop files from working copy"), OPT_EXECUTE)
+static void find_missing (app_state & app, vector const & args, path_set & missing);
+
+CMD(drop, N_("working copy"), N_("[PATH]..."),
+ N_("drop files from working copy"), OPT_EXECUTE % OPT_MISSING)
{
- if (args.size() < 1)
+ if (!app.missing && (args.size() < 1))
throw usage(name);
app.require_working_copy();
@@ -1183,6 +1185,13 @@
get_path_rearrangement(work);
vector paths;
+ if (app.missing)
+ {
+ set missing;
+ find_missing(app, args, missing);
+ paths.insert(paths.end(), missing.begin(), missing.end());
+ }
+
for (vector::const_iterator i = args.begin(); i != args.end(); ++i)
paths.push_back(file_path_external(*i));
@@ -1661,7 +1670,7 @@
}
static void
-ls_missing (app_state & app, vector const & args)
+find_missing (app_state & app, vector const & args, path_set & missing)
{
revision_set rev;
revision_id rid;
@@ -1690,10 +1699,22 @@
for (path_set::const_iterator i = new_paths.begin(); i != new_paths.end(); ++i)
{
if (app.restriction_includes(*i) && !path_exists(*i))
- cout << *i << endl;
+ missing.insert(*i);
}
}
+static void
+ls_missing (app_state & app, vector const & args)
+{
+ path_set missing;
+ find_missing(app, args, missing);
+
+ for (path_set::const_iterator i = missing.begin(); i != missing.end(); ++i)
+ {
+ cout << *i << endl;
+ }
+}
+
CMD(list, N_("informative"),
N_("certs ID\n"
"keys [PATTERN]\n"
========================================================================
--- monotone.cc 84917aadd0dde082ea12e1e9e848576841e3f247
+++ monotone.cc 680736d9faab980e378c6cdd7a95db8a8af5cac3
@@ -70,6 +70,7 @@
{"lca", 0, POPT_ARG_NONE, NULL, OPT_LCA, gettext_noop("use least common ancestor as ancestor for merge"), NULL},
{"execute", 'e', POPT_ARG_NONE, NULL, OPT_EXECUTE, gettext_noop("perform the associated file operation"), NULL},
{"bind", 0, POPT_ARG_STRING, &argstr, OPT_BIND, gettext_noop("address:port to listen on (default :5253)"), NULL},
+ {"missing", 0, POPT_ARG_NONE, NULL, OPT_MISSING, gettext_noop("perform the operations for files missing from working directory"), NULL},
{ NULL, 0, 0, NULL, 0, NULL, NULL }
};
@@ -462,6 +463,10 @@
}
break;
+ case OPT_MISSING:
+ app.missing = true;
+ break;
+
case OPT_HELP:
default:
requested_help = true;
========================================================================
--- monotone.texi ad41028e3431d1b52cf14e03eb22d73e54fbab24
+++ monotone.texi 043ea0030fb5d5b3cdab0ff487a39ae06c8a731a
@@ -3289,7 +3289,8 @@
Monotone does not require that you erase a file from the working copy
before you drop it. Dropping a file merely removes its entry in the
-manifest of the current revision.
+manifest of the current revision unless you give it the @command{--execute}
+flag, which tells monotone to go ahead and also remove it from the filesystem.
@heading Viewing History
@@ -3551,7 +3552,10 @@
explicit pathname changes you wish to commit at some future time, such
as addition, removal, or renaming of files. This command also removes
any attributes on @var{pathname}; see @ref{File Attributes} for more
-details.
+details. If you use the --missing flag it will add drop entries for any
+paths that monotone is tracking for which you have already removed the
+files from the filesystem, in addition to all those specified in
address@hidden
While this command places a ``drop'' entry on your work list, it does
not immediately affect your database. When you @command{commit} your
@@ -7135,9 +7139,12 @@
changes in order to copy added files to the database.
@comment TROFF INPUT: .TP
address@hidden @b{drop} @i{ [...]}
address@hidden @b{drop} @i{[--missing] [--execute] [...]}
Drop files from working copy. Files are not deleted from working copy,
-merely noted as removals in the work list.
+merely noted as removals in the work list, unless the --execute flag
+is given. If the --missing flag is given any files that monotone is
+tracking but which are not present in the working copy (ie. the
+output that @command{monotone ls missing} would give) are dropped.
@comment TROFF INPUT: .TP
@item @b{rename} @i{ }
========================================================================
--- options.hh e2be96021f06d474833fcb306e5a7cfea37ce52a
+++ options.hh daefb56b56cc6796aa40f0756f599078759a645a
@@ -45,3 +45,4 @@
#define OPT_EXECUTE 36
#define OPT_KEY_DIR 37
#define OPT_BIND 38
+#define OPT_MISSING 39
========================================================================
--- tests/t_drop_missing.at 8d6e97afdf06c47331b40bd01953b1e097c5a30e
+++ tests/t_drop_missing.at 76df22384469606ea77735754609229018a6f6a5
@@ -6,18 +6,40 @@
AT_DATA(maude, [the file maude
])
+AT_DATA(harold, [the file harold
+])
+AT_CHECK(mkdir places, [0], [ignore])
+AT_DATA(places/cemetery, [the place file cemetery
+])
AT_CHECK(MONOTONE add maude, [], [ignore], [ignore])
+AT_CHECK(MONOTONE add harold, [], [ignore], [ignore])
+AT_CHECK(MONOTONE add places/cemetery, [], [ignore], [ignore])
AT_CHECK(MONOTONE --branch=testbranch commit --message 'committed', [], [ignore], [ignore])
AT_CHECK(rm maude)
+
AT_CHECK(MONOTONE drop maude, [], [ignore], [stderr])
AT_CHECK(grep 'adding maude to working copy delete set' stderr, [0], [ignore])
AT_CHECK(MONOTONE status, [], [stdout])
AT_CHECK(grep maude stdout, [0], [ignore])
+AT_CHECK(grep harold stdout, [1], [ignore])
+AT_CHECK(grep places/cemetery stdout, [1], [ignore])
AT_CHECK(MONOTONE drop foobar, [], [ignore], [stderr])
AT_CHECK(grep 'skipping foobar' stderr, [0], [ignore])
+AT_CHECK(rm harold)
+AT_CHECK(rm places/cemetery)
+
+AT_CHECK(MONOTONE drop --missing, [], [ignore], [stderr])
+AT_CHECK(grep 'adding harold to working copy delete set' stderr, [0], [ignore])
+AT_CHECK(grep 'adding places/cemetery to working copy delete set' stderr, [0], [ignore])
+
+AT_CHECK(MONOTONE status, [], [stdout])
+AT_CHECK(grep maude stdout, [0], [ignore])
+AT_CHECK(grep harold stdout, [0], [ignore])
+AT_CHECK(grep places/cemetery stdout, [0], [ignore])
+
AT_CLEANUP