# # # patch "cmd.cc" # from [55ea2873fc7b91694ba9e2d51b3e89fe48c6cfa7] # to [31533581998105a537eb56e3ce3e8c5b11321708] # # patch "cmd.hh" # from [99e998330fea396e9b24b2dc56610a07a463b606] # to [968a5cbc4b9dc33badca1e93a6f387eaa1c70c9e] # # patch "cmd_diff_log.cc" # from [cdd677aa2c5cf73d74ce004aae86d05de104d316] # to [2042dbf1e6bfb3de74a753b49c641589e84b565c] # # patch "options_list.hh" # from [519be4e41ccf05254e1280dd6b876cd95a017683] # to [2accfaf2fdfe2dd34913cd58e054ef582f4d3124] # ============================================================ --- cmd.cc 55ea2873fc7b91694ba9e2d51b3e89fe48c6cfa7 +++ cmd.cc 31533581998105a537eb56e3ce3e8c5b11321708 @@ -115,6 +115,8 @@ namespace commands { I(cmd); options::opts::all_options().instantiate(&app.opts).reset(); + cmd->preset_options(app.opts); + option::concrete_option_set optset = (options::opts::globals() | cmd->opts()) .instantiate(&app.opts); ============================================================ --- cmd.hh 99e998330fea396e9b24b2dc56610a07a463b606 +++ cmd.hh 968a5cbc4b9dc33badca1e93a6f387eaa1c70c9e @@ -107,7 +107,7 @@ namespace commands { public: void register_for(command const * cmd); - virtual void preset(options const & opts) const = 0; + virtual void preset(options & opts) const = 0; virtual ~cmdpreset(); }; @@ -194,6 +194,7 @@ namespace commands { \ cmdpreset_ ## C () { register_for(CMD_REF(C)); } \ virtual void preset(options & opts) const; \ }; \ + cmdpreset_ ## C C ## _cmdpreset; \ } \ void commands::cmdpreset_ ## C ::preset(options & opts) const ============================================================ --- cmd_diff_log.cc cdd677aa2c5cf73d74ce004aae86d05de104d316 +++ cmd_diff_log.cc 2042dbf1e6bfb3de74a753b49c641589e84b565c @@ -417,6 +417,10 @@ void dump_header(std::string const & rev out << "#\n"; } +CMD_PRESET_OPTIONS(diff) +{ + opts.with_header = true; +} CMD(diff, "diff", "di", CMD_REF(informative), N_("[PATH]..."), N_("Shows current differences"), N_("Compares the current tree with the files in the repository and " @@ -441,7 +445,7 @@ CMD(diff, "diff", "di", CMD_REF(informat prepare_diff(app, db, old_roster, new_roster, args, old_from_db, new_from_db, revs); - if (!app.opts.without_header) + if (app.opts.with_header) { dump_header(revs, old_roster, new_roster, cout, true); } ============================================================ --- options_list.hh 519be4e41ccf05254e1280dd6b876cd95a017683 +++ options_list.hh 2accfaf2fdfe2dd34913cd58e054ef582f4d3124 @@ -393,24 +393,9 @@ OPTION(diff_options, no_show_encloser, f } #endif -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 -{ - with_header = false; - without_header = true; -} -#endif -OPTION(au_diff_options, with_header, false, "with-header", - gettext_noop("do not show the matching cset in the diff header")) -#ifdef option_bodies -{ - with_header = true; - without_header = false; -} -#endif +OPTSET_REL(au_diff_options, with_header) +SIMPLE_OPTION(with_header, "with-header/without-header", bool, + gettext_noop("show the matching cset in the diff header")) SIMPLE_OPTION(diffs, "diffs/no-diffs", bool, gettext_noop("print diffs along with logs"))