# # # patch "automate.cc" # from [a0ff144fedc680631087a881a1876e9bf606d309] # to [d96be09abbc83bfaf658641ec3c02485e06403f2] # # patch "cmd_diff_log.cc" # from [19a9ea13bfa486f332ead5ea68de4f1f21b6b2e0] # to [82ddae0967fe4ca59141c862161507dbd88cfccd] # # patch "cmd_netsync.cc" # from [d3f851b56afd8639e3946bbd190d0f13886f9fbd] # to [383033714e6aed01923de1d09ecd220dd45c13f5] # # patch "cmd_ws_commit.cc" # from [c3f3acf71cb7b80f6c810f68003e267b90a79382] # to [d9f7ec6e1af4c93860b588e90b3096accc9ec6d4] # # patch "options.cc" # from [0686c4f93079240ef0903c586065de4c51454430] # to [0d4225ed7751e38a154f3d6d72cabbf9d57de9df] # # patch "options.hh" # from [7bcd146217355875a516967d93b97f7f7a4db2a3] # to [450b973b246595eb4208a277558279feb309c8b7] # # patch "options_list.hh" # from [8ce5a0d99837f816210671753b564550a563183b] # to [8acd5081246f14e22c93efa035d5743dc04eae88] # ============================================================ --- automate.cc a0ff144fedc680631087a881a1876e9bf606d309 +++ automate.cc d96be09abbc83bfaf658641ec3c02485e06403f2 @@ -1014,10 +1014,7 @@ CMD_AUTOMATE(inventory, N_("[PATH]...") "", options::opts::depth | options::opts::exclude | - options::opts::no_ignored | - options::opts::no_unknown | - options::opts::no_unchanged | - options::opts::no_corresponding_renames) + options::opts::automate_inventory_opts) { database db(app); workspace work(app); ============================================================ --- cmd_diff_log.cc 19a9ea13bfa486f332ead5ea68de4f1f21b6b2e0 +++ cmd_diff_log.cc 82ddae0967fe4ca59141c862161507dbd88cfccd @@ -466,9 +466,9 @@ CMD_AUTOMATE(content_diff, N_("[FILE [.. CMD_AUTOMATE(content_diff, N_("[FILE [...]]"), N_("Calculates diffs of files"), "", - options::opts::with_header | options::opts::without_header | + options::opts::au_diff_options | options::opts::revision | options::opts::depth | - options::opts::exclude | options::opts::reverse) + options::opts::exclude) { roster_t old_roster, new_roster; string dummy_header; ============================================================ --- cmd_netsync.cc d3f851b56afd8639e3946bbd190d0f13886f9fbd +++ cmd_netsync.cc 383033714e6aed01923de1d09ecd220dd45c13f5 @@ -831,8 +831,8 @@ CMD_NO_WORKSPACE(serve, "serve", "", CMD "", options::opts::max_netsync_version | options::opts::min_netsync_version | - options::opts::bind | options::opts::pidfile | - options::opts::bind_stdio | options::opts::no_transport_auth) + options::opts::pidfile | + options::opts::bind_opts) { if (!args.empty()) throw usage(execid); ============================================================ --- cmd_ws_commit.cc c3f3acf71cb7b80f6c810f68003e267b90a79382 +++ cmd_ws_commit.cc d9f7ec6e1af4c93860b588e90b3096accc9ec6d4 @@ -1728,7 +1728,7 @@ CMD(commit, "commit", "ci", CMD_REF(work CMD(commit, "commit", "ci", CMD_REF(workspace), N_("[PATH]..."), N_("Commits workspace changes to the database"), "", - options::opts::branch | options::opts::message | options::opts::msgfile | + options::opts::branch | options::opts::messages | options::opts::date | options::opts::author | options::opts::depth | options::opts::exclude) { @@ -1789,7 +1789,7 @@ CMD_NO_WORKSPACE(import, "import", "", C N_("Imports the contents of a directory into a branch"), "", options::opts::branch | options::opts::revision | - options::opts::message | options::opts::msgfile | + options::opts::messages | options::opts::dryrun | options::opts::no_ignore | options::opts::exclude | options::opts::author | options::opts::date) ============================================================ --- options.cc 0686c4f93079240ef0903c586065de4c51454430 +++ options.cc 0d4225ed7751e38a154f3d6d72cabbf9d57de9df @@ -42,8 +42,8 @@ options::children() val[&options::opts::all_options].insert(&options::opts::name); # define OPTVAR(optset, type, name, default_) # define OPTION(optset, name, hasarg, optstring, description) \ - val[&options::opts:: optset].insert(&options::opts:: name); \ - val[&options::opts::all_options].insert(&options::opts::name); + val[&options::opts:: optset].insert(&options::opts:: name ## _opt); \ + val[&options::opts::all_options].insert(&options::opts::name ## _opt); # define OPTSET_REL(parent, child) \ val[&options::opts:: parent].insert(&options::opts:: child); @@ -179,7 +179,7 @@ options::options_type const & options::o } # define OPTION(optset, name, hasarg, optstring, description) \ - options::options_type const & options::opts::name() \ + options::options_type const & options::opts::name ## _opt() \ { \ static options::options_type val(optstring, \ description, hasarg, \ @@ -190,7 +190,7 @@ options::options_type const & options::o void options::reset_opt_ ## name () \ { \ name ## _given = false; \ - reset_optset(&opts:: name); \ + reset_optset(&opts:: name ## _opt); \ } \ void options::set_ ## name (std::string arg) \ { \ ============================================================ --- options.hh 7bcd146217355875a516967d93b97f7f7a4db2a3 +++ options.hh 450b973b246595eb4208a277558279feb309c8b7 @@ -48,7 +48,7 @@ struct options # define OPTVAR(optset, type, name, default_) #define OPTION(optset, name, hasarg, optstring, description) \ - static options_type const & name (); + static options_type const & name ## _opt (); # define OPTSET_REL(parent, child) ============================================================ --- options_list.hh 8ce5a0d99837f816210671753b564550a563183b +++ options_list.hh 8acd5081246f14e22c93efa035d5743dc04eae88 @@ -49,7 +49,8 @@ // This is a shortcut for an option which has its own variable and optset. // It will take an argument unless 'type' is 'bool'. -#define OPT(name, string, type, default_, description) \ +#define OPT(name, string, type, default_, description) \ + OPTSET(name) \ OPTVAR(name, type, name, default_) \ OPTION(name, name, has_arg(), string, description) @@ -57,9 +58,48 @@ // 'globals' optset. These are global options, not specific to a particular // command. #define GOPT(name, string, type, default_, description) \ - OPTVAR(globals, type, name, default_) \ - OPTION(globals, name, has_arg(), string, description) + OPTSET(name) \ + OPTSET_REL(globals, name) \ + OPTVAR(name, type, name, default_) \ + OPTION(name, name, has_arg(), string, description) +#ifdef option_bodies +template +void set_simple_option(T & t, std::string const & arg) +{ t = T(arg, origin::user); } +template +void set_simple_option(std::vector & t, std::string const & arg) +{ t.push_back(T(arg, origin::user)); } +template +void set_simple_option(std::set & t, std::string const & arg) +{ t.insert(T(arg, origin::user)); } +template<> +void set_simple_option(bool & t, std::string const & arg) +{ t = true; } +template<> +void set_simple_option(std::string & t, std::string const & arg) +{ t = arg; } +template<> +void set_simple_option(std::vector & t, std::string const & arg) +{ t.push_back(arg); } +template<> +void set_simple_option(std::set & t, std::string const & arg) +{ t.insert(arg); } +# define SIMPLE_OPTION_BODY(name) { set_simple_option(name, arg); } +#else +# define SIMPLE_OPTION_BODY +#endif +#define SIMPLE_OPTION(name, optstring, type, description) \ + OPTSET(name) \ + OPTVAR(name, type, name, ) \ + OPTION(name, name, has_arg(), optstring, description) \ + SIMPLE_OPTION_BODY + +// Like SIMPLE_OPTION, but the declared option is a member of the globals +#define GLOBAL_SIMPLE_OPTION(name, optstring, type, description) \ + OPTSET_REL(globals, name) \ + SIMPLE_OPTION(name, optstring, type, description) + // because 'default_' is constructor arguments, and may need to be a list // This doesn't work if fed through the OPT / GOPT shorthand versions #define COMMA , @@ -296,6 +336,8 @@ OPTSET(diff_options) OPTSET(diff_options) +OPTSET(au_diff_options) +OPTSET_REL(diff_options, au_diff_options) OPTVAR(diff_options, std::string, external_diff_args, ) OPTION(diff_options, external_diff_args, true, "diff-args", @@ -306,8 +348,8 @@ OPTION(diff_options, external_diff_args, } #endif -OPTVAR(diff_options, bool, reverse, false) -OPTION(diff_options, reverse, false, "reverse", +OPTVAR(au_diff_options, bool, reverse, false) +OPTION(au_diff_options, reverse, false, "reverse", gettext_noop("reverse order of diff")) #ifdef option_bodies { @@ -345,9 +387,9 @@ OPTION(diff_options, no_show_encloser, f } #endif -OPTVAR(diff_options, bool, without_header, false); -OPTVAR(diff_options, bool, with_header, false); -OPTION(diff_options, without_header, false, "without-header", +OPTVAR(au_diff_options, bool, without_header, false); +OPTVAR(au_diff_options, bool, with_header, false); +OPTION(au_diff_options, without_header, false, "without-header", gettext_noop("show the matching cset in the diff header")) #ifdef option_bodies { @@ -355,7 +397,7 @@ OPTION(diff_options, without_header, fal without_header = true; } #endif -OPTION(diff_options, with_header, false, "with-header", +OPTION(au_diff_options, with_header, false, "with-header", gettext_noop("do not show the matching cset in the diff header")) #ifdef option_bodies { @@ -371,6 +413,7 @@ OPT(diffs, "diffs", bool, false, gettext } #endif +OPTSET(drop_attr) OPTVAR(drop_attr, std::set, attrs_to_drop, ) OPTION(drop_attr, drop_attr, true, "drop-attr", gettext_noop("when rosterifying, drop attrs entries with the given key")) @@ -404,6 +447,7 @@ OPTION(globals, dump, true, "dump", } #endif +OPTSET(exclude) OPTVAR(exclude, args_vector, exclude_patterns, ) OPTION(exclude, exclude, true, "exclude", gettext_noop("leave out anything described by its argument")) @@ -484,6 +528,7 @@ OPT(show_hidden_commands, "hidden", bool } #endif +OPTSET(include) OPTVAR(include, args_vector, include_patterns, ) OPTION(include, include, true, "include", gettext_noop("include anything described by its argument")) @@ -509,6 +554,7 @@ GOPT(non_interactive, "non-interactive", } #endif +OPTSET(key) OPTVAR(key, external_key_name, signing_key, ) OPTION(globals, key, true, "key,k", gettext_noop("sets the key for signatures, using either the key " @@ -530,6 +576,7 @@ OPTION(globals, key_dir, true, "keydir", } #endif +OPTSET(key_to_push) OPTVAR(key_to_push, std::vector, keys_to_push, ) OPTION(key_to_push, key_to_push, true, "key-to-push", gettext_noop("push the specified key even if it hasn't signed anything")) @@ -701,6 +748,7 @@ OPT(recursive, "recursive,R", bool, fals } #endif +OPTSET(revision) OPTVAR(revision, args_vector, revision_selectors, ) OPTION(revision, revision, true, "revision,r", gettext_noop("select revision id for operation")) @@ -946,6 +994,14 @@ OPT(export_marks, "export-marks", system } #endif +// clean up after ourselves +#undef OPT +#undef GOPT +#undef SIMPLE_OPTION +#undef SIMPLE_OPTION_BODY +#undef GLOBAL_SIMPLE_OPTION +#undef COMMA + // Local Variables: // mode: C++ // fill-column: 76