# # patch "ChangeLog" # from [50d13e5d3712436ca27eaaa524f18d2e5de19cbd] # to [9a2166535dc3aead45d7eedc53eb60a67851fcf4] # # patch "app_state.cc" # from [ba628f813899ea30aee581c7435d93b6549d1890] # to [7c12ea6894df8aed4ac689b333df2f5dc19e3fd4] # # patch "app_state.hh" # from [3266667ef8e90abd725cb10983bbe1601c5d2c9f] # to [3ac03fa785dd39a9c005a7a35ad1962468d5be32] # # patch "commands.cc" # from [688c544d00c8a14a7ad7764d0905f85a2f0ddfac] # to [68c004df52557da350e0f9b4c57792e7a782f527] # # patch "contrib/monotone.zsh_completion" # from [ab021dfed85eff74d530e395c9c3adbe760ccbe1] # to [872e2d668a2b4c5775134fd1b2a7101d29c1cba5] # # patch "monotone.cc" # from [99699fececcf92d3614b04a713b767ffa143a091] # to [c2d839bc84a52c398ae42a860f31b87d0004cc85] # # patch "monotone.texi" # from [4fb1363ab96b7475fb37f8a11dae6b43057c3af2] # to [f5c2772132d6e3b05043260e09e66fd945e2ee20] # # patch "options.hh" # from [8246a992a8c10a7ca13ae99108d44d13b38f6950] # to [bb33c449ff288021098ac00c045e862806e42b9f] # --- ChangeLog +++ ChangeLog @@ -1,4 +1,3 @@ -2005-06-05 Timothy Brownawell * netsync.cc, netcmd.cc: Style cleanups (mostly whitespace). @@ -46,6 +45,14 @@ (note_state_at_branch_beginning): Move time back when there are known commits on a branch. +2005-06-03 Joel Reed + + * commands.cc, monotone.texi: provide --verbose option for + monotone complete revision which adds date and author + completion output + * contrib/monotone.zsh_completion: use verbose output when + completing revisions + 2005-06-02 graydon hoare * rcs_import.cc @@ -4789,7 +4796,7 @@ * AUTHORS: Mention Wojciech and Neil. * revision.cc (calculate_ancestors_from_graph): Make non-recursive. -2005-01-17 Wojciech Miłkowski +2005-01-17 Wojciech MiÅkowski * std_hooks.lua: Teach about meld. --- app_state.cc +++ app_state.cc @@ -31,7 +31,7 @@ app_state::app_state() : branch_name(""), db(""), stdhooks(true), rcfiles(true), diffs(false), - search_root("/"), depth(-1), last(-1) + search_root("/"), depth(-1), last(-1), verbose(false) { db.set_app(this); } @@ -351,6 +351,12 @@ } void +app_state::set_verbose(bool b) +{ + verbose = b; +} + +void app_state::add_rcfile(utf8 const & filename) { extra_rcfiles.push_back(filename); --- app_state.hh +++ app_state.hh @@ -33,6 +33,7 @@ bool rcfiles; bool diffs; bool no_merges; + bool verbose; options_map options; utf8 message; utf8 message_file; @@ -79,6 +80,7 @@ void set_stdhooks(bool b); void set_rcfiles(bool b); + void set_verbose(bool b); void add_rcfile(utf8 const & filename); explicit app_state(); --- commands.cc +++ commands.cc @@ -3311,12 +3311,12 @@ CMD(complete, "informative", "(revision|manifest|file|key) PARTIAL-ID", "complete partial id", - OPT_BRIEF) + OPT_VERBOSE) { if (args.size() != 2) throw usage(name); - bool brief = global_sanity.brief; + bool verbose = app.verbose; N(idx(args, 1)().find_first_not_of("abcdef0123456789") == string::npos, F("non-hex digits in partial id")); @@ -3327,7 +3327,10 @@ app.db.complete(idx(args, 1)(), completions); for (set::const_iterator i = completions.begin(); i != completions.end(); ++i) - cout << i->inner()() << endl; + { + if (!verbose) cout << i->inner()() << endl; + else cout << describe_revision(app, i->inner()) << endl; + } } else if (idx(args, 0)() == "manifest") { @@ -3354,7 +3357,7 @@ i != completions.end(); ++i) { cout << i->first.inner()(); - if (!brief) cout << " " << i->second(); + if (verbose) cout << " " << i->second(); cout << endl; } } --- contrib/monotone.zsh_completion +++ contrib/monotone.zsh_completion @@ -94,10 +94,14 @@ compadd -- file manifest revision else local mtype="$words[2]" - local id="$words[3]:gs/-//" - if (( $#id )); then - compadd -- $(monotone complete $mtype $id) - fi + if [[ "$mtype" == "revision" ]]; then + _monotone_revisions + else + local id="$words[3]" + if (( $#id )); then + compadd -- $(monotone complete $mtype $id 2> /dev/null) + fi + fi fi } @@ -293,16 +297,16 @@ (( $+functions[_monotone_keys] )) || _monotone_keys() { - local keys - keys=$(monotone ls keys) - compadd -X $keys -n -- $(echo $keys | grep "[0-9a-f]\{40\}" | cut -f 1 -d ' ') + local id="$words[CURRENT]:gs/-//" + if (( $#id )); then + compadd -X "$(monotone complete key --verbose $id 2>/dev/null)" -n -- $(monotone complete key $id 2>/dev/null) + fi } (( $+functions[_monotone_revisions] )) || _monotone_revisions() { - local id="$words[CURRENT]:gs/-//" - if (( $#id )); then - compadd -- $(monotone complete revision $id 2>/dev/null) + if ! compset -P '*\='; then + compadd -X "$(monotone complete revision --verbose $PREFIX 2>/dev/null)" -n -- $(monotone complete revision $PREFIX 2>/dev/null) fi } --- monotone.cc +++ monotone.cc @@ -75,6 +75,7 @@ {"key", 'k', POPT_ARG_STRING, &argstr, OPT_KEY_NAME, "set key for signatures", NULL}, {"db", 'd', POPT_ARG_STRING, &argstr, OPT_DB_NAME, "set name of database", NULL}, {"root", 0, POPT_ARG_STRING, &argstr, OPT_ROOT, "limit search for working copy to specified root", NULL}, + {"verbose", 0, POPT_ARG_NONE, NULL, OPT_VERBOSE, "verbose completion output", NULL}, { NULL, 0, 0, NULL, 0, NULL, NULL } }; @@ -295,6 +296,10 @@ app.set_rcfiles(false); break; + case OPT_VERBOSE: + app.set_verbose(true); + break; + case OPT_RCFILE: app.add_rcfile(absolutify_for_command_line(tilde_expand(string(argstr)))); break; --- monotone.texi +++ monotone.texi @@ -3748,9 +3748,9 @@ is the revision in which that line of the file was last edited. @item monotone complete file @var{partial-id} address@hidden monotone complete key @var{partial-id} address@hidden monotone complete [--brief] key @var{partial-id} @itemx monotone complete manifest @var{partial-id} address@hidden monotone complete revision @var{partial-id} address@hidden monotone complete [--brief] revision @var{partial-id} These commands print out all known completions of a partial @sc{sha1} value, listing completions which are @code{file}, @code{manifest} or @@ -3771,6 +3771,20 @@ @code{fa36}. This command is intended to be used by programmable completion systems, such as those in @command{bash} and @command{zsh}. +The complete command for keys and revisions have a @code{--verbose} option. +Programmable completion systems can use @code{--verbose} output to +present users with additional information about each completion option. + +For example, verbose output for @code{revision} looks like this: address@hidden address@hidden +$ mt complete revision 01f +01f5da490941bee1f0000f0561fc62eabfb2fa23 graydon@@dub.net 2003-12-03T03:14:35 +01f992577bd8bcdcade0f89e724fd5dc2d2bbe8a kinetik@@orcon.nz 2005-05-11T05:19:29 +01faad191d8d0474777c70b4d606782942333a78 kinetik@@orcon.nz 2005-04-11T04:24:01 address@hidden group address@hidden smallexample + @item monotone diff @itemx monotone diff @var{pathname...} @itemx monotone diff address@hidden --- options.hh +++ options.hh @@ -34,3 +34,4 @@ #define OPT_DIFFS 25 #define OPT_NO_MERGES 26 #define OPT_LAST 27 +#define OPT_VERBOSE 28