# # # patch "ChangeLog" # from [59140c16308c0a59a06eec5c27dc4fb1d0e25389] # to [6bf032f4db4d2225bea0a1bfc06dcb6465dd6bdb] # # patch "cmd_ws_commit.cc" # from [55327636b5642956cfee1cd963a8663fee146d83] # to [302e10f1890d72dcaadff9f2bae22fdf70f9cb7f] # # patch "monotone.texi" # from [b89072b90d05f10d52208df461a5908ce9ed89b4] # to [428d5bc4fb9ddce9307d8a7cd0d9381e9888a044] # # patch "testsuite.lua" # from [20856a39779e9b64b52975107c638df0e45b6677] # to [f7195efbd96795a3cb57484cbfb69adf258ef881] # ============================================================ --- ChangeLog 59140c16308c0a59a06eec5c27dc4fb1d0e25389 +++ ChangeLog 6bf032f4db4d2225bea0a1bfc06dcb6465dd6bdb @@ -1,3 +1,10 @@ +2006-12-12 Ben Walton + + * cmd_ws_cc: Added mtn mkdir + * testsuite.lua: added mtn mkdir test + * included tests/mkdir as unit testing for mtn mkdir + * added documentation to monotone.texi + 2006-12-12 Thomas Moschny * HACKING: Updated "Patch submission guidelines" section. ============================================================ --- cmd_ws_commit.cc 55327636b5642956cfee1cd963a8663fee146d83 +++ cmd_ws_commit.cc 302e10f1890d72dcaadff9f2bae22fdf70f9cb7f @@ -261,7 +261,50 @@ CMD(disapprove, N_("review"), N_("REVISI } } +CMD(mkdir, N_("workspace"), N_("[DIRECTORY...]"), + N_("create one or more directories and add them to the workspace"), + options::opts::no_ignore) +{ + if (args.size() < 1) + throw usage(name); + app.require_workspace(); + + path_set paths; + //spin through args and try to ensure that we won't have any collisions + //before doing any real filesystem modification. we'll also verify paths + //against .mtn-ignore here. + for (vector::const_iterator i = args.begin(); + i != args.end(); ++i) + { + split_path sp; + file_path_external(*i).split(sp); + file_path fp(sp); + + require_path_is_nonexistent + (fp, F("directory '%s' already exists") % fp); + + //we'll treat this as a user (fatal) error. it really + //wouldn't make sense to add a dir to .mtn-ignore and then + //try to add it to the project with a mkdir statement, but + //one never can tell... + N(app.opts.no_ignore || !app.lua.hook_ignore_file(fp), + F("ignoring directory '%s' [see .mtn-ignore]") % fp); + + paths.insert(sp); + } + + //this time, since we've verified that there should be no collisions, + //we'll just go ahead and do the filesystem additions. + for (path_set::const_iterator i = paths.begin(); + i != paths.end(); ++i) + { + mkdir_p(file_path(*i)); + } + + app.work.perform_additions(paths, false, true); +} + CMD(add, N_("workspace"), N_("[PATH]..."), N_("add files to workspace"), options::opts::unknown | options::opts::no_ignore | ============================================================ --- monotone.texi b89072b90d05f10d52208df461a5908ce9ed89b4 +++ monotone.texi 428d5bc4fb9ddce9307d8a7cd0d9381e9888a044 @@ -4184,6 +4184,12 @@ @section Workspace which it will then commit to the database. The new revision will have any added entries inserted in its manifest. address@hidden mtn [--no-respect-ignore] mkdir @var{directory...} +This command creates a directory in the filesystem relative to your +current location and adds it to your workspace's ``work list''. The +changes are not reflected in your database until such time as you +perform a commit. If you use the @option{--no-respect-ignore} flag, +entries in .mtn-ignore will not be honoured. @item mtn [--execute] drop @var{pathname...} @itemx mtn drop --missing ============================================================ --- testsuite.lua 20856a39779e9b64b52975107c638df0e45b6677 +++ testsuite.lua f7195efbd96795a3cb57484cbfb69adf258ef881 @@ -694,3 +694,5 @@ table.insert(tests, "log_--to") table.insert(tests, "import") table.insert(tests, "netsync_permissions_wildcards") table.insert(tests, "log_--to") +table.insert(tests, "mkdir") +