# # patch "ChangeLog" # from [bf8a4a75eddeb0270a5b05945234ee5aa2e9ca88] # to [fb8c8e6849048b68e2404d3dd2c4e45c25cac0dd] # # patch "app_state.cc" # from [392734be5cdd5ba62dd214b28aa434e67b678171] # to [3c2702b7ad6fe0a521f34c7cae63d97b33190bd6] # # patch "app_state.hh" # from [d0009cab364bc2ee2fa53170aa4bc61ce16a6f11] # to [433dcbd86d2fe9c42c3dea7f040fb91c46b50181] # # patch "commands.cc" # from [e5ee84935ff22ffd003a051b04b984e94396f709] # to [5734841465849ab57d9882e9b6b52280398f6052] # # patch "contrib/ciabot_monotone.py" # from [83ac80d4e6d7f1825d262e47e1a393bb53d25ab2] # to [0fba88bed29df2383c8a4026def2ef27437c9cc7] # # patch "contrib/monotone-notify.pl" # from [99f37de7919a460c42a3b3eb832f833a94b0197c] # to [b0ebe9e93e319838d32edf8cea8b046b4905982d] # # patch "contrib/monotone.el" # from [f7ef858f9723b8a7630139716b358ed39206ba6d] # to [46193b52a598228308de18d5c68d8305e3f73ff7] # # patch "contrib/monotone.zsh_completion" # from [f3786eacbf920e2d25b3dc2ff00464bc319e2332] # to [b33e733138eb4fcf899d310e0fa4c850f03735f9] # # patch "contrib/mtbrowse.sh" # from [c6010c101cca06bd1442bceb1c0b714f013225fd] # to [ae9d082785ba8b9883a5517cd252e3fd92e3ebb6] # # patch "monotone.cc" # from [c16834cd4c67d32acc773d866596d4a41d26a035] # to [a757a2bc5e96c1020a8fb9a206a4df2ca7571584] # # patch "monotone.texi" # from [1ba82432e678b8b56e6c8546930e30b85c277955] # to [ddaefe4be1b3cac9edef7696e701dd721e7db790] # # patch "options.hh" # from [31fd46bd9a90626226c5d382c34652bfc47b2323] # to [7d6df419138742a4831a9db4a2c4a5b8225e38ba] # # patch "tests/t_log_depth.at" # from [e4c1de5715712b6f980ffc494281ba8ffb5345c2] # to [850fc51a2454f9e2a9a352bed17e9f2e485f13b6] # # patch "tests/t_log_depth_single.at" # from [7c0591b0193c56f1455fe8db3930677122111274] # to [98a2f3d7517c097dafa83024dc6b3b5d2303242c] # # patch "tests/t_options.at" # from [44bc7db4f21ffbb28051d8a3aa7352be6d4108c1] # to [8f287e1d95ccac3832b53bf93723c6727fa6b5f5] # # patch "tests/t_restrictions.at" # from [5a3ee79ac754dc7533a2778b40dbb87b4faff4c1] # to [d3500f6e212de48b798b050de730f4762e378b2e] # --- ChangeLog +++ ChangeLog @@ -1,3 +1,16 @@ +2005-05-28 Joel Reed
+ + * app_state.cc, app_state.hh, commands.cc, monotone.cc, options.h: + add new --depth command, and rename log's --depth to --last + * monotone.texi: update documentation + * tests/t_log_depth.at, tests/t_log_depth_single.at: update + log tests to use --last instead of --depth + * tests/t_options.at, tests/t_restrictions.at: test usage of + --depth for commands using restrictions + * contrib/ciabot_monotone.py, contrib/monotone-notify.pl, + contrib/monotone.el, contrib/monotone.zsh_completion, + contrib/mtbrowse.sh: change all occurences of "depth" to "last" + 2005-05-23 Timothy Brownawell Fix "automate stdio" input/output format according to ML discussion --- app_state.cc +++ app_state.cc @@ -31,7 +31,7 @@ app_state::app_state() : branch_name(""), db(""), stdhooks(true), rcfiles(true), - search_root("/"), depth(-1) + search_root("/"), depth(-1), last(-1) { db.set_app(this); } @@ -177,6 +177,13 @@ L(F("'%s' added to restricted path set\n") % p()); restrictions.insert(p); } + + // if user supplied a depth but provided no paths + // assume current directory + if ((depth != -1) && restrictions.empty()) + { + restrictions.insert(dot); + } } bool @@ -189,18 +196,22 @@ { return true; } - + + bool user_supplied_depth = (depth != -1); + // a path that normalizes to "." means that the restriction has been // essentially cleared (all files are included). rather than be // careful about what goes in to the restricted path set we just // check for this special case here. - if (restrictions.find(dot) != restrictions.end()) + if ((!user_supplied_depth) && restrictions.find(dot) != restrictions.end()) { return true; } fs::path test = mkpath(path()); + long branch_depth = 0; + long max_depth = depth + 1; while (!test.empty()) { @@ -220,9 +231,17 @@ L(F("path '%s' not found in restricted path set; '%s' excluded\n") % test.string() % path()); } + + if (user_supplied_depth && (max_depth == branch_depth)) return false; test = test.branch_path(); + ++branch_depth; } - + + if (user_supplied_depth && (restrictions.find(dot) != restrictions.end())) + { + return (branch_depth <= max_depth); + } + return false; } @@ -294,12 +313,20 @@ void app_state::set_depth(long d) { - N(d > 0, - F("negative or zero depth not allowed\n")); + N(d >= 0, + F("negative depth not allowed\n")); depth = d; } void +app_state::set_last(long l) +{ + N(l > 0, + F("negative or zero last not allowed\n")); + last = l; +} + +void app_state::set_pidfile(utf8 const & p) { pidfile = mkpath(p()); --- app_state.hh +++ app_state.hh @@ -43,6 +43,7 @@ file_path relative_directory; bool found_working_copy; long depth; + long last; fs::path pidfile; void allow_working_copy(); @@ -70,6 +71,7 @@ void set_date(utf8 const & date); void set_author(utf8 const & author); void set_depth(long depth); + void set_last(long last); void set_pidfile(utf8 const & pidfile); void add_revision(utf8 const & selector); --- commands.cc +++ commands.cc @@ -1255,7 +1255,7 @@ } -CMD(status, "informative", "[PATH]...", "show status of working copy", OPT_NONE) +CMD(status, "informative", "[PATH]...", "show status of working copy", OPT_DEPTH) { revision_set rs; manifest_map m_old, m_new; @@ -1705,7 +1705,7 @@ "missing", "show database objects, or the current working copy manifest,\n" "or unknown, intentionally ignored, or missing state files", - OPT_NONE) + OPT_DEPTH) { if (args.size() == 0) throw usage(name); @@ -2232,7 +2232,7 @@ CMD(commit, "working copy", "[PATH]...", "commit working copy to database", - OPT_BRANCH_NAME % OPT_MESSAGE % OPT_MSGFILE % OPT_DATE % OPT_AUTHOR) + OPT_BRANCH_NAME % OPT_MESSAGE % OPT_MSGFILE % OPT_DATE % OPT_AUTHOR % OPT_DEPTH) { string log_message(""); revision_set rs; @@ -2679,7 +2679,7 @@ CMD(diff, "informative", "[--revision=REVISION [--revision=REVISION]] [PATH]...", "show current unified diffs on stdout", - OPT_BRANCH_NAME % OPT_REVISION) + OPT_BRANCH_NAME % OPT_REVISION % OPT_DEPTH) { do_diff(name, app, args, unified_diff); } @@ -3310,7 +3310,7 @@ CMD(revert, "working copy", "[PATH]...", - "revert file(s), dir(s) or entire working copy", OPT_NONE) + "revert file(s), dir(s) or entire working copy", OPT_DEPTH) { manifest_map m_old; revision_id old_revision_id; @@ -3488,7 +3488,7 @@ CMD(log, "informative", "[file] [--revision=REVISION [--revision=REVISION [...]]]", "print history in reverse order (filtering by 'file'). If one or more revisions\n" "are given, use them as a starting point.", - OPT_DEPTH % OPT_REVISION % OPT_BRIEF) + OPT_LAST % OPT_REVISION % OPT_BRIEF) { file_path file; @@ -3527,10 +3527,10 @@ cert_name comment_name(comment_cert_name); set