# # # patch "contrib/monotone.bash_completion" # from [5aff6649ff0ce10a7a993d891bc0033d23030593] # to [1ec88d4a5ecb6f5f4f87f823f1bd4c594f699695] # # patch "contrib/monotone.zsh_completion" # from [4a73871dee3c19b7d279352e7148f47477e36835] # to [096ddfeacaa27baf509033c410e5ac0a57038a9f] # # patch "database.cc" # from [0bc6ce7bb27323c3724ee95f099985a3abad21f3] # to [8eca8399fd078363772d0e1a5ec38be7a3c1b72f] # # patch "lua-testsuite.lua" # from [897188bb349a0b8e36bf2f8fe7ef2a90f9685a2e] # to [9c66b41808f9ac679e81d29f533917bb8fd01aae] # # patch "option.cc" # from [7cbfe2a7b498d4b39f0509a71ce3573025362a02] # to [e4a87d73a8ca877f18f13e18cf80b33c9417944e] # # patch "option.hh" # from [4b8b3b06e05e716358a3da600f0c0a948104af8c] # to [606da738b3026faa1383b257910c06529979926a] # # patch "options.cc" # from [d43238f99005a8476259c53805b7e1f9bc0cae63] # to [fc13a81ba6b871aa3ab75229d7ac50c529c62eb4] # # patch "options.hh" # from [450b973b246595eb4208a277558279feb309c8b7] # to [b94db10edba0a37126d75b8d6c33f3b1d1cfe08b] # # patch "options_list.hh" # from [d2a0ffef99824aa91354c46c7dbbb20e7cd5f815] # to [77cc993b728e8f32e06a0c95865b0bcf3eb08685] # # patch "tests/default_command_options/__driver__.lua" # from [524306e088768186ee550179e9cd8bebd3b7fec0] # to [16c444951060be89b97c037998f009950b7986ec] # # patch "tests/default_command_options/default_options.lua" # from [c66ceeb9cfcd88be99aa2de5c9d5445e1046a3cc] # to [e5574902b08b2259b7e7c46f0b90e658287b3d3d] # # patch "tests/test_the_version_command/__driver__.lua" # from [6095698f688c9e07c2dfd67bd479300e730735ec] # to [bf200ff06525a9d3b36637bce59e2c7f98382145] # # patch "ui.cc" # from [8b4da1b636b654629b9d54e221825670b5f9a5bd] # to [365fa59977896ae3163362b99a5e8d7028eab25e] # # patch "unit-testsuite.lua" # from [a8fd12b4d50135121bf3e9be6247bd0fbf0ade58] # to [5b4649618e6d2fe244aad44ccb5d88fbb449ce27] # # patch "unix/main.cc" # from [1a4910550eee2b11ff4bc99bec1f9de0d44da81e] # to [9d9d704089170f3fea8bb29bfd099435a2dab26f] # # patch "win32/main.cc" # from [8b14cc20945d524354751fd745044d96cfe69f96] # to [f7225a77eeced7cceca507d02c7c3aaeb86b2bbc] # ============================================================ --- contrib/monotone.bash_completion 5aff6649ff0ce10a7a993d891bc0033d23030593 +++ contrib/monotone.bash_completion 1ec88d4a5ecb6f5f4f87f823f1bd4c594f699695 @@ -130,7 +130,7 @@ _monotone() { --db -d --debug --dump - --full-version + --verbose --help -h --key -k --keydir ============================================================ --- contrib/monotone.zsh_completion 4a73871dee3c19b7d279352e7148f47477e36835 +++ contrib/monotone.zsh_completion 096ddfeacaa27baf509033c410e5ac0a57038a9f @@ -460,7 +460,7 @@ _mtn_version() { (( $+functions[_mtn_version] )) || _mtn_version() { _arguments -s : \ - '--full[print detailed version number]' + '--verbose[print detailed version number]' } # define completion functions for files maintained by monotone. ============================================================ --- database.cc 0bc6ce7bb27323c3724ee95f099985a3abad21f3 +++ database.cc 8eca8399fd078363772d0e1a5ec38be7a3c1b72f @@ -1100,7 +1100,7 @@ database::info(ostream & out, bool analy out << form.str() << '\n'; // final newline is kept out of the translation - // the following analyzation is only done for --full info + // the following analyzation is only done for --verbose info if (!analyze) return; ============================================================ --- lua-testsuite.lua 897188bb349a0b8e36bf2f8fe7ef2a90f9685a2e +++ lua-testsuite.lua 9c66b41808f9ac679e81d29f533917bb8fd01aae @@ -409,14 +409,14 @@ function prepare_to_run_tests (P) writefile_q("in", nil) prepare_redirect("in", "out", "err") - local status = execute(monotone_path, "version", "--full") + local status = execute(monotone_path, "version", "--verbose") local out = readfile_q("out") local err = readfile_q("err") if status == 0 and err == "" and out ~= "" then logfile:write(out) else - P(string.format("mtn version --full: exit %d\nstdout:\n", status)) + P(string.format("mtn version --verbose: exit %d\nstdout:\n", status)) P(out) P("stderr:\n") P(err) ============================================================ --- option.cc 7cbfe2a7b498d4b39f0509a71ce3573025362a02 +++ option.cc e4a87d73a8ca877f18f13e18cf80b33c9417944e @@ -89,7 +89,9 @@ concrete_option::concrete_option(char co char const * desc, bool arg, boost::function set, - boost::function reset) + boost::function reset, + bool hide, + char const * deprecate) { description = desc; splitname(names, longname, shortname, cancelname); @@ -101,6 +103,8 @@ concrete_option::concrete_option(char co has_arg = arg; setter = set; resetter = reset; + hidden = hide; + deprecated = deprecate; } bool concrete_option::operator<(concrete_option const & other) const @@ -148,9 +152,12 @@ concrete_option_set::operator()(char con concrete_option_set::operator()(char const * names, char const * desc, boost::function set, - boost::function reset) + boost::function reset, + bool hide, + char const * deprecate) { - options.insert(concrete_option(names, desc, false, discard_argument(set), reset)); + options.insert(concrete_option(names, desc, false, discard_argument(set), + reset, hide, deprecate)); return *this; } @@ -158,9 +165,11 @@ concrete_option_set::operator()(char con concrete_option_set::operator()(char const * names, char const * desc, boost::function set, - boost::function reset) + boost::function reset, + bool hide, + char const * deprecate) { - options.insert(concrete_option(names, desc, true, set, reset)); + options.insert(concrete_option(names, desc, true, set, reset, hide, deprecate)); return *this; } @@ -391,6 +400,8 @@ void concrete_option_set::from_command_l ++i; try { + if (o.deprecated) + W(F("deprated option '%s' used: %s") % name % gettext(o.deprecated)); if (!is_cancel) { if (o.setter) @@ -431,6 +442,8 @@ void concrete_option_set::from_key_value try { + if (o.deprecated) + W(F("deprated option '%s' used: %s") % i->first % gettext(o.deprecated)); if (o.setter) o.setter(value()); } @@ -481,7 +494,8 @@ concrete_option_set::get_usage_strings(v void concrete_option_set::get_usage_strings(vector & names, vector & descriptions, - unsigned int & maxnamelen) const + unsigned int & maxnamelen, + bool show_hidden) const { unsigned int namelen = 0; // the longest option name string names.clear(); @@ -489,6 +503,10 @@ concrete_option_set::get_usage_strings(v for (std::set::const_iterator i = options.begin(); i != options.end(); ++i) { + if (i->hidden && !show_hidden) + continue; + if (i->deprecated) + continue; string name = usagestr(*i); if (name.size() > namelen) namelen = name.size(); ============================================================ --- option.hh 4b8b3b06e05e716358a3da600f0c0a948104af8c +++ option.hh 606da738b3026faa1383b257910c06529979926a @@ -90,13 +90,17 @@ namespace option { bool has_arg; boost::function setter; boost::function resetter; + bool hidden; + char const * deprecated; concrete_option(); concrete_option(char const * names, char const * desc, bool arg, boost::function set, - boost::function reset); + boost::function reset, + bool hide = false, + char const * deprecate = 0); bool operator<(concrete_option const & other) const; }; @@ -116,18 +120,24 @@ namespace option { operator()(char const * names, char const * desc, boost::function set, - boost::function reset = 0); + boost::function reset = 0, + bool hide = false, + char const * deprecate = 0); concrete_option_set & operator()(char const * names, char const * desc, boost::function set, - boost::function reset = 0); + boost::function reset = 0, + bool hide = false, + char const * deprecate = 0); concrete_option_set operator | (concrete_option_set const & other) const; void reset() const; void get_usage_strings(std::vector & names, std::vector & descriptions, - unsigned int & maxnamelen) const; + unsigned int & maxnamelen, + bool show_hidden + /*no way to see deprecated*/) const; void from_command_line(args_vector & args, bool allow_xargs = true); void from_command_line(int argc, char const * const * argv); void from_key_value_pairs(std::vector > const & keyvals); @@ -228,12 +238,16 @@ namespace option { bool has_arg; boost::function setter; boost::function resetter; + bool hidden; + char const * deprecated; option(char const * name, char const * desc, bool arg, void(T::*set)(std::string), - void(T::*reset)()) + void(T::*reset)(), + bool hide, + char const * deprecate) { I((name && name[0]) || (desc && desc[0])); description = desc; @@ -241,6 +255,8 @@ namespace option { has_arg = arg; setter = set; resetter = reset; + hidden = hide; + deprecated = deprecate; } concrete_option instantiate(T * obj) const @@ -254,6 +270,10 @@ namespace option { out.setter = std::bind1st(setter, obj); if (resetter) out.resetter = binder_only(resetter, obj); + + out.hidden = hidden; + out.deprecated = deprecated; + return out; } @@ -284,9 +304,11 @@ namespace option { char const * desc, bool arg, void(T::*set)(std::string), - void(T::*reset)()) + void(T::*reset)(), + bool hidden = false, + char const * deprecated = 0) { - options.insert(option(name, desc, arg, set, reset)); + options.insert(option(name, desc, arg, set, reset, hidden, deprecated)); } concrete_option_set instantiate(T * obj) const { ============================================================ --- options.cc d43238f99005a8476259c53805b7e1f9bc0cae63 +++ options.cc fc13a81ba6b871aa3ab75229d7ac50c529c62eb4 @@ -46,6 +46,8 @@ options::children() val[&options::opts::all_options].insert(&options::opts::name ## _opt); # define OPTSET_REL(parent, child) \ val[&options::opts:: parent].insert(&options::opts:: child); +# define HIDE(option) +# define DEPRECATE(option, reason) # include "options_list.hh" @@ -53,6 +55,8 @@ options::children() # undef OPTVAR # undef OPTION # undef OPTSET_REL +# undef HIDE +# undef DEPRECATE first = false; } @@ -71,6 +75,8 @@ options::var_membership() val[&opts:: optset ].push_back(&options::reset_ ## name ); # define OPTION(optset, name, hasarg, optstring, description) # define OPTSET_REL(parent, child) +# define HIDE(option) +# define DEPRECATE(option, reason) # include "options_list.hh" @@ -78,13 +84,71 @@ options::var_membership() # undef OPTVAR # undef OPTION # undef OPTSET_REL +# undef HIDE +# undef DEPRECATE first = false; } return val; } +std::map & +options::hidden() +{ + static map val; + static bool first(true); + if (first) + { +# define OPTSET(name) +# define OPTVAR(optset, type, name, default_) +# define OPTION(optset, name, hasarg, optstring, description) +# define OPTSET_REL(parent, child) +# define HIDE(option) \ + val[&opts:: option ## _opt ] = true; +# define DEPRECATE(option, reason) +# include "options_list.hh" + +# undef OPTSET +# undef OPTVAR +# undef OPTION +# undef OPTSET_REL +# undef HIDE +# undef DEPRECATE + first = false; + } + return val; +} + +std::map & +options::deprecated() +{ + static map val; + static bool first(true); + if (first) + { +# define OPTSET(name) +# define OPTVAR(optset, type, name, default_) +# define OPTION(optset, name, hasarg, optstring, description) +# define OPTSET_REL(parent, child) +# define HIDE(option) +# define DEPRECATE(option, reason) \ + val[&opts:: option ## _opt ] = reason ; + +# include "options_list.hh" + +# undef OPTSET +# undef OPTVAR +# undef OPTION +# undef OPTSET_REL +# undef HIDE +# undef DEPRECATE + first = false; + } + return val; +} + + options::options() { # define OPTSET(name) @@ -93,6 +157,8 @@ options::options() # define OPTION(optset, name, hasarg, optstring, description) \ name ## _given = false; # define OPTSET_REL(parent, child) +# define HIDE(option) +# define DEPRECATE(option, reason) # include "options_list.hh" @@ -100,6 +166,8 @@ options::options() # undef OPTVAR # undef OPTION # undef OPTSET_REL +# undef HIDE +# undef DEPRECATE } const options & @@ -111,6 +179,8 @@ options::operator = (options const & oth # define OPTION(optset, name, hasarg, optstring, description) \ name ## _given = other.name ## _given; # define OPTSET_REL(parent, child) +# define HIDE(option) +# define DEPRECATE(option, reason) # include "options_list.hh" @@ -118,6 +188,8 @@ options::operator = (options const & oth # undef OPTVAR # undef OPTION # undef OPTSET_REL +# undef HIDE +# undef DEPRECATE return *this; } @@ -164,7 +236,8 @@ options::options_type const & options::o static options::options_type val = \ collect_children(&options::opts::name) \ | options::option_type("", #name, false, 0, \ - &options::reset_optset_ ## name ); \ + &options::reset_optset_ ## name , \ + true, 0); \ return val; \ } \ void options::reset_optset_ ## name () \ @@ -184,7 +257,9 @@ options::options_type const & options::o static options::options_type val(optstring, \ description, hasarg, \ &options::set_ ## name , \ - &options::reset_opt_ ## name ); \ + &options::reset_opt_ ## name , \ + hidden()[&opts:: name ## _opt], \ + deprecated()[&opts:: name ## _opt]); \ return val; \ } \ void options::reset_opt_ ## name () \ @@ -200,6 +275,8 @@ options::options_type const & options::o void options::real_set_ ## name (std::string arg) # define OPTSET_REL(parent, child) +# define HIDE(option) +# define DEPRECATE(option, reason) #define option_bodies # include "options_list.hh" @@ -209,6 +286,8 @@ options::options_type const & options::o # undef OPTVAR # undef OPTION # undef OPTSET_REL +# undef HIDE +# undef DEPRECATE option::option_set operator | (option::option_set const & opts, ============================================================ --- options.hh 450b973b246595eb4208a277558279feb309c8b7 +++ options.hh b94db10edba0a37126d75b8d6c33f3b1d1cfe08b @@ -35,6 +35,8 @@ struct options static std::map > &children(); static std::map > &var_membership(); + static std::map &hidden(); + static std::map &deprecated(); void reset_optset(static_options_fun opt); @@ -51,6 +53,8 @@ struct options static options_type const & name ## _opt (); # define OPTSET_REL(parent, child) +# define HIDE(option) +# define DEPRECATE(option, reason) # include "options_list.hh" @@ -58,6 +62,8 @@ struct options # undef OPTVAR # undef OPTION # undef OPTSET_REL +# undef HIDE +# undef DEPRECATE }; # define OPTSET(name) \ @@ -78,6 +84,8 @@ private: void reset_opt_ ## name (); # define OPTSET_REL(parent, child) +# define HIDE(option) +# define DEPRECATE(option, reason) # include "options_list.hh" @@ -85,6 +93,8 @@ private: # undef OPTVAR # undef OPTION # undef OPTSET_REL +# undef HIDE +# undef DEPRECATE }; option::option_set ============================================================ --- options_list.hh d2a0ffef99824aa91354c46c7dbbb20e7cd5f815 +++ options_list.hh 77cc993b728e8f32e06a0c95865b0bcf3eb08685 @@ -303,6 +303,7 @@ GOPT(dbname, "db,d", system_path, , gett } #endif +HIDE(roster_cache_performance_log) GLOBAL_SIMPLE_OPTION(roster_cache_performance_log, "roster-cache-performance-log", system_path, gettext_noop("log roster cache statistic to the given file")) @@ -615,6 +616,7 @@ OPTSET(full) #endif OPTSET(full) +DEPRECATE(full, gettext_noop("please use --verbose instead")) OPTION(full, full, false, "full", gettext_noop("print detailed information")) #ifdef option_bodies ============================================================ --- tests/default_command_options/__driver__.lua 524306e088768186ee550179e9cd8bebd3b7fec0 +++ tests/default_command_options/__driver__.lua 16c444951060be89b97c037998f009950b7986ec @@ -3,7 +3,7 @@ check(get("default_options.lua")) check(get("default_options.lua")) -check(mtn("version", "--full"), 0, true, false) +check(mtn("version", "--verbose"), 0, true, false) rename("stdout", "fullversion") check(mtn("version", "--rcfile=default_options.lua"), 0, true, false) ============================================================ --- tests/default_command_options/default_options.lua c66ceeb9cfcd88be99aa2de5c9d5445e1046a3cc +++ tests/default_command_options/default_options.lua e5574902b08b2259b7e7c46f0b90e658287b3d3d @@ -2,7 +2,7 @@ function get_default_command_options(com function get_default_command_options(command) local default_opts = {} if (command[1] == "version") then - table.insert(default_opts, "--full") + table.insert(default_opts, "--verbose") end -- should trigger an invalid option error if (command[1] == "status") then ============================================================ --- tests/test_the_version_command/__driver__.lua 6095698f688c9e07c2dfd67bd479300e730735ec +++ tests/test_the_version_command/__driver__.lua bf200ff06525a9d3b36637bce59e2c7f98382145 @@ -12,13 +12,13 @@ check(string.find(output, "Running on") output = readfile("stdout") check(string.find(output, "Running on") == nil) --- The 'version' command allows a '--full' option. -check(mtn("version", "--full"), 0, true, 0) +-- The 'version' command allows a '--verbose' option. +check(mtn("version", "--verbose"), 0, true, 0) output = readfile("stdout") check(string.find(output, "Running on") ~= nil) --- The '--version' option does not allow a '--full' option (because the +-- The '--version' option does not allow a '--verbose' option (because the -- latter is not global). -check(mtn("--version", "--full"), 0, true, 0) +check(mtn("--version", "--verbose"), 0, true, 0) output = readfile("stdout") check(string.find(output, "Running on") == nil) ============================================================ --- ui.cc 8b4da1b636b654629b9d54e221825670b5f9a5bd +++ ui.cc 365fa59977896ae3163362b99a5e8d7028eab25e @@ -655,7 +655,7 @@ user_interface::fatal(string const & fat { inform(F("fatal: %s\n" "this is almost certainly a bug in monotone.\n" - "please send this error message, the output of '%s version --full',\n" + "please send this error message, the output of '%s version --verbose',\n" "and a description of what you were doing to %s.") % fatal % prog_name % PACKAGE_BUGREPORT); global_sanity.dump_buffer(); @@ -668,7 +668,7 @@ user_interface::fatal_db(string const & { inform(F("fatal: %s\n" "this is almost certainly a bug in monotone.\n" - "please send this error message, the output of '%s version --full',\n" + "please send this error message, the output of '%s version --verbose',\n" "and a description of what you were doing to %s.\n" "This error appears to have been triggered by something in the\n" "database you were using, so please preserve it in case it can\n" @@ -992,7 +992,8 @@ get_usage_str(options::options_type cons vector descriptions; unsigned int maxnamelen; - optset.instantiate(&opts).get_usage_strings(names, descriptions, maxnamelen); + optset.instantiate(&opts).get_usage_strings(names, descriptions, maxnamelen, + opts.show_hidden_commands); return format_usage_strings(names, descriptions, maxnamelen); } ============================================================ --- unit-testsuite.lua a8fd12b4d50135121bf3e9be6247bd0fbf0ade58 +++ unit-testsuite.lua 5b4649618e6d2fe244aad44ccb5d88fbb449ce27 @@ -66,14 +66,14 @@ function prepare_to_run_tests (P) writefile_q("in", nil) prepare_redirect("in", "out", "err") - local status = execute(monotone_path, "version", "--full") + local status = execute(monotone_path, "version", "--verbose") local out = readfile_q("out") local err = readfile_q("err") if status == 0 and err == "" and out ~= "" then logfile:write(out) else - P(string.format("mtn version --full: exit %d\nstdout:\n", status)) + P(string.format("mtn version --verbose: exit %d\nstdout:\n", status)) P(out) P("stderr:\n") P(err) ============================================================ --- unix/main.cc 1a4910550eee2b11ff4bc99bec1f9de0d44da81e +++ unix/main.cc 9d9d704089170f3fea8bb29bfd099435a2dab26f @@ -58,7 +58,7 @@ bug_report_message() write_str_to_stderr("\nthis is almost certainly a bug in monotone." "\nplease send this error message, the output of '"); write_str_to_stderr(argv0); - write_str_to_stderr(" version --full'," + write_str_to_stderr(" version --verbose'," "\nand a description of what you were doing to " PACKAGE_BUGREPORT "\n"); } ============================================================ --- win32/main.cc 8b14cc20945d524354751fd745044d96cfe69f96 +++ win32/main.cc f7225a77eeced7cceca507d02c7c3aaeb86b2bbc @@ -61,7 +61,7 @@ bug_report_message() write_str_to_stderr("\nthis is almost certainly a bug in monotone." "\nplease send this error message, the output of '"); write_str_to_stderr(argv0); - write_str_to_stderr(" version --full'," + write_str_to_stderr(" version --verbose'," "\nand a description of what you were doing to " PACKAGE_BUGREPORT "\n"); }