# # patch "ChangeLog" # from [bf8a4a75eddeb0270a5b05945234ee5aa2e9ca88] # to [9ee3880c7c221f3053e530811721f483234f4890] # # patch "automate.cc" # from [60394a4947902625cd447b9e73727b55c0259495] # to [10270281421d377dedc2362ee2de520fbf1952e2] # # patch "monotone.texi" # from [1ba82432e678b8b56e6c8546930e30b85c277955] # to [f31c3a952fdf52b31543e6fc02271aa0e37aba1f] # --- ChangeLog +++ ChangeLog @@ -1,3 +1,9 @@ +2005-05-24 Timothy Brownawell + + * automate.cc: Fix comment for automate stdio to match the code. + * monotone.texi: Document ignored locations in automate stdio + input as reserved. + 2005-05-23 Timothy Brownawell Fix "automate stdio" input/output format according to ML discussion --- automate.cc +++ automate.cc @@ -792,116 +792,6 @@ } -// Name: certs -// Arguments: -// 1: a revision id -// Added in: 1.0 -// Purpose: Prints all certificates associated with the given revision ID. -// Each certificate is contained in a basic IO stanza. For each certificate, -// the following values are provided: -// -// 'key' : a string indicating the key used to sign this certificate. -// 'signature': a string indicating the status of the signature. Possible -// values of this string are: -// 'ok' : the signature is correct -// 'bad' : the signature is invalid -// 'unknown' : signature was made with an unknown key -// 'name' : the name of this certificate -// 'value' : the value of this certificate -// 'trust' : is this certificate trusted by the defined trust metric -// Possible values of this string are: -// 'trusted' : this certificate is trusted -// 'untrusted' : this certificate is not trusted -// -// Output format: All stanzas are formatted by basic_io. Stanzas are seperated -// by a blank line. Values will be escaped, '\' -> '\\' and '"' -> '\"'. -// -// Error conditions: If a certificate is signed with an unknown public key, a -// warning message is printed to stderr. If the revision specified is unknown -// or invalid prints an error message to stderr and exits with status 1. -static void -automate_certs(std::vector args, - std::string const & help_name, - app_state & app, - std::ostream & output) -{ - if (args.size() != 1) - throw usage(help_name); - - std::vector certs; - - transaction_guard guard(app.db); - - revision_id rid(idx(args, 0)()); - N(app.db.revision_exists(rid), F("No such revision %s") % rid); - hexenc ident(rid.inner()); - - std::vector< revision > ts; - app.db.get_revision_certs(rid, ts); - for (size_t i = 0; i < ts.size(); ++i) - certs.push_back(idx(ts, i).inner()); - - { - std::set checked; - for (size_t i = 0; i < certs.size(); ++i) - { - if (checked.find(idx(certs, i).key) == checked.end() && - !app.db.public_key_exists(idx(certs, i).key)) - P(F("warning: no public key '%s' found in database\n") - % idx(certs, i).key); - checked.insert(idx(certs, i).key); - } - } - - // Make the output deterministic; this is useful for the test suite, in - // particular. - sort(certs.begin(), certs.end()); - - basic_io::printer pr(output); - - for (size_t i = 0; i < certs.size(); ++i) - { - basic_io::stanza st; - cert_status status = check_cert(app, idx(certs, i)); - cert_value tv; - cert_name name = idx(certs, i).name(); - std::set signers; - - decode_base64(idx(certs, i).value, tv); - - rsa_keypair_id keyid = idx(certs, i).key(); - signers.insert(keyid); - - bool trusted = app.lua.hook_get_revision_cert_trust(signers, ident, - name, tv); - - st.push_str_pair("key", keyid()); - - std::string stat; - switch (status) - { - case cert_ok: - stat = "ok"; - break; - case cert_bad: - stat = "bad"; - break; - case cert_unknown: - stat = "unknown"; - break; - } - st.push_str_pair("signature", stat); - - st.push_str_pair("name", name()); - st.push_str_pair("value", tv()); - st.push_str_pair("trust", (trusted ? "trusted" : "untrusted")); - - pr.print_stanza(st); - } - - guard.commit(); -} - void automate_command(utf8 cmd, std::vector args, std::string const & root_cmd_name, @@ -915,11 +805,13 @@ // of monotone. // // Input format: The input is a series of lines of the form -// [ ...] newline, where is -// colon . +// 'l'':'[':'...]'e', with characters +// after the 'e' of one command, but before the 'l' of the next ignored. +// This space is reserved, and should not contain characters other +// than '\n'. // Example: -// 6:leaves -// 7:parents40:0e3171212f34839c2e3263e7282cdeea22fc5378 +// l6:leavese +// l7:parents40:0e3171212f34839c2e3263e7282cdeea22fc5378e // // Output format: :::: // is a decimal number specifying which command @@ -1124,8 +1016,6 @@ automate_attributes(args, root_cmd_name, app, output); else if (cmd() == "stdio") automate_stdio(args, root_cmd_name, app, output); - else if (cmd() == "certs") - automate_certs(args, root_cmd_name, app, output); else throw usage(root_cmd_name); } --- monotone.texi +++ monotone.texi @@ -5060,7 +5060,8 @@ The input is a series of commands of the form 'l' [ ...] 'e', where = colon . Characters between the ending 'e' -of one commad and the beginning 'l' of the next are ignored. +of one commad and the beginning 'l' of the next are ignored, but characters +other than '\n' should not be present as this space is reserved. @item Sample output: