#
# patch "ChangeLog"
# from [fb5848e90c74f3088465ec4d4b77f53270fd996e]
# to [6df523ea0cc82a03ab55190245ab7d2704f8d280]
#
# patch "app_state.cc"
# from [5bc99c87e13eb345e410ce009fcba04f02b4e445]
# to [95b80895c52c4882e33f41e100099b6f7536504d]
#
# patch "app_state.hh"
# from [e28a8f9201d8853d20f11a9885d48b3e8e49af86]
# to [1ef19ce6f39d7218cff11fffb74b4a2c187874c3]
#
# patch "commands.cc"
# from [c8342080295451a7e1679618fabc396f9452f448]
# to [94cd45541a17fdba3a57cf34adcd7747dc1ada50]
#
# patch "monotone.cc"
# from [680736d9faab980e378c6cdd7a95db8a8af5cac3]
# to [d33163fa6269ada5c72e97b3ac6aeb0c51186575]
#
# patch "monotone.texi"
# from [2d8ae6844b99622c75adfcb0ed55e56bdeecd359]
# to [e2d963f7d556623abd609e6511a5a45b026d765b]
#
# patch "options.hh"
# from [daefb56b56cc6796aa40f0756f599078759a645a]
# to [2fb08fad90b5079eb5ab3455037b8a6433e439cb]
#
# patch "tests/t_add.at"
# from [2ffadb8c8146e593d505093a4dc3b1f030ebea90]
# to [81e06f303994a5e11d9a7802c9c1c2700a2aee44]
#
========================================================================
--- ChangeLog fb5848e90c74f3088465ec4d4b77f53270fd996e
+++ ChangeLog 6df523ea0cc82a03ab55190245ab7d2704f8d280
@@ -1,5 +1,16 @@
2005-10-14 Emile Snyder
+ * app_state.{cc,hh}: new 'unknown' class member for --unknown flag.
+ * commands.cc (CMD(add), ls_unknown, find_unknown): use new
+ --unknown flag to add any files in the working copy that monotone
+ doesn't know about (and isn't ignoring).
+ * monotone.cc (coptions, cpp_main): add the --unknown flag handling.
+ * options.hh: add OPT_UNKNOWN.
+ * monotone.texi: document it.
+ * tests/t_add.at: test it.
+
+2005-10-14 Emile Snyder
+
* database.cc (complete): enhance h: and b: to mean "current
branch" (as defined by your working copy) when given empty.
* monotone.texi: document it.
========================================================================
--- app_state.cc 5bc99c87e13eb345e410ce009fcba04f02b4e445
+++ app_state.cc 95b80895c52c4882e33f41e100099b6f7536504d
@@ -38,7 +38,8 @@
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(""), missing(false)
+ use_lca(false), execute(false), bind_address(""), bind_port(""),
+ missing(false), unknown(false)
{
db.set_app(this);
}
========================================================================
--- app_state.hh e28a8f9201d8853d20f11a9885d48b3e8e49af86
+++ app_state.hh 1ef19ce6f39d7218cff11fffb74b4a2c187874c3
@@ -65,6 +65,7 @@
utf8 bind_address;
utf8 bind_port;
bool missing;
+ bool unknown;
========================================================================
--- commands.cc c8342080295451a7e1679618fabc396f9452f448
+++ commands.cc 94cd45541a17fdba3a57cf34adcd7747dc1ada50
@@ -1123,11 +1123,12 @@
}
+static void find_unknown (app_state & app, bool want_ignored, vector const & args, path_set & unknown);
-CMD(add, N_("working copy"), N_("PATH..."),
- N_("add files to working copy"), OPT_NONE)
+CMD(add, N_("working copy"), N_("[PATH]..."),
+ N_("add files to working copy"), OPT_UNKNOWN)
{
- if (args.size() < 1)
+ if (!app.unknown && (args.size() < 1))
throw usage(name);
app.require_working_copy();
@@ -1142,6 +1143,16 @@
for (vector::const_iterator i = args.begin(); i != args.end(); ++i)
paths.push_back(file_path_external(*i));
+ if (app.unknown)
+ {
+ path_set unknown;
+ find_unknown(app, false, args, unknown);
+ paths.insert(paths.end(), unknown.begin(), unknown.end());
+ }
+
+ if (paths.size() == 0)
+ return;
+
build_additions(paths, m_old, app, work);
put_path_rearrangement(work);
@@ -1628,26 +1639,33 @@
}
static void
-ls_unknown (app_state & app, bool want_ignored, vector const & args)
+find_unknown (app_state & app, bool want_ignored, vector const & args, path_set & unknown)
{
- app.require_working_copy();
-
revision_set rev;
manifest_map m_old, m_new;
- path_set known, unknown, ignored;
+ //path_set known, unknown, ignored;
+ path_set known, dummy;
calculate_restricted_revision(app, args, rev, m_old, m_new);
extract_path_set(m_new, known);
- file_itemizer u(app, known, unknown, ignored);
+ path_set &ignoredref = unknown;
+ if (!want_ignored)
+ ignoredref = dummy;
+ file_itemizer u(app, known, unknown, ignoredref);
walk_tree(file_path(), u);
+}
- if (want_ignored)
- for (path_set::const_iterator i = ignored.begin(); i != ignored.end(); ++i)
- cout << *i << endl;
- else
- for (path_set::const_iterator i = unknown.begin(); i != unknown.end(); ++i)
- cout << *i << endl;
+static void
+ls_unknown (app_state & app, bool want_ignored, vector const & args)
+{
+ app.require_working_copy();
+
+ path_set unknown;
+ find_unknown(app, want_ignored, args, unknown);
+
+ for (path_set::const_iterator i = unknown.begin(); i != unknown.end(); ++i)
+ cout << *i << endl;
}
static void
========================================================================
--- monotone.cc 680736d9faab980e378c6cdd7a95db8a8af5cac3
+++ monotone.cc d33163fa6269ada5c72e97b3ac6aeb0c51186575
@@ -71,6 +71,7 @@
{"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},
+ {"unknown", 0, POPT_ARG_NONE, NULL, OPT_UNKNOWN, gettext_noop("perform the operations for unknown files from working directory"), NULL},
{ NULL, 0, 0, NULL, 0, NULL, NULL }
};
@@ -467,6 +468,10 @@
app.missing = true;
break;
+ case OPT_UNKNOWN:
+ app.unknown = true;
+ break;
+
case OPT_HELP:
default:
requested_help = true;
========================================================================
--- monotone.texi 2d8ae6844b99622c75adfcb0ed55e56bdeecd359
+++ monotone.texi e2d963f7d556623abd609e6511a5a45b026d765b
@@ -7144,10 +7144,12 @@
Merge unmerged heads of branch.
@comment TROFF INPUT: .TP
address@hidden @b{add} @i{ [...]}
address@hidden @b{add} @i{[--unknown] [...]}
Add files to working copy. adding a file does not copy it into the
database, merely adds it to the work list. You must @b{commit} your
-changes in order to copy added files to the database.
+changes in order to copy added files to the database. The missing
+flag causes those files that @command{monotone ls unknown} would
+display to be added to the project.
@comment TROFF INPUT: .TP
@item @b{drop} @i{[--missing] [--execute] [...]}
========================================================================
--- options.hh daefb56b56cc6796aa40f0756f599078759a645a
+++ options.hh 2fb08fad90b5079eb5ab3455037b8a6433e439cb
@@ -46,3 +46,4 @@
#define OPT_KEY_DIR 37
#define OPT_BIND 38
#define OPT_MISSING 39
+#define OPT_UNKNOWN 40
========================================================================
--- tests/t_add.at 2ffadb8c8146e593d505093a4dc3b1f030ebea90
+++ tests/t_add.at 81e06f303994a5e11d9a7802c9c1c2700a2aee44
@@ -47,4 +47,46 @@
AT_CHECK(grep file1 stdout, [1], [ignore])
AT_CHECK(grep file2 stdout, [1], [ignore])
+# add --unknown should add any files that ls unknown shows you and not ignored
+
+AT_DATA(file3, [file 3
+])
+#AT_DATA(file4.ignore, [file 4 ignore
+#])
+AT_DATA(dir/file5, [file 5
+])
+AT_DATA(dir/file6.ignore, [file 6
+])
+#AT_DATA(.mt-ignore, [.*\.ignore$
+#])
+
+#AT_CHECK(RAW_MONOTONE ls unkown, [], [stdout], [ignore])
+
+AT_CHECK(MONOTONE add --unknown, [], [ignore], [stderr])
+AT_CHECK(grep 'adding file3' stderr, [0], [ignore])
+#AT_CHECK(grep 'adding file4.ignore' stderr, [1], [ignore])
+AT_CHECK(grep 'adding dir/file5' stderr, [0], [ignore])
+#AT_CHECK(grep 'adding dir/file6.ignore' stderr, [1], [ignore])
+AT_CHECK(grep 'adding test_hooks.lua' stderr, [1], [ignore])
+
+AT_CHECK(MONOTONE status, [], [stdout])
+AT_CHECK(grep file0 stdout, [1], [ignore])
+AT_CHECK(grep file1 stdout, [1], [ignore])
+AT_CHECK(grep file2 stdout, [1], [ignore])
+AT_CHECK(grep file3 stdout, [0], [ignore])
+#AT_CHECK(grep file4 stdout, [1], [ignore])
+AT_CHECK(grep file5 stdout, [0], [ignore])
+#AT_CHECK(grep file6 stdout, [1], [ignore])
+
+AT_CHECK(MONOTONE --branch=testbranch commit --message 'add second set of files', [], [ignore], [ignore])
+
+AT_CHECK(MONOTONE status, [], [stdout])
+AT_CHECK(grep file0 stdout, [1], [ignore])
+AT_CHECK(grep file1 stdout, [1], [ignore])
+AT_CHECK(grep file2 stdout, [1], [ignore])
+AT_CHECK(grep file3 stdout, [1], [ignore])
+#AT_CHECK(grep file4 stdout, [1], [ignore])
+AT_CHECK(grep file5 stdout, [1], [ignore])
+#AT_CHECK(grep file6 stdout, [1], [ignore])
+
AT_CLEANUP