# # # patch "ChangeLog" # from [84a29f98ca8c2f76e1e2a0b7c7ae50be47eef5d6] # to [487beb3da7fbcf7d2ca654df5a222df7f7f011ec] # # patch "annotate.cc" # from [745a698f90c16ce73bf1fb718721ec74061ed5b4] # to [5a0e7200fad7865dc1ce9b30aaa531d0f6f7b542] # # patch "app_state.cc" # from [5e98b548e6d8148def8a8d374529b926131caa18] # to [3384797a5b4c8538bb2815051f9c9e5492b1a803] # # patch "automate.cc" # from [e039dbfb33e8212ec952abe292837f32128f63ba] # to [478ac8c03dc51430430413270ef9b90f6f866a67] # # patch "cert.cc" # from [ebca1d1dccde5eb33addd2f0af1d5cdb38e079d7] # to [eee49cf6d4d39afcca2cb2784b8b149a2d24f29b] # # patch "cert.hh" # from [3d0773d6995e74025a81c0bbf79947ee956ef081] # to [a0808b747d3c8574da04b342cd3afb8a65b89a17] # # patch "charset.cc" # from [6e282be5be50bc2a44eece659c10a416f92d80c9] # to [cf621c56614deb11c2b07a76af0ee18010b0e5be] # # patch "cmd_db.cc" # from [c0c5f005a9bb5be565620668b649f7a22e21e2fa] # to [c259cad883ed10a503f8fa10e5e067eded90916c] # # patch "cmd_files.cc" # from [eb2fdb6ef974ea7c3203863fb2704cdf4fed08f1] # to [bffec2cf6dda0e6bffd827733a5d21e906d1c8cd] # # patch "cmd_key_cert.cc" # from [4e2e4cbbf0f59dd5570060878e960ba07c60c966] # to [9c2cb74b31e99c3d4eabdb7f19f399379a9d5abc] # # patch "cmd_list.cc" # from [4cde746983b3d3ddc7845478ff65a4e61cf071a5] # to [c60282e394cfd3e7d362663fb7dc29bcf2a80da5] # # patch "cmd_merging.cc" # from [6e01b15be1c4eb05ccbfbac27911a204c385fee2] # to [4b53137d9efd6b8aab42639c05774cf34c562c4c] # # patch "cmd_ws_commit.cc" # from [48b9204dbc184bdabb06be95c50fec90a406c737] # to [4af21310c13cf9cf4ececa804feffda4ca752de2] # # patch "commands.cc" # from [0790260cd921d2cbaf2f863d78be5101e292a9bf] # to [cde5025967e84a100385148780e1ac53ac834908] # # patch "constants.cc" # from [aa685613113f5ba800e3c64cc209e93072f86e7b] # to [c5e10e88b205a1cbe015f4f401c4df66ac53c4b0] # # patch "constants.hh" # from [ce01c73109bbe256a6ff1c75e6a3395e2b0e0b53] # to [b9bc0cea940b4be75380a952b9988329af48f397] # # patch "cset.cc" # from [32d57144f8b23e78f35e35eef33f5ed0a4421fc1] # to [0f35a5dc5cfdd76f49eea3276302ee065511ff01] # # patch "database.cc" # from [688eaa61e7485a72cc4593c8f90f6d0b5cf6f832] # to [a2491c66f2f75e27dac3dc921b3e13a2d2b90990] # # patch "database_check.cc" # from [08c81eb4ad5e70f47be3920a41ef7a2a33480a14] # to [c36d3bf08726f6cb236f6f7b0757cc4d36f40a6b] # # patch "diff_patch.cc" # from [a8b1d3481a4ff79239887399a16f224df14a408a] # to [d23d8030dab765435e0e23847d40cb536bded9ec] # # patch "file_io.cc" # from [2128664fe9acc07e084954a0bfa9a2f023282dd0] # to [8568e68ad3692c88cdb43dc849796e56b6148e5f] # # patch "inodeprint.cc" # from [b548d939b5015b12601c390ea951962a14025694] # to [9c3963b93fb6ba7736654c2f67c92dde49fe146a] # # patch "keys.cc" # from [efbfa847a462a569d0747cf409380793585a25d7] # to [4a058060b5a56df134ca3c1d418b810c644712bd] # # patch "localized_file_io.cc" # from [4cad41827577db94bbbaa0ce2966fee24eef9548] # to [743d2969539eb07854546c2d21100c76bcd91de0] # # patch "lua.cc" # from [e0af7e037ef78d315f4fa61c58f7f11c4ec25768] # to [2f678713385631c4ca9782e9b767651d2f26ab21] # # patch "lua_hooks.cc" # from [2ba09f87d8dc16a1957cad5abc98565a7c87cc7c] # to [bbb38333f2877533b42a2bedf90f518114a1b926] # # patch "lua_hooks.hh" # from [7442504bf6a1fff7e6afe120d6883198f5303842] # to [3117a32b7a9aa1198111be385327b7d55276e08c] # # patch "luaext_globish.cc" # from [15a2b081a967e4f97702f05b14099bd6c9f377d3] # to [cbce64612aa5d0ca8542dcb10d54c6839d839d79] # # patch "merkle_tree.cc" # from [d39fdb1402dca3c6f81a9a1b37ff6193690894f6] # to [6b8dba1c330871b6f44eeefcaa4f3de1efe1cb6f] # # patch "monotone.cc" # from [eca87b7afbcce22d039be4b46b43240069177c26] # to [eb5b5c41da9e81aad0ffb91818c016a5628e85d9] # # patch "netcmd.cc" # from [aec74e6839c0e64afce5066d350b4aef9e5a1e94] # to [aa9c61e301fc6c077007dd9008f49765f839ff81] # # patch "netsync.cc" # from [83d9a60c55b895f2a6d75103bc82ddad930867a1] # to [6e345e2b5623d96d05acc870dcbbfb21850fa677] # # patch "option.cc" # from [c3e2f5ab0602e87822289368f48979be3ebcc85e] # to [599f4f7ffea913627169c06d4130207c3f2d2479] # # patch "options_list.hh" # from [dd7ba046fe78fb3c698d49934ed724922868b3c4] # to [bdf99561b7ca94bcf196ca26b8d192d8d74f1492] # # patch "packet.cc" # from [a59b48af0d11f15f912c85e5cc53a04f7f17b5f9] # to [321c141f57b042254693ac087ad31b7c13d8f6f8] # # patch "paths.cc" # from [16c9c7c98129e61004f883895ceb0c484dfd06a7] # to [5ecb3102980dd8fc2a6966a5dffc61ba3dd0760f] # # patch "platform-wrapped.hh" # from [7cf361939c769f88b68ad765ae8f44eacb05fcf2] # to [571fae420ef32c370127b56311cba9fc49819237] # # patch "project.cc" # from [475fc4f2238cd96630dd2563874953ad077c5dbf] # to [106438500b4c6e9b1c2a742180557ca6c8f14840] # # patch "project.hh" # from [9dc3c6c9ee83a837062380a2a3e4f47eb10c3fe1] # to [a37c5c9c535fdf22e8a41c3c4ef1cb8b8d8a12e0] # # patch "rcs_import.cc" # from [7cd5a5487b252ade9f829d7770445eacad0cbee3] # to [bd306d490d071237ee799494c623ec73dade5b06] # # patch "revision.cc" # from [94fd29b8e5b12a4926b7c0c444838d17414c5576] # to [bef5e7e0b39b9f2f5621e2271ca39953c7fb7a61] # # patch "roster.cc" # from [3e46ae0e6698e47779091ef0b39f66cd31b1f2e2] # to [cef7d6a2672f9f042749dec58145e0274238c4f9] # # patch "schema_migration.cc" # from [642fd28cf4c1e900dd1d747cbe1c8d1acec7ca02] # to [8082b846efa50626de640b3728430e7d8297d8d2] # # patch "transforms.cc" # from [ff33922197e5107a27eb3cf106a989dfee2732a0] # to [6e6641098498ee2cce52e6bc37bc784532fb6d5c] # # patch "transforms.hh" # from [4294da861e7cc7780ab744745edf10c898ad8ea3] # to [5d96e28af43c914295cc250c4e8a1708724511c5] # # patch "update.cc" # from [b0b042f58ab26cc380a3cc5c7669e928cd0e61f1] # to [7bb7a4e2ae0cb21eae4aaa90c4d0c749d68db69b] # # patch "vocab_macros.hh" # from [7c7576c82b4bc3b968c159c02054de0ceae3d0ac] # to [9a2cbe362da02a7052e3e8d46153d8eeb535e9db] # # patch "work.cc" # from [d8abf8091373fda63af5b8e6343d0ab7bb0a2603] # to [0db4f196f31d8c2262a68b0985a1487f48cba55a] # ============================================================ --- ChangeLog 84a29f98ca8c2f76e1e2a0b7c7ae50be47eef5d6 +++ ChangeLog 487beb3da7fbcf7d2ca654df5a222df7f7f011ec @@ -1,3 +1,8 @@ +2007-01-27 Timothy Brownawell + + Make vocab-from-string constructors explicit. Fix (some) places + where variables or parameters were given the wrong type. + 2007-01-20 Zack Weinberg * database.cc (sql_contexts): Delete write-only variable and all ============================================================ --- annotate.cc 745a698f90c16ce73bf1fb718721ec74061ed5b4 +++ annotate.cc 5a0e7200fad7865dc1ce9b30aaa531d0f6f7b542 @@ -327,14 +327,14 @@ cert_string_value(vector< revision static string cert_string_value(vector< revision > const & certs, - string const & name, + cert_name const & name, bool from_start, bool from_end, string const & sep) { for (vector< revision >::const_iterator i = certs.begin(); i != certs.end(); ++i) { - if (i->inner().name() == name) + if (i->inner().name == name) { cert_value tv; decode_base64 (i->inner().value, tv); ============================================================ --- app_state.cc 5e98b548e6d8148def8a8d374529b926131caa18 +++ app_state.cc 3384797a5b4c8538bb2815051f9c9e5492b1a803 @@ -111,8 +111,8 @@ app_state::write_options() { utf8 database_option, branch_option, key_option, keydir_option; - database_option = db.get_filename().as_internal(); - keydir_option = keys.get_key_dir().as_internal(); + database_option = utf8(db.get_filename().as_internal()); + keydir_option = utf8(keys.get_key_dir().as_internal()); if (branch_is_sticky) branch_option = opts.branch_name; ============================================================ --- automate.cc e039dbfb33e8212ec952abe292837f32128f63ba +++ automate.cc 478ac8c03dc51430430413270ef9b90f6f866a67 @@ -71,7 +71,7 @@ AUTOMATE(heads, N_("[BRANCH]"), options: app.opts.branch_name = idx(args, 0); } set heads; - app.get_project().get_branch_heads(app.opts.branch_name(), heads); + app.get_project().get_branch_heads(app.opts.branch_name, heads); for (set::const_iterator i = heads.begin(); i != heads.end(); ++i) output << (*i).inner()() << "\n"; } @@ -263,7 +263,7 @@ AUTOMATE(attributes, N_("FILE"), options node_t prev_node = base.get_node(path); // find the attribute in there - full_attr_map_t::const_iterator j = prev_node->attrs.find(i->first()); + full_attr_map_t::const_iterator j = prev_node->attrs.find(i->first); I(j != prev_node->attrs.end()); // was this dropped before? then ignore it @@ -280,7 +280,7 @@ AUTOMATE(attributes, N_("FILE"), options { node_t prev_node = base.get_node(path); full_attr_map_t::const_iterator j = - prev_node->attrs.find(i->first()); + prev_node->attrs.find(i->first); // attribute not found? this is new if (j == prev_node->attrs.end()) { @@ -303,7 +303,7 @@ AUTOMATE(attributes, N_("FILE"), options basic_io::stanza st; st.push_str_triple(basic_io::syms::attr, i->first(), value); - st.push_str_pair(std::string("state"), state); + st.push_str_pair(symbol("state"), state); pr.print_stanza(st); } @@ -1523,7 +1523,6 @@ AUTOMATE(get_content_changed, N_("REV FI i != mark.file_content.end(); ++i) { basic_io::stanza st; - revision_id old_ident = i->inner(); st.push_hex_pair(basic_io::syms::content_mark, i->inner()); prt.print_stanza(st); } ============================================================ --- cert.cc ebca1d1dccde5eb33addd2f0af1d5cdb38e079d7 +++ cert.cc eee49cf6d4d39afcca2cb2784b8b149a2d24f29b @@ -223,6 +223,11 @@ cert::cert() cert::cert() {} +cert::cert(std::string const & s) +{ + read_cert(s, *this); +} + cert::cert(hexenc const & ident, cert_name const & name, base64 const & value, @@ -268,12 +273,12 @@ read_cert(string const & in, cert & t) read_cert(string const & in, cert & t) { size_t pos = 0; - id hash = extract_substring(in, pos, - constants::merkle_hash_length_in_bytes, - "cert hash"); - id ident = extract_substring(in, pos, - constants::merkle_hash_length_in_bytes, - "cert ident"); + id hash = id(extract_substring(in, pos, + constants::merkle_hash_length_in_bytes, + "cert hash")); + id ident = id(extract_substring(in, pos, + constants::merkle_hash_length_in_bytes, + "cert ident")); string name, val, key, sig; extract_variable_length_string(in, name, pos, "cert name"); extract_variable_length_string(in, val, pos, "cert val"); @@ -439,7 +444,7 @@ check_cert(app_state & app, cert const & // "special certs" -string const branch_cert_name("branch"); +cert_name const branch_cert_name("branch"); void get_user_key(rsa_keypair_id & key, app_state & app) @@ -451,12 +456,8 @@ get_user_key(rsa_keypair_id & key, app_s return; } - if (app.opts.branch_name() != "") - { - cert_value branch(app.opts.branch_name()); - if (app.lua.hook_get_branch_key(branch, key)) - return; - } + if (app.lua.hook_get_branch_key(app.opts.branch_name, key)) + return; vector all_privkeys; app.keys.get_keys(all_privkeys); @@ -471,15 +472,10 @@ guess_branch(revision_id const & ident, void guess_branch(revision_id const & ident, - app_state & app, - cert_value & branchname) + app_state & app) { - if ((app.opts.branch_name() != "") && app.opts.branch_given) + if ((app.opts.branch_name().empty()) || !app.opts.branch_given) { - branchname = app.opts.branch_name(); - } - else - { N(!ident.inner()().empty(), F("no branch found for empty revision, " "please provide a branch name")); @@ -498,7 +494,6 @@ guess_branch(revision_id const & ident, set::iterator i = branches.begin(); I(i != branches.end()); app.opts.branch_name = *i; - branchname = (*i)(); } } @@ -544,12 +539,12 @@ cert_revision_in_branch(revision_id cons // "standard certs" -string const date_cert_name = "date"; -string const author_cert_name = "author"; -string const tag_cert_name = "tag"; -string const changelog_cert_name = "changelog"; -string const comment_cert_name = "comment"; -string const testresult_cert_name = "testresult"; +cert_name const date_cert_name("date"); +cert_name const author_cert_name("author"); +cert_name const tag_cert_name("tag"); +cert_name const changelog_cert_name("changelog"); +cert_name const comment_cert_name("comment"); +cert_name const testresult_cert_name("testresult"); void @@ -558,8 +553,8 @@ cert_revision_date_time(revision_id cons app_state & app, packet_consumer & pc) { - string val = boost::posix_time::to_iso_extended_string(t); - put_simple_revision_cert(m, date_cert_name, val, app, pc); + cert_value val = cert_value(boost::posix_time::to_iso_extended_string(t)); + put_simple_revision_cert(m, cert_name(date_cert_name), val, app, pc); } void @@ -590,7 +585,7 @@ cert_revision_author(revision_id const & packet_consumer & pc) { put_simple_revision_cert(m, author_cert_name, - author, app, pc); + cert_value(author), app, pc); } void @@ -599,7 +594,7 @@ cert_revision_author_default(revision_id packet_consumer & pc) { string author; - if (!app.lua.hook_get_author(app.opts.branch_name(), author)) + if (!app.lua.hook_get_author(app.opts.branch_name, author)) { rsa_keypair_id key; get_user_key(key, app), @@ -615,7 +610,7 @@ cert_revision_tag(revision_id const & m, packet_consumer & pc) { put_simple_revision_cert(m, tag_cert_name, - tagname, app, pc); + cert_value(tagname), app, pc); } @@ -626,7 +621,7 @@ cert_revision_changelog(revision_id cons packet_consumer & pc) { put_simple_revision_cert(m, changelog_cert_name, - changelog(), app, pc); + cert_value(changelog()), app, pc); } void @@ -636,7 +631,7 @@ cert_revision_comment(revision_id const packet_consumer & pc) { put_simple_revision_cert(m, comment_cert_name, - comment(), app, pc); + cert_value(comment()), app, pc); } void @@ -661,7 +656,7 @@ cert_revision_testresult(revision_id con "tried '0/1' 'yes/no', 'true/false', " "'pass/fail'"); - put_simple_revision_cert(r, testresult_cert_name, lexical_cast(passed), app, pc); + put_simple_revision_cert(r, testresult_cert_name, cert_value(lexical_cast(passed)), app, pc); } // Local Variables: ============================================================ --- cert.hh 3d0773d6995e74025a81c0bbf79947ee956ef081 +++ cert.hh a0808b747d3c8574da04b342cd3afb8a65b89a17 @@ -31,6 +31,10 @@ struct cert struct cert { cert(); + + // This is to make revision and manifest work. + explicit cert(std::string const & s); + cert(hexenc const & ident, cert_name const & name, base64 const & value, @@ -89,7 +93,7 @@ void erase_bogus_certs(std::vector< mani // Special certs -- system won't work without them. -extern std::string const branch_cert_name; +extern cert_name const branch_cert_name; void cert_revision_in_branch(revision_id const & ctx, @@ -108,15 +112,14 @@ guess_branch(revision_id const & id, void guess_branch(revision_id const & id, - app_state & app, - cert_value & branchname); + app_state & app); -extern std::string const date_cert_name; -extern std::string const author_cert_name; -extern std::string const tag_cert_name; -extern std::string const changelog_cert_name; -extern std::string const comment_cert_name; -extern std::string const testresult_cert_name; +extern cert_name const date_cert_name; +extern cert_name const author_cert_name; +extern cert_name const tag_cert_name; +extern cert_name const changelog_cert_name; +extern cert_name const comment_cert_name; +extern cert_name const testresult_cert_name; void cert_revision_date_now(revision_id const & m, ============================================================ --- charset.cc 6e282be5be50bc2a44eece659c10a416f92d80c9 +++ charset.cc cf621c56614deb11c2b07a76af0ee18010b0e5be @@ -64,8 +64,8 @@ system_to_utf8(external const & ext, utf { string out; charset_convert(system_charset(), "UTF-8", ext(), out); - I(utf8_validate(out)); - utf = out; + utf = utf8(out); + I(utf8_validate(utf)); } size_t @@ -171,7 +171,7 @@ utf8_to_system(utf8 const & utf, externa { string out; utf8_to_system(utf, out); - ext = out; + ext = external(out); } // utf8_validate and the helper functions is_valid_unicode_char and @@ -287,7 +287,7 @@ ace_to_utf8(ace const & a, utf8 & utf) F("error converting %d UTF-8 bytes to IDNA ACE: %s") % a().size() % decode_idna_error(res)); - utf = string(out); + utf = utf8(string(out)); free(out); } @@ -301,7 +301,7 @@ utf8_to_ace(utf8 const & utf, ace & a) F("error converting %d UTF-8 bytes to IDNA ACE: %s") % utf().size() % decode_idna_error(res)); - a = string(out); + a = ace(string(out)); free(out); } @@ -310,14 +310,14 @@ internalize_cert_name(utf8 const & utf, { ace a; utf8_to_ace(utf, a); - c = a(); + c = cert_name(a()); } void internalize_cert_name(external const & ext, cert_name & c) { utf8 utf; - system_to_utf8(ext(), utf); + system_to_utf8(ext, utf); internalize_cert_name(utf, c); } @@ -351,13 +351,13 @@ internalize_rsa_keypair_id(utf8 const & else { ace a; - utf8_to_ace(*i, a); + utf8_to_ace(utf8(*i), a); tmp += a(); } if (*i == "@") in_domain = true; } - key = tmp; + key = rsa_keypair_id(tmp); } void @@ -391,7 +391,7 @@ externalize_rsa_keypair_id(rsa_keypair_i if (*i == "@") in_domain = true; } - utf = tmp; + utf = utf8(tmp); } void @@ -407,14 +407,14 @@ internalize_var_domain(utf8 const & utf, { ace a; utf8_to_ace(utf, a); - d = a(); + d = var_domain(a()); } void internalize_var_domain(external const & ext, var_domain & d) { utf8 utf; - system_to_utf8(ext(), utf); + system_to_utf8(ext, utf); internalize_var_domain(utf, d); } @@ -611,11 +611,11 @@ UNIT_TEST(charset, idna_encoding) char *uc = stringprep_ucs4_to_utf8(idna_vec[i].in, idna_vec[i].inlen, &p, &q); - utf8 utf = string(uc); + utf8 utf = utf8(uc); utf8 tutf; free(uc); - ace a = string(idna_vec[i].out); + ace a = ace(idna_vec[i].out); ace tace; utf8_to_ace(utf, tace); L(FL("ACE-encoded %s: '%s'") % idna_vec[i].name % tace()); @@ -842,10 +842,10 @@ UNIT_TEST(charset, utf8_validation) }; for (int i = 0; good_strings[i]; ++i) - BOOST_CHECK(utf8_validate(string(good_strings[i])) == true); + BOOST_CHECK(utf8_validate(utf8(good_strings[i])) == true); for (int i = 0; bad_strings[i]; ++i) - BOOST_CHECK(utf8_validate(string(bad_strings[i])) == false); + BOOST_CHECK(utf8_validate(utf8(bad_strings[i])) == false); } #endif // BUILD_UNIT_TESTS ============================================================ --- cmd_db.cc c0c5f005a9bb5be565620668b649f7a22e21e2fa +++ cmd_db.cc c259cad883ed10a503f8fa10e5e067eded90916c @@ -172,7 +172,7 @@ CMD(complete, N_("informative"), N_("(re i != completions.end(); ++i) { if (!verbose) cout << i->inner()() << "\n"; - else cout << describe_revision(app, i->inner()) << "\n"; + else cout << describe_revision(app, *i) << "\n"; } } else if (idx(args, 0)() == "file") ============================================================ --- cmd_files.cc eb2fdb6ef974ea7c3203863fb2704cdf4fed08f1 +++ cmd_files.cc bffec2cf6dda0e6bffd827733a5d21e906d1c8cd @@ -103,7 +103,7 @@ CMD(fdiff, N_("debug"), N_("SRCNAME DEST string pattern(""); if (!app.opts.no_show_encloser) - app.lua.hook_get_encloser_pattern(file_path_external(src_name), pattern); + app.lua.hook_get_encloser_pattern(file_path_external(utf8(src_name)), pattern); make_diff(src_name, dst_name, src_id, dst_id, @@ -170,7 +170,7 @@ CMD(identify, N_("debug"), N_("[PATH]"), } else { - dat = get_stdin(); + dat = data(get_stdin()); } hexenc ident; ============================================================ --- cmd_key_cert.cc 4e2e4cbbf0f59dd5570060878e960ba07c60c966 +++ cmd_key_cert.cc 9c2cb74b31e99c3d4eabdb7f19f399379a9d5abc @@ -118,10 +118,8 @@ CMD(cert, N_("key and cert"), N_("REVISI transaction_guard guard(app.db); - hexenc ident; revision_id rid; complete(app, idx(args, 0)(), rid); - ident = rid.inner(); cert_name name; internalize_cert_name(idx(args, 1), name); @@ -136,7 +134,7 @@ CMD(cert, N_("key and cert"), N_("REVISI val = cert_value(get_stdin()); packet_db_writer dbw(app); - app.get_project().put_cert(ident, name, val, dbw); + app.get_project().put_cert(rid, name, val, dbw); guard.commit(); } @@ -224,10 +222,9 @@ CMD(approve, N_("review"), N_("REVISION" revision_id r; complete(app, idx(args, 0)(), r); packet_db_writer dbw(app); - cert_value branchname; - guess_branch(r, app, branchname); + guess_branch(r, app); N(app.opts.branch_name() != "", F("need --branch argument for approval")); - cert_revision_in_branch(r, app.opts.branch_name(), app, dbw); + app.get_project().put_revision_in_branch(r, app.opts.branch_name, dbw); } CMD(comment, N_("review"), N_("REVISION [COMMENT]"), @@ -238,7 +235,7 @@ CMD(comment, N_("review"), N_("REVISION utf8 comment; if (args.size() == 2) - comment = idx(args, 1)(); + comment = idx(args, 1); else { external comment_external; ============================================================ --- cmd_list.cc 4cde746983b3d3ddc7845478ff65a4e61cf071a5 +++ cmd_list.cc c60282e394cfd3e7d362663fb7dc29bcf2a80da5 @@ -85,7 +85,7 @@ ls_certs(string const & name, app_state if (colon_pos != string::npos) { string substr(str, 0, colon_pos); - colon_pos = display_width(substr); + colon_pos = display_width(utf8(substr)); extra_str = string(colon_pos, ' ') + ": %s\n"; } @@ -672,7 +672,7 @@ AUTOMATE(certs, N_("REV"), options::opts transaction_guard guard(app.db, false); - revision_id rid(idx(args, 0)()); + revision_id rid(hexenc(id(idx(args, 0)()))); N(app.db.revision_exists(rid), F("No such revision %s") % rid); hexenc ident(rid.inner()); @@ -707,12 +707,12 @@ AUTOMATE(certs, N_("REV"), options::opts basic_io::stanza st; cert_status status = check_cert(app, idx(certs, i)); cert_value tv; - cert_name name = idx(certs, i).name(); + cert_name name = idx(certs, i).name; set signers; decode_base64(idx(certs, i).value, tv); - rsa_keypair_id keyid = idx(certs, i).key(); + rsa_keypair_id keyid = idx(certs, i).key; signers.insert(keyid); bool trusted = ============================================================ --- cmd_merging.cc 6e01b15be1c4eb05ccbfbac27911a204c385fee2 +++ cmd_merging.cc 4b53137d9efd6b8aab42639c05774cf34c562c4c @@ -172,7 +172,7 @@ CMD(update, N_("workspace"), "", else if (branches.size() == 1) { // one non-matching, inform and update - app.opts.branch_name = (*(branches.begin()))(); + app.opts.branch_name = (*(branches.begin())); switched_branch = true; P(F("switching to branch %s") % app.opts.branch_name()); } @@ -297,9 +297,9 @@ merge_two(revision_id const & left, revi packet_db_writer dbw(app); app.get_project().put_standard_certs_from_options(merged, - branch, - log.str(), - dbw); + utf8(branch), + utf8(log.str()), + dbw); guard.commit(); P(F("[merged] %s") % merged); @@ -322,7 +322,7 @@ CMD(merge, N_("tree"), "", N_("merge unm F("please specify a branch, with --branch=BRANCH")); set heads; - app.get_project().get_branch_heads(app.opts.branch_name(), heads); + app.get_project().get_branch_heads(app.opts.branch_name, heads); N(heads.size() != 0, F("branch '%s' is empty") % app.opts.branch_name); if (heads.size() == 1) @@ -390,7 +390,7 @@ CMD(merge, N_("tree"), "", N_("merge unm ancestors.clear(); heads_for_ancestor.clear(); - app.get_project().get_branch_heads(app.opts.branch_name(), heads); + app.get_project().get_branch_heads(app.opts.branch_name, heads); pass++; } @@ -455,8 +455,8 @@ CMD(merge_into_dir, N_("tree"), N_("SOUR if (args.size() != 3) throw usage(name); - app.get_project().get_branch_heads(idx(args, 0)(), src_heads); - app.get_project().get_branch_heads(idx(args, 1)(), dst_heads); + app.get_project().get_branch_heads(idx(args, 0), src_heads); + app.get_project().get_branch_heads(idx(args, 1), dst_heads); N(src_heads.size() != 0, F("branch '%s' is empty") % idx(args, 0)()); N(src_heads.size() == 1, F("branch '%s' is not merged") % idx(args, 0)()); @@ -561,15 +561,15 @@ CMD(merge_into_dir, N_("tree"), N_("SOUR utf8 log_message; process_commit_message_args(log_message_given, log_message, app); if (!log_message_given) - log_message = (FL("propagate from branch '%s' (head %s)\n" - " to branch '%s' (head %s)\n") - % idx(args, 0) % (*src_i) - % idx(args, 1) % (*dst_i)).str(); + log_message = utf8((FL("propagate from branch '%s' (head %s)\n" + " to branch '%s' (head %s)\n") + % idx(args, 0) % (*src_i) + % idx(args, 1) % (*dst_i)).str()); packet_db_writer dbw(app); app.get_project().put_standard_certs_from_options(merged, idx(args, 1), - log_message(), + log_message, dbw); guard.commit(); @@ -820,7 +820,7 @@ CMD(heads, N_("tree"), "", N_("show unme N(app.opts.branch_name() != "", F("please specify a branch, with --branch=BRANCH")); - app.get_project().get_branch_heads(app.opts.branch_name(), heads); + app.get_project().get_branch_heads(app.opts.branch_name, heads); if (heads.size() == 0) P(F("branch '%s' is empty") % app.opts.branch_name); ============================================================ --- cmd_ws_commit.cc 48b9204dbc184bdabb06be95c50fec90a406c737 +++ cmd_ws_commit.cc 4af21310c13cf9cf4ececa804feffda4ca752de2 @@ -58,9 +58,9 @@ get_log_message_interactively(revision_t //if the _MTN/log file was non-empty, we'll append the 'magic' line utf8 user_log; if (user_log_message().length() > 0) - user_log = magic_line + "\n" + user_log_message(); + user_log =utf8( magic_line + "\n" + user_log_message()); else - user_log = user_log_message(); + user_log = user_log_message; external user_log_message_external; utf8_to_system(user_log, user_log_message_external); @@ -218,12 +218,11 @@ CMD(disapprove, N_("review"), N_("REVISI N(rev.edges.size() == 1, F("revision %s has %d changesets, cannot invert") % r % rev.edges.size()); - cert_value branchname; - guess_branch(r, app, branchname); + guess_branch(r, app); N(app.opts.branch_name() != "", F("need --branch argument for disapproval")); process_commit_message_args(log_message_given, log_message, app, - (FL("disapproval of revision '%s'") % r).str()); + utf8((FL("disapproval of revision '%s'") % r).str())); edge_entry const & old_edge (*rev.edges.begin()); app.db.get_revision_manifest(edge_old_revision(old_edge), @@ -248,9 +247,9 @@ CMD(disapprove, N_("review"), N_("REVISI dbw.consume_revision_data(inv_id, rdat); app.get_project().put_standard_certs_from_options(inv_id, - branchname(), - log_message(), - dbw); + app.opts.branch_name, + log_message, + dbw); guard.commit(); } } @@ -516,8 +515,7 @@ CMD(checkout, N_("tree"), N_("[DIRECTORY N(app.db.revision_exists(ident), F("no such revision '%s'") % ident); - cert_value b; - guess_branch(ident, app, b); + guess_branch(ident, app); I(!app.opts.branch_name().empty()); @@ -633,8 +631,8 @@ CMD(attr, N_("workspace"), N_("set PATH if (args.size() != 4) throw usage(name); - attr_key a_key = idx(args, 2)(); - attr_value a_value = idx(args, 3)(); + attr_key a_key = attr_key(idx(args, 2)()); + attr_value a_value = attr_value(idx(args, 3)()); node->attrs[a_key] = make_pair(true, a_value); } @@ -649,7 +647,7 @@ CMD(attr, N_("workspace"), N_("set PATH } else if (args.size() == 3) { - attr_key a_key = idx(args, 2)(); + attr_key a_key = attr_key(idx(args, 2)()); N(node->attrs.find(a_key) != node->attrs.end(), F("Path '%s' does not have attribute '%s'") % path % a_key); @@ -685,7 +683,7 @@ CMD(attr, N_("workspace"), N_("set PATH } else if (args.size() == 3) { - attr_key a_key = idx(args, 2)(); + attr_key a_key = attr_key(idx(args, 2)()); full_attr_map_t::const_iterator i = node->attrs.find(a_key); if (i != node->attrs.end() && i->second.first) cout << path << " : " @@ -738,17 +736,16 @@ CMD(commit, N_("workspace"), N_("[PATH]. N(restricted_rev.is_nontrivial(), F("no changes to commit")); - cert_value branchname; I(restricted_rev.edges.size() == 1); set heads; app.get_project().get_branch_heads(app.opts.branch_name, heads); unsigned int old_head_size = heads.size(); - if (app.opts.branch_name() != "") - branchname = app.opts.branch_name(); - else - guess_branch(edge_old_revision(restricted_rev.edges.begin()), app, branchname); + // We need the 'if' because guess_branch will try to override any branch + // picked up from _MTN/options. + if (app.opts.branch_name().empty()) + guess_branch(edge_old_revision(restricted_rev.edges.begin()), app); { // fail early if there isn't a key @@ -756,7 +753,7 @@ CMD(commit, N_("workspace"), N_("[PATH]. get_user_key(key, app); } - P(F("beginning commit on branch '%s'") % branchname); + P(F("beginning commit on branch '%s'") % app.opts.branch_name); L(FL("new manifest '%s'\n" "new revision '%s'\n") % restricted_rev.new_manifest @@ -800,7 +797,7 @@ CMD(commit, N_("workspace"), N_("[PATH]. revision_data new_rev; write_revision(restricted_rev, new_rev); - app.lua.hook_validate_commit_message(log_message, new_rev, branchname, + app.lua.hook_validate_commit_message(log_message, new_rev, app.opts.branch_name, message_validated, reason); N(message_validated, F("log message rejected by hook: %s") % reason); @@ -890,9 +887,9 @@ CMD(commit, N_("workspace"), N_("[PATH]. dbw.consume_revision_data(restricted_rev_id, rdat); app.get_project().put_standard_certs_from_options(restricted_rev_id, - branchname(), - log_message(), - dbw); + app.opts.branch_name, + log_message, + dbw); guard.commit(); } @@ -986,8 +983,7 @@ CMD_NO_WORKSPACE(import, N_("tree"), N_( N(app.db.revision_exists(ident), F("no such revision '%s'") % ident); - cert_value b; - guess_branch(ident, app, b); + guess_branch(ident, app); I(!app.opts.branch_name().empty()); ============================================================ --- commands.cc 0790260cd921d2cbaf2f863d78be5101e292a9bf +++ commands.cc cde5025967e84a100385148780e1ac53ac834908 @@ -405,7 +405,7 @@ complete(app_state & app, if (str.find_first_not_of(constants::legal_id_bytes) == string::npos && str.size() == constants::idlen) { - completion.insert(revision_id(str)); + completion.insert(revision_id(hexenc(id(str)))); if (must_exist) N(app.db.revision_exists(*completion.begin()), F("no such revision '%s'") % *completion.begin()); @@ -428,7 +428,8 @@ complete(app_state & app, for (set::const_iterator i = completions.begin(); i != completions.end(); ++i) { - pair::const_iterator, bool> p = completion.insert(revision_id(*i)); + pair::const_iterator, bool> p = + completion.insert(revision_id(hexenc(id(*i)))); P(F("expanded to '%s'") % *(p.first)); } } @@ -487,17 +488,17 @@ process_commit_message_args(bool & given join_lines(app.opts.message, msg); log_message = utf8(msg); if (message_prefix().length() != 0) - log_message = message_prefix() + "\n\n" + log_message(); + log_message = utf8(message_prefix() + "\n\n" + log_message()); given = true; } else if (app.opts.msgfile_given) { data dat; read_data_for_command_line(app.opts.msgfile, dat); - external dat2 = dat(); + external dat2 = external(dat()); system_to_utf8(dat2, log_message); if (message_prefix().length() != 0) - log_message = message_prefix() + "\n\n" + log_message(); + log_message = utf8(message_prefix() + "\n\n" + log_message()); given = true; } else if (message_prefix().length() != 0) ============================================================ --- constants.cc aa685613113f5ba800e3c64cc209e93072f86e7b +++ constants.cc c5e10e88b205a1cbe015f4f401c4df66ac53c4b0 @@ -154,7 +154,7 @@ namespace constants size_t const netsync_session_key_length_in_bytes = 20; // 160 bits size_t const netsync_hmac_value_length_in_bytes = 20; // 160 bits - string const & netsync_key_initializer = string(netsync_session_key_length_in_bytes, 0); + netsync_session_key const netsync_key_initializer(string(netsync_session_key_length_in_bytes, 0)); // attributes string const encoding_attribute("mtn:encoding"); ============================================================ --- constants.hh ce01c73109bbe256a6ff1c75e6a3395e2b0e0b53 +++ constants.hh b9bc0cea940b4be75380a952b9988329af48f397 @@ -13,6 +13,7 @@ #include #include #include "numeric_vocab.hh" +#include "vocab.hh" namespace constants { @@ -156,7 +157,7 @@ namespace constants static size_t const sha1_digest_length = 20; // 160 bits // netsync session key default initializer - extern std::string const & netsync_key_initializer; + extern netsync_session_key const netsync_key_initializer; // attributes extern std::string const encoding_attribute; ============================================================ --- cset.cc 32d57144f8b23e78f35e35eef33f5ed0a4421fc1 +++ cset.cc 0f35a5dc5cfdd76f49eea3276302ee065511ff01 @@ -418,7 +418,7 @@ parse_cset(basic_io::parser & parser, parse_path(parser, p1); parser.esym(syms::attr); parser.str(t1); - pair new_pair(p1, t1); + pair new_pair(p1, attr_key(t1)); I(prev_pair.first.empty() || new_pair > prev_pair); prev_pair = new_pair; safe_insert(cs.attrs_cleared, new_pair); @@ -431,7 +431,7 @@ parse_cset(basic_io::parser & parser, parse_path(parser, p1); parser.esym(syms::attr); parser.str(t1); - pair new_pair(p1, t1); + pair new_pair(p1, attr_key(t1)); I(prev_pair.first.empty() || new_pair > prev_pair); prev_pair = new_pair; parser.esym(syms::value); ============================================================ --- database.cc 688eaa61e7485a72cc4593c8f90f6d0b5cf6f832 +++ database.cc a2491c66f2f75e27dac3dc921b3e13a2d2b90990 @@ -937,7 +937,7 @@ database::file_or_manifest_base_exists(h std::string const & table) { // just check for a delayed file, since there are no delayed manifests - if (have_delayed_file(ident)) + if (have_delayed_file(file_id(ident))) return true; return table_has_entry(ident(), "id", table); } @@ -1110,7 +1110,7 @@ database::get_roster_base(string const & gzip dat_packed(res[0][1]); data dat; decode_gzip(dat_packed, dat); - read_roster_and_marking(dat, roster, marking); + read_roster_and_marking(roster_data(dat), roster, marking); } void @@ -1130,7 +1130,7 @@ database::get_roster_delta(string const gzip del_packed(res[0][1]); delta tmp; decode_gzip(del_packed, tmp); - del = tmp; + del = roster(tmp); } void @@ -1266,7 +1266,7 @@ database::get_version(hexenc const & I(!selected_path.empty()); - hexenc curr = selected_path.back(); + hexenc curr = hexenc(selected_path.back()); selected_path.pop_back(); data begin; @@ -1281,13 +1281,13 @@ database::get_version(hexenc const & for (reconstruction_path::reverse_iterator i = selected_path.rbegin(); i != selected_path.rend(); ++i) { - hexenc const nxt = *i; + hexenc const nxt = hexenc(*i); if (!vcache.exists(curr())) { string tmp; appl->finish(tmp); - vcache.insert_clean(curr(), tmp); + vcache.insert_clean(curr(), data(tmp)); } L(FL("following delta %s -> %s") % curr % nxt); @@ -1407,7 +1407,7 @@ database::file_version_exists(file_id co database::file_version_exists(file_id const & id) { return delta_exists(id.inner()(), "file_deltas") - || file_or_manifest_base_exists(id.inner()(), "files"); + || file_or_manifest_base_exists(id.inner(), "files"); } bool @@ -1427,6 +1427,19 @@ database::revision_exists(revision_id co return res.size() == 1; } +template +To add_decoration(From const & from) +{ + return To(from); +} + +template +void add_decoration_to_container(From const & from, To & to) +{ + transform(from.begin(), from.end(), std::inserter(to, to.end()), + &add_decoration); +} + void database::get_file_ids(set & ids) { @@ -1434,7 +1447,7 @@ database::get_file_ids(set & id set< hexenc > tmp; get_ids("files", tmp); get_ids("file_deltas", tmp); - ids.insert(tmp.begin(), tmp.end()); + add_decoration_to_container(tmp, ids); } void @@ -1443,7 +1456,7 @@ database::get_revision_ids(set > tmp; get_ids("revisions", tmp); - ids.insert(tmp.begin(), tmp.end()); + add_decoration_to_container(tmp, ids); } void @@ -1452,9 +1465,9 @@ database::get_roster_ids(set > tmp; get_ids("rosters", tmp); - ids.insert(tmp.begin(), tmp.end()); + add_decoration_to_container(tmp, ids); get_ids("roster_deltas", tmp); - ids.insert(tmp.begin(), tmp.end()); + add_decoration_to_container(tmp, ids); } void @@ -1463,7 +1476,7 @@ database::get_file_version(file_id const { data tmp; get_version(id.inner(), tmp, "files", "file_deltas"); - dat = tmp; + dat = file_data(tmp); } void @@ -1472,7 +1485,7 @@ database::get_manifest_version(manifest_ { data tmp; get_version(id.inner(), tmp, "manifests", "manifest_deltas"); - dat = tmp; + dat = manifest_data(tmp); } void @@ -1494,12 +1507,12 @@ database::put_file_version(file_id const { data tmp; patch(old_data.inner(), del.inner(), tmp); - new_data = tmp; + new_data = file_data(tmp); } { string tmp; invert_xdelta(old_data.inner()(), del.inner()(), tmp); - reverse_delta = delta(tmp); + reverse_delta = file_delta(tmp); data old_tmp; hexenc old_tmp_id; patch(new_data.inner(), reverse_delta.inner(), old_tmp); @@ -1646,11 +1659,11 @@ database::get_revision(revision_id const // verify that we got a revision with the right id { revision_id tmp; - calculate_ident(rdat, tmp); + calculate_ident(revision_data(rdat), tmp); I(id == tmp); } - dat = rdat; + dat = revision_data(rdat); } void @@ -1714,7 +1727,7 @@ database::deltify_revision(revision_id c j = edge_changes(i).deltas_applied.begin(); j != edge_changes(i).deltas_applied.end(); ++j) { - if (file_or_manifest_base_exists(delta_entry_src(j).inner()(), "files") && + if (file_or_manifest_base_exists(delta_entry_src(j).inner(), "files") && file_version_exists(delta_entry_dst(j))) { file_data old_data; @@ -1958,7 +1971,7 @@ database::get_key_ids(string const & pat query("SELECT id FROM public_keys")); for (size_t i = 0; i < res.size(); ++i) - pubkeys.push_back(res[i][0]); + pubkeys.push_back(rsa_keypair_id(res[i][0])); } void @@ -1968,7 +1981,7 @@ database::get_keys(string const & table, results res; fetch(res, one_col, any_rows, query("SELECT id FROM " + table)); for (size_t i = 0; i < res.size(); ++i) - keys.push_back(res[i][0]); + keys.push_back(rsa_keypair_id(res[i][0])); } void @@ -2012,7 +2025,7 @@ database::get_pubkey(hexenc const & fetch(res, 2, one_row, query("SELECT id, keydata FROM public_keys WHERE hash = ?") % text(hash())); - id = res[0][0]; + id = rsa_keypair_id(res[0][0]); encode_base64(rsa_pub_key(res[0][1]), pub_encoded); } @@ -2266,7 +2279,7 @@ database::get_revision_certs(vector< rev vector certs; get_certs(certs, "revision_certs"); ts.clear(); - copy(certs.begin(), certs.end(), back_inserter(ts)); + add_decoration_to_container(certs, ts); return cert_stamper.get_indicator(); } @@ -2277,7 +2290,7 @@ database::get_revision_certs(cert_name c vector certs; get_certs(name, certs, "revision_certs"); ts.clear(); - copy(certs.begin(), certs.end(), back_inserter(ts)); + add_decoration_to_container(certs, ts); return cert_stamper.get_indicator(); } @@ -2289,7 +2302,7 @@ database::get_revision_certs(revision_id vector certs; get_certs(id.inner(), name, certs, "revision_certs"); ts.clear(); - copy(certs.begin(), certs.end(), back_inserter(ts)); + add_decoration_to_container(certs, ts); return cert_stamper.get_indicator(); } @@ -2302,7 +2315,7 @@ database::get_revision_certs(revision_id vector certs; get_certs(id.inner(), name, val, certs, "revision_certs"); ts.clear(); - copy(certs.begin(), certs.end(), back_inserter(ts)); + add_decoration_to_container(certs, ts); return cert_stamper.get_indicator(); } @@ -2330,7 +2343,7 @@ database::get_revision_certs(cert_name c vector certs; get_certs(name, val, certs, "revision_certs"); ts.clear(); - copy(certs.begin(), certs.end(), back_inserter(ts)); + add_decoration_to_container(certs, ts); return cert_stamper.get_indicator(); } @@ -2341,7 +2354,7 @@ database::get_revision_certs(revision_id vector certs; get_certs(id.inner(), certs, "revision_certs"); ts.clear(); - copy(certs.begin(), certs.end(), back_inserter(ts)); + add_decoration_to_container(certs, ts); return cert_stamper.get_indicator(); } @@ -2399,7 +2412,7 @@ database::get_manifest_certs(manifest_id vector certs; get_certs(id.inner(), certs, "manifest_certs"); ts.clear(); - copy(certs.begin(), certs.end(), back_inserter(ts)); + add_decoration_to_container(certs, ts); } @@ -2410,7 +2423,7 @@ database::get_manifest_certs(cert_name c vector certs; get_certs(name, certs, "manifest_certs"); ts.clear(); - copy(certs.begin(), certs.end(), back_inserter(ts)); + add_decoration_to_container(certs, ts); } @@ -2479,7 +2492,7 @@ static void selector_to_certname(selecto using selectors::selector_type; static void selector_to_certname(selector_type ty, - string & s, + cert_name & name, string & prefix, string & suffix) { @@ -2488,24 +2501,24 @@ static void selector_to_certname(selecto { case selectors::sel_author: prefix = suffix = ""; - s = author_cert_name; + name = author_cert_name; break; case selectors::sel_branch: prefix = suffix = ""; - s = branch_cert_name; + name = branch_cert_name; break; case selectors::sel_head: prefix = suffix = ""; - s = branch_cert_name; + name = branch_cert_name; break; case selectors::sel_date: case selectors::sel_later: case selectors::sel_earlier: - s = date_cert_name; + name = date_cert_name; break; case selectors::sel_tag: prefix = suffix = ""; - s = tag_cert_name; + name = tag_cert_name; break; case selectors::sel_ident: case selectors::sel_cert: @@ -2578,7 +2591,7 @@ void database::complete(selector_type ty else if (i->first == selectors::sel_unknown) { lim.sql_cmd += "SELECT id FROM revision_certs WHERE (name=? OR name=? OR name=?)"; - lim % text(author_cert_name) % text(tag_cert_name) % text(branch_cert_name); + lim % text(author_cert_name()) % text(tag_cert_name()) % text(branch_cert_name()); lim.sql_cmd += " AND CAST(value AS TEXT) glob ?"; lim % text(i->second + "*"); } @@ -2593,7 +2606,7 @@ void database::complete(selector_type ty } else { - __app->get_project().get_branch_list(i->second, branch_names); + __app->get_project().get_branch_list(utf8(i->second), branch_names); } // for each branch name, get the branch heads @@ -2625,7 +2638,7 @@ void database::complete(selector_type ty } else { - string certname; + cert_name certname; string prefix; string suffix; selector_to_certname(i->first, certname, prefix, suffix); @@ -2634,13 +2647,13 @@ void database::complete(selector_type ty { __app->require_workspace("the empty branch selector b: refers to the current branch"); lim.sql_cmd += "SELECT id FROM revision_certs WHERE name=? AND CAST(value AS TEXT) glob ?"; - lim % text(branch_cert_name) % text(__app->opts.branch_name()); + lim % text(branch_cert_name()) % text(__app->opts.branch_name()); L(FL("limiting to current branch '%s'") % __app->opts.branch_name); } else { lim.sql_cmd += "SELECT id FROM revision_certs WHERE name=? AND "; - lim % text(certname); + lim % text(certname()); switch (i->first) { case selectors::sel_earlier: @@ -2679,14 +2692,14 @@ void database::complete(selector_type ty if (ty == selectors::sel_unknown) { lim.sql_cmd += " (name=? OR name=? OR name=?)"; - lim % text(author_cert_name) % text(tag_cert_name) % text(branch_cert_name); + lim % text(author_cert_name()) % text(tag_cert_name()) % text(branch_cert_name()); } else { - string certname; + cert_name certname; selector_to_certname(ty, certname, prefix, suffix); lim.sql_cmd += " (name=?)"; - lim % text(certname); + lim % text(certname()); } lim.sql_cmd += " AND (CAST(value AS TEXT) GLOB ?) AND (id IN " + lim.sql_cmd + ")"; ============================================================ --- database_check.cc 08c81eb4ad5e70f47be3920a41ef7a2a33480a14 +++ database_check.cc c36d3bf08726f6cb236f6f7b0757cc4d36f40a6b @@ -475,7 +475,7 @@ check_certs(app_state & app, } checked_keys[i->inner().key].sigs++; - checked_revisions[i->inner().ident].checked_certs.push_back(checked); + checked_revisions[revision_id(i->inner().ident)].checked_certs.push_back(checked); ++ticks; } ============================================================ --- diff_patch.cc a8b1d3481a4ff79239887399a16f224df14a408a +++ diff_patch.cc d23d8030dab765435e0e23847d40cb536bded9ec @@ -614,11 +614,11 @@ content_merge_workspace_adaptor::get_ver F("file '%s' does not exist in workspace") % path, F("'%s' in workspace is a directory, not a file") % path); read_localized_data(path, tmp, app.lua); - calculate_ident(tmp, fid); + calculate_ident(file_data(tmp), fid); E(fid == ident, F("file %s in workspace has id %s, wanted %s") % path % fid % ident); - dat = tmp; + dat = file_data(tmp); } } @@ -646,7 +646,7 @@ content_merger::get_file_encoding(file_p attr_value v; split_path sp; path.split(sp); - if (ros.get_attr(sp, constants::encoding_attribute, v)) + if (ros.get_attr(sp, attr_key(constants::encoding_attribute), v)) return v(); return constants::default_encoding; } @@ -658,7 +658,7 @@ content_merger::attribute_manual_merge(f attr_value v; split_path sp; path.split(sp); - if (ros.get_attr(sp, constants::manual_merge_attribute, v) + if (ros.get_attr(sp, attr_key(constants::manual_merge_attribute), v) && v() == "true") return true; return false; // default: enable auto merge ============================================================ --- file_io.cc 2128664fe9acc07e084954a0bfa9a2f023282dd0 +++ file_io.cc 8568e68ad3692c88cdb43dc849796e56b6148e5f @@ -322,7 +322,7 @@ read_data(any_path const & p, data & dat pipe.start_msg(); file >> pipe; pipe.end_msg(); - dat = pipe.read_all_as_string(); + dat = data(pipe.read_all_as_string()); } void read_directory(any_path const & path, @@ -362,7 +362,7 @@ read_data_stdin(data & dat) pipe.start_msg(); cin >> pipe; pipe.end_msg(); - dat = pipe.read_all_as_string(); + dat = data(pipe.read_all_as_string()); } void ============================================================ --- inodeprint.cc b548d939b5015b12601c390ea951962a14025694 +++ inodeprint.cc 9c3963b93fb6ba7736654c2f67c92dde49fe146a @@ -100,10 +100,10 @@ write_inodeprint_map(inodeprint_map cons { basic_io::stanza st; st.push_file_pair(syms::file, i->first); - st.push_hex_pair(syms::print, i->second()); + st.push_hex_pair(syms::print, hexenc(i->second())); pr.print_stanza(st); } - dat = pr.buf; + dat = data(pr.buf); } class my_iprint_calc : public inodeprint_calculator ============================================================ --- keys.cc efbfa847a462a569d0747cf409380793585a25d7 +++ keys.cc 4a058060b5a56df134ca3c1d418b810c644712bd @@ -493,7 +493,7 @@ read_pubkey(string const & in, size_t pos = 0; extract_variable_length_string(in, tmp_id, pos, "pubkey id"); extract_variable_length_string(in, tmp_key, pos, "pubkey value"); - id = tmp_id; + id = rsa_keypair_id(tmp_id); encode_base64(rsa_pub_key(tmp_key), pub); } ============================================================ --- localized_file_io.cc 4cad41827577db94bbbaa0ce2966fee24eef9548 +++ localized_file_io.cc 743d2969539eb07854546c2d21100c76bcd91de0 @@ -60,7 +60,7 @@ read_localized_data(file_path const & pa tmp1 = tmp2; line_end_convert(db_linesep, tmp1, tmp2); } - dat = tmp2; + dat = data(tmp2); } void @@ -120,7 +120,7 @@ calculate_ident(file_path const & file, Botan::DataSource_Stream infile(file.as_external(), true); p.process_msg(infile); - ident = lowercase(p.read_all_as_string()); + ident = hexenc(lowercase(p.read_all_as_string())); } } ============================================================ --- lua.cc e0af7e037ef78d315f4fa61c58f7f11c4ec25768 +++ lua.cc 2f678713385631c4ca9782e9b767651d2f26ab21 @@ -518,9 +518,8 @@ LUAEXT(includedirpattern, ) // directory, iterate over it, skipping subdirs, taking every filename // matching the pattern, sorting them and loading in sorted order fs::directory_iterator it(locpath); - string r(pattern); - string n; - globish_matcher glob(r, n); + utf8 r = utf8(string(pattern)); + globish_matcher glob(r, utf8()); vector arr; while (it != fs::directory_iterator()) { ============================================================ --- lua_hooks.cc 2ba09f87d8dc16a1957cad5abc98565a7c87cc7c +++ lua_hooks.cc bbb38333f2877533b42a2bedf90f518114a1b926 @@ -253,7 +253,7 @@ bool } bool -lua_hooks::hook_get_branch_key(cert_value const & branchname, +lua_hooks::hook_get_branch_key(utf8 const & branchname, rsa_keypair_id & k) { string key; @@ -264,12 +264,12 @@ lua_hooks::hook_get_branch_key(cert_valu .extract_str(key) .ok(); - k = key; + k = rsa_keypair_id(key); return ok; } bool -lua_hooks::hook_get_author(cert_value const & branchname, +lua_hooks::hook_get_author(utf8 const & branchname, string & author) { return Lua(st) @@ -293,7 +293,7 @@ lua_hooks::hook_edit_comment(external co .call(2,1) .extract_str(result_str) .ok(); - result = result_str; + result = external(result_str); return is_ok; } @@ -437,7 +437,7 @@ lua_hooks::hook_merge3(file_path const & .call(7,1) .extract_str(res) .ok(); - result = res; + result = data(res); return ok; } @@ -788,7 +788,7 @@ lua_hooks::hook_validate_commit_message( bool lua_hooks::hook_validate_commit_message(utf8 const & message, revision_data const & new_rev, - cert_value const & branchname, + utf8 const & branchname, bool & validated, string & reason) { ============================================================ --- lua_hooks.hh 7442504bf6a1fff7e6afe120d6883198f5303842 +++ lua_hooks.hh 3117a32b7a9aa1198111be385327b7d55276e08c @@ -44,9 +44,9 @@ public: // cert hooks bool hook_expand_selector(std::string const & sel, std::string & exp); bool hook_expand_date(std::string const & sel, std::string & exp); - bool hook_get_branch_key(cert_value const & branchname, rsa_keypair_id & k); + bool hook_get_branch_key(utf8 const & branchname, rsa_keypair_id & k); bool hook_get_passphrase(rsa_keypair_id const & k, std::string & phrase); - bool hook_get_author(cert_value const & branchname, std::string & author); + bool hook_get_author(utf8 const & branchname, std::string & author); bool hook_edit_comment(external const & commentary, external const & user_log_message, external & result); @@ -120,7 +120,7 @@ public: // validation hooks bool hook_validate_commit_message(utf8 const & message, revision_data const & new_rev, - cert_value const & branchname, + utf8 const & branchname, bool & validated, std::string & reason); ============================================================ --- luaext_globish.cc 15a2b081a967e4f97702f05b14099bd6c9f377d3 +++ luaext_globish.cc cbce64612aa5d0ca8542dcb10d54c6839d839d79 @@ -15,7 +15,7 @@ LUAEXT(match, globish) string r(re); string n; string s(str); - result = globish_matcher(r, n)(s); + result = globish_matcher(utf8(r), utf8(n))(s); } catch (informative_failure & e) { return luaL_error(L, e.what()); } catch (boost::bad_pattern & e) { ============================================================ --- merkle_tree.cc d39fdb1402dca3c6f81a9a1b37ff6193690894f6 +++ merkle_tree.cc 6b8dba1c330871b6f44eeefcaa4f3de1efe1cb6f @@ -315,7 +315,7 @@ read_node(string const & inbuf, size_t & string slot_val = extract_substring(inbuf, pos, constants::merkle_hash_length_in_bytes, "slot value"); - out.set_raw_slot(slot, slot_val); + out.set_raw_slot(slot, id(slot_val)); } } ============================================================ --- monotone.cc eca87b7afbcce22d039be4b46b43240069177c26 +++ monotone.cc eb5b5c41da9e81aad0ffb91818c016a5628e85d9 @@ -197,7 +197,7 @@ cpp_main(int argc, char ** argv) if (prog_name.rfind(".exe") == prog_name.size() - 4) prog_name = prog_name.substr(0, prog_name.size() - 4); utf8 prog_name_u; - system_to_utf8(prog_name, prog_name_u); + system_to_utf8(external(prog_name), prog_name_u); ui.prog_name = prog_name_u(); I(!ui.prog_name.empty()); } ============================================================ --- netcmd.cc aec74e6839c0e64afce5066d350b4aef9e5a1e94 +++ netcmd.cc aa9c61e301fc6c077007dd9008f49765f839ff81 @@ -457,7 +457,7 @@ netcmd::write_data_cmd(netcmd_item_type if (dat.size() > constants::netcmd_minimum_bytes_to_bother_with_gzip) { gzip zdat; - encode_gzip(dat, zdat); + encode_gzip(data(dat), zdat); payload += static_cast(1); // compressed flag insert_variable_length_string(zdat(), payload); } @@ -495,7 +495,7 @@ netcmd::read_delta_cmd(netcmd_item_type } else { - del = tmp; + del = delta(tmp); } assert_end_of_buffer(payload, pos, "delta netcmd payload"); } ============================================================ --- netsync.cc 83d9a60c55b895f2a6d75103bc82ddad930867a1 +++ netsync.cc 6e345e2b5623d96d05acc870dcbbfb21850fa677 @@ -562,7 +562,7 @@ session::~session() i != written_certs.end(); ++i) { map >::iterator j; - j = revcerts.find(i->ident); + j = revcerts.find(revision_id(i->ident)); if (j == revcerts.end()) unattached_certs.push_back(*i); else @@ -607,7 +607,7 @@ session::~session() { cert_value tmp; decode_base64(i->value, tmp); - app.lua.hook_note_netsync_cert_received(i->ident, i->key, + app.lua.hook_note_netsync_cert_received(revision_id(i->ident), i->key, i->name, tmp, session_id); } } @@ -639,7 +639,7 @@ session::queue_this_file(hexenc cons bool session::queue_this_file(hexenc const & f) { - return file_items_sent.find(f) == file_items_sent.end(); + return file_items_sent.find(file_id(f)) == file_items_sent.end(); } void @@ -720,7 +720,7 @@ session::mk_nonce() char buf[constants::merkle_hash_length_in_bytes]; Botan::Global_RNG::randomize(reinterpret_cast(buf), constants::merkle_hash_length_in_bytes); - this->saved_nonce = string(buf, buf + constants::merkle_hash_length_in_bytes); + this->saved_nonce = id(string(buf, buf + constants::merkle_hash_length_in_bytes)); I(this->saved_nonce().size() == constants::merkle_hash_length_in_bytes); return this->saved_nonce; } @@ -2031,7 +2031,7 @@ session::process_usher_cmd(utf8 const & L(FL("Received greeting from usher: %s") % msg().substr(1)); } netcmd cmdout; - cmdout.write_usher_reply_cmd(peer_id, our_include_pattern); + cmdout.write_usher_reply_cmd(utf8(peer_id), our_include_pattern); write_netcmd_and_try_flush(cmdout); L(FL("Sent reply.")); return true; ============================================================ --- option.cc c3e2f5ab0602e87822289368f48979be3ebcc85e +++ option.cc 599f4f7ffea913627169c06d4130207c3f2d2479 @@ -347,7 +347,7 @@ void concrete_option_set::from_command_l { // expand the --xargs in place data dat; - read_data_for_command_line(arg, dat); + read_data_for_command_line(utf8(arg), dat); vector fargs; tokenize_for_command_line(dat(), fargs); ============================================================ --- options_list.hh dd7ba046fe78fb3c698d49934ed724922868b3c4 +++ options_list.hh bdf99561b7ca94bcf196ca26b8d192d8d74f1492 @@ -19,7 +19,7 @@ OPT(author, "author", utf8, , gettext_no OPT(author, "author", utf8, , gettext_noop("override author for commit")) #ifdef option_bodies { - author = arg; + author = utf8(arg); } #endif @@ -450,7 +450,7 @@ OPTION(revision, revision, true, "revisi gettext_noop("select revision id for operation")) #ifdef option_bodies { - revision_selectors.push_back(arg); + revision_selectors.push_back(utf8(arg)); } #endif ============================================================ --- packet.cc a59b48af0d11f15f912c85e5cc53a04f7f17b5f9 +++ packet.cc 321c141f57b042254693ac087ad31b7c13d8f6f8 @@ -428,8 +428,8 @@ feed_packet_consumer require(regex_match(args, regex(key))); match_results matches; require(regex_match(body, matches, regex(base + "#" + base))); - string pub_dat(trim_ws(string(matches[1].first, matches[1].second))); - string priv_dat(trim_ws(string(matches[2].first, matches[2].second))); + base64 pub_dat(trim_ws(string(matches[1].first, matches[1].second))); + base64 priv_dat(trim_ws(string(matches[2].first, matches[2].second))); cons.consume_key_pair(rsa_keypair_id(args), keypair(pub_dat, priv_dat)); } else if (type == "privkey") ============================================================ --- paths.cc 16c9c7c98129e61004f883895ceb0c484dfd06a7 +++ paths.cc 5ecb3102980dd8fc2a6966a5dffc61ba3dd0760f @@ -185,14 +185,14 @@ fully_normalized_path_split(string const if (bad_component(s)) return false; if (want_split) - sp.push_back(s); + sp.push_back(path_component(s)); break; } string const & s(path.substr(start, stop - start)); if (bad_component(s)) return false; if (want_split) - sp.push_back(s); + sp.push_back(path_component(s)); start = stop + 1; } return true; @@ -242,7 +242,7 @@ internal_string_to_split_path(string con void internal_string_to_split_path(string const & path, split_path & sp) { - I(utf8_validate(path)); + I(utf8_validate(utf8(path))); I(!in_bookkeeping_dir(path)); sp.clear(); sp.reserve(8); @@ -292,11 +292,11 @@ file_path::file_path(file_path::source_t { string normalized; MM(path); - I(utf8_validate(path)); + I(utf8_validate(utf8(path))); switch (type) { case internal: - data = path; + data = utf8(path); break; case external: normalize_external_path(path, normalized); @@ -312,7 +312,7 @@ bookkeeping_path::bookkeeping_path(strin { I(fully_normalized_path(path)); I(in_bookkeeping_dir(path)); - data = path; + data = utf8(path); } bool @@ -357,7 +357,7 @@ file_path::file_path(split_path const & start = false; } I(!in_bookkeeping_dir(tmp)); - data = tmp; + data = utf8(tmp); } // @@ -387,10 +387,10 @@ file_path::split(split_path & sp) const stop = s.find('/', start); if (stop == string::npos) { - sp.push_back(s.substr(start)); + sp.push_back(path_component(s.substr(start))); break; } - sp.push_back(s.substr(start, stop - start)); + sp.push_back(path_component(s.substr(start, stop - start))); start = stop + 1; } } @@ -546,7 +546,7 @@ system_path::system_path(any_path const if (is_absolute_here(other.as_internal())) // another system_path. the normalizing isn't really necessary, but it // makes me feel warm and fuzzy. - data = normalize_out_dots(other.as_internal()); + data = utf8(normalize_out_dots(other.as_internal())); else { system_path wr; @@ -554,7 +554,7 @@ system_path::system_path(any_path const wr = working_root.get(); else wr = working_root.get_but_unused(); - data = normalize_out_dots((wr / other.as_internal()).as_internal()); + data = utf8(normalize_out_dots((wr / other.as_internal()).as_internal())); } } @@ -570,12 +570,12 @@ system_path::system_path(string const & system_path::system_path(string const & path) { - data = const_system_path(path); + data = utf8(const_system_path(utf8(path))); } system_path::system_path(utf8 const & path) { - data = const_system_path(path); + data = utf8(const_system_path(utf8(path))); } /////////////////////////////////////////////////////////////////////////// @@ -826,7 +826,7 @@ static void check_fp_normalizes_to(char static void check_fp_normalizes_to(char * before, char * after) { L(FL("check_fp_normalizes_to: '%s' -> '%s'") % before % after); - file_path fp = file_path_external(string(before)); + file_path fp = file_path_external(utf8(before)); L(FL(" (got: %s)") % fp); BOOST_CHECK(fp.as_internal() == after); BOOST_CHECK(file_path_internal(fp.as_internal()) == fp); @@ -1217,7 +1217,7 @@ UNIT_TEST(paths, system) BOOST_CHECK(system_path(file_path_internal("foo/bar")).as_internal() == "/working/root/foo/bar"); BOOST_CHECK(working_root.used); - BOOST_CHECK(system_path(file_path_external(string("foo/bar"))).as_external() + BOOST_CHECK(system_path(file_path_external(utf8("foo/bar"))).as_external() == "/working/root/rel/initial/foo/bar"); file_path a_file_path; BOOST_CHECK(system_path(a_file_path).as_external() ============================================================ --- platform-wrapped.hh 7cf361939c769f88b68ad765ae8f44eacb05fcf2 +++ platform-wrapped.hh 571fae420ef32c370127b56311cba9fc49819237 @@ -7,7 +7,7 @@ inline utf8 tilde_expand(utf8 const & pa inline utf8 tilde_expand(utf8 const & path) { - return tilde_expand(path()); + return utf8(tilde_expand(path())); } inline void change_current_working_dir(any_path const & to) ============================================================ --- project.cc 475fc4f2238cd96630dd2563874953ad077c5dbf +++ project.cc 106438500b4c6e9b1c2a742180557ca6c8f14840 @@ -39,7 +39,7 @@ project_t::get_branch_list(std::set::iterator i = got.begin(); i != got.end(); ++i) { - branches.insert(*i); + branches.insert(utf8(*i)); } } @@ -56,7 +56,7 @@ project_t::get_branch_list(utf8 const & for (std::vector::iterator i = got.begin(); i != got.end(); ++i) { - names.insert(*i); + names.insert(utf8(*i)); } } @@ -225,7 +225,7 @@ project_t::get_tags(set & tags) { cert_value value; decode_base64(i->inner().value, value); - tags.insert(tag_t(i->inner().ident, value(), i->inner().key)); + tags.insert(tag_t(revision_id(i->inner().ident), utf8(value()), i->inner().key)); } return i; } @@ -242,7 +242,7 @@ project_t::put_standard_certs(revision_i void project_t::put_standard_certs(revision_id const & id, utf8 const & branch, - string const & changelog, + utf8 const & changelog, boost::posix_time::ptime const & time, utf8 const & author, packet_consumer & pc) @@ -259,7 +259,7 @@ project_t::put_standard_certs_from_optio void project_t::put_standard_certs_from_options(revision_id const & id, utf8 const & branch, - string const & changelog, + utf8 const & changelog, packet_consumer & pc) { put_standard_certs(id, ============================================================ --- project.hh 9dc3c6c9ee83a837062380a2a3e4f47eb10c3fe1 +++ project.hh a37c5c9c535fdf22e8a41c3c4ef1cb8b8d8a12e0 @@ -70,13 +70,13 @@ public: void put_standard_certs(revision_id const & id, utf8 const & branch, - string const & changelog, + utf8 const & changelog, boost::posix_time::ptime const & time, utf8 const & author, packet_consumer & pc); void put_standard_certs_from_options(revision_id const & id, utf8 const & branch, - string const & changelog, + utf8 const & changelog, packet_consumer & pc); void put_cert(revision_id const & id, ============================================================ --- rcs_import.cc 7cd5a5487b252ade9f829d7770445eacad0cbee3 +++ rcs_import.cc bd306d490d071237ee799494c623ec73dade5b06 @@ -465,7 +465,7 @@ rcs_put_raw_file_edge(hexenc const & return; } - if (db.file_version_exists(old_id)) + if (db.file_version_exists(file_id(old_id))) { // we already have a way to get to this old version, // no need to insert another reconstruction path @@ -473,7 +473,7 @@ rcs_put_raw_file_edge(hexenc const & } else { - I(db.file_or_manifest_base_exists(new_id(), "files") + I(db.file_or_manifest_base_exists(new_id, "files") || db.delta_exists(new_id(), "file_deltas")); db.put_file_delta(file_id(old_id), file_id(new_id), file_delta(del)); } @@ -495,7 +495,7 @@ insert_into_db(data const & curr_data, { string tmp; global_pieces.build_string(next_lines, tmp); - next_data = tmp; + next_data = data(tmp); } delta del; diff(curr_data, next_data, del); @@ -583,7 +583,7 @@ process_branch(string const & begin_vers { L(FL("version %s has %d lines") % curr_version % curr_lines->size()); - cvs_commit curr_commit(r, curr_version, curr_id, cvs); + cvs_commit curr_commit(r, curr_version, file_id(curr_id), cvs); if (!curr_commit.is_synthetic_branch_root) { cvs.stk.top()->append_commit(curr_commit); @@ -683,14 +683,14 @@ import_rcs_file_with_cvs(string const & hexenc id; data dat(r.deltatexts.find(r.admin.head)->second->text); calculate_ident(dat, id); - file_id fid = id; + file_id fid(id); cvs.set_filename (filename, fid); cvs.index_branchpoint_symbols (r); if (! db.file_version_exists (fid)) { - db.put_file(fid, dat); + db.put_file(fid, file_data(dat)); } { @@ -1388,11 +1388,11 @@ cluster_consumer::store_auxiliary_certs( } app.get_project().put_standard_certs(p.rid, - branchname, - cvs.changelog_interner.lookup(p.changelog), - time_from_time_t(p.time), - cvs.author_interner.lookup(p.author), - dbw); + utf8(branchname), + utf8(cvs.changelog_interner.lookup(p.changelog)), + time_from_time_t(p.time), + utf8(cvs.author_interner.lookup(p.author)), + dbw); } void ============================================================ --- revision.cc 94fd29b8e5b12a4926b7c0c444838d17414c5576 +++ revision.cc bef5e7e0b39b9f2f5621e2271ca39953c7fb7a61 @@ -663,7 +663,7 @@ make_revision_for_workspace(revision_id rev.edges.clear(); safe_insert(rev.edges, make_pair(old_rev_id, cs)); if (!null_id(old_rev_id)) - rev.new_manifest = fake_id(); + rev.new_manifest = manifest_id(fake_id()); rev.made_for = made_for_workspace; } @@ -1606,8 +1606,8 @@ build_changesets_from_manifest_ancestry( cert_value tv; decode_base64(i->inner().value, tv); manifest_id child, parent; - child = i->inner().ident; - parent = hexenc(tv()); + child = manifest_id(i->inner().ident); + parent = manifest_id(tv()); u64 parent_node = graph.add_node_for_old_manifest(parent); u64 child_node = graph.add_node_for_old_manifest(child); @@ -1861,7 +1861,7 @@ void calculate_ident(revision_t const & hexenc tid; write_revision(cs, tmp); calculate_ident(tmp, tid); - ident = tid; + ident = revision_id(tid); } #ifdef BUILD_UNIT_TESTS ============================================================ --- roster.cc 3e46ae0e6698e47779091ef0b39f66cd31b1f2e2 +++ roster.cc cef7d6a2672f9f042749dec58145e0274238c4f9 @@ -2569,7 +2569,7 @@ write_roster_and_marking(roster_t const ros.check_sane(true); basic_io::printer pr; ros.print_to(pr, mm, print_local_parts); - dat = pr.buf; + dat = data(pr.buf); } @@ -2580,7 +2580,7 @@ write_roster_and_marking(roster_t const { data tmp; write_roster_and_marking(ros, mm, tmp, true); - dat = tmp; + dat = roster_data(tmp); } @@ -2591,7 +2591,7 @@ write_manifest_of_roster(roster_t const data tmp; marking_map mm; write_roster_and_marking(ros, mm, tmp, false); - dat = tmp; + dat = manifest_data(tmp); } void calculate_ident(roster_t const & ros, ============================================================ --- schema_migration.cc 642fd28cf4c1e900dd1d747cbe1c8d1acec7ca02 +++ schema_migration.cc 8082b846efa50626de640b3728430e7d8297d8d2 @@ -495,8 +495,8 @@ migrate_to_external_privkeys(sqlite3 * d while (stmt.step()) { - rsa_keypair_id ident = stmt.column_string(0); - base64< arc4 > old_priv = stmt.column_string(1); + rsa_keypair_id ident(stmt.column_string(0)); + base64< arc4 > old_priv(stmt.column_string(1)); keypair kp; migrate_private_key(app, ident, old_priv, kp); @@ -504,7 +504,7 @@ migrate_to_external_privkeys(sqlite3 * d if (stmt.column_nonnull(2)) { - base64< rsa_pub_key > pub = stmt.column_string(2); + base64< rsa_pub_key > pub(stmt.column_string(2)); MM(pub); N(keys_match(ident, pub, ident, kp.pub), F("public and private keys for %s don't match") % ident); ============================================================ --- transforms.cc ff33922197e5107a27eb3cf106a989dfee2732a0 +++ transforms.cc 6e6641098498ee2cce52e6bc37bc784532fb6d5c @@ -145,7 +145,7 @@ void pack(T const & in, base64< gzip new Botan::Base64_Encoder); pipe.process_msg(in()); tmp = pipe.read_all_as_string(); - out = tmp; + out = base64< gzip >(tmp); } catch (Botan::Exception & e) { @@ -165,7 +165,7 @@ void unpack(base64< gzip > const & in new Botan::Gzip_Decompression()); pipe.process_msg(in()); tmp = pipe.read_all_as_string(); - out = tmp; + out = T(tmp); } catch (Botan::Exception & e) { @@ -198,7 +198,7 @@ patch(data const & olddata, { string result; apply_delta(olddata(), del(), result); - newdata = result; + newdata = data(result); } // identifier (a.k.a. sha1 signature) calculation @@ -212,7 +212,7 @@ calculate_ident(data const & dat, Botan::Pipe p(new Botan::Hash_Filter("SHA-160"), new Botan::Hex_Encoder(Botan::Hex_Encoder::Lowercase)); p.process_msg(dat()); - ident = p.read_all_as_string(); + ident = hexenc(p.read_all_as_string()); } catch (Botan::Exception & e) { @@ -226,7 +226,7 @@ calculate_ident(file_data const & dat, { hexenc tmp; calculate_ident(dat.inner(), tmp); - ident = tmp; + ident = file_id(tmp); } void @@ -235,7 +235,7 @@ calculate_ident(manifest_data const & da { hexenc tmp; calculate_ident(dat.inner(), tmp); - ident = tmp; + ident = manifest_id(tmp); } void @@ -244,7 +244,7 @@ calculate_ident(revision_data const & da { hexenc tmp; calculate_ident(dat.inner(), tmp); - ident = tmp; + ident = revision_id(tmp); } string ============================================================ --- transforms.hh 4294da861e7cc7780ab744745edf10c898ad8ea3 +++ transforms.hh 5d96e28af43c914295cc250c4e8a1708724511c5 @@ -50,22 +50,22 @@ void encode_base64(T const & in, base64< template void encode_base64(T const & in, base64 & out) -{ out = xform(in()); } +{ out = base64(T(xform(in()))); } template void decode_base64(base64 const & in, T & out) -{ out = xform(in()); } +{ out = T(xform(in())); } // hex encoding template void encode_hexenc(T const & in, hexenc & out) -{ out = xform(in()); } +{ out = hexenc(T(xform(in()))); } template void decode_hexenc(hexenc const & in, T & out) -{ out = xform(in()); } +{ out = T(xform(in())); } inline std::string encode_hexenc(std::string const & in) { return xform(in); } @@ -77,11 +77,11 @@ void encode_gzip(T const & in, gzip & template void encode_gzip(T const & in, gzip & out) -{ out = xform(in()); } +{ out = gzip(xform(in())); } template void decode_gzip(gzip const & in, T & out) -{ out = xform(in()); } +{ out = T(xform(in())); } // string variant for netsync template ============================================================ --- update.cc b0b042f58ab26cc380a3cc5c7669e928cd0e61f1 +++ update.cc 7bb7a4e2ae0cb21eae4aaa90c4d0c749d68db69b @@ -55,7 +55,7 @@ get_test_results_for_revision(revision_i app_state & app) { vector< revision > certs; - app.get_project().get_revision_certs_by_name(id, testresult_cert_name, certs); + app.get_project().get_revision_certs_by_name(id, cert_name(testresult_cert_name), certs); for (vector< revision >::const_iterator i = certs.begin(); i != certs.end(); ++i) { @@ -83,7 +83,7 @@ acceptable_descendent(cert_value const & L(FL("Considering update target %s") % target); // step 1: check the branch - if (!app.get_project().revision_is_in_branch(target, branch())) + if (!app.get_project().revision_is_in_branch(target, utf8(branch()))) { L(FL("%s not in branch %s") % target % branch); return false; ============================================================ --- vocab_macros.hh 7c7576c82b4bc3b968c159c02054de0ceae3d0ac +++ vocab_macros.hh 9a2cbe362da02a7052e3e8d46153d8eeb535e9db @@ -19,8 +19,8 @@ public: public: \ bool ok; \ enc() : ok(false) {} \ - enc(std::string const & s); \ - enc(INNER const & inner); \ + explicit enc(std::string const & s); \ + explicit enc(INNER const & inner); \ enc(enc const & other); \ std::string const & operator()() const \ { return i(); } \ @@ -53,7 +53,8 @@ public: public: \ bool ok; \ dec() : ok(false) {} \ - dec(INNER const & inner); \ + explicit dec(std::string const & s); \ + explicit dec(INNER const & inner); \ dec(dec const & other); \ bool operator<(dec const & x) const \ { return i < x.i; } \ @@ -74,7 +75,7 @@ public: public: \ bool ok; \ ty() : ok(false) {} \ - ty(std::string const & str); \ + explicit ty(std::string const & str); \ ty(ty const & other); \ std::string const & operator()() const \ { return s; } \ @@ -191,6 +192,10 @@ template : i(other.i), ok(other.ok) { verify(*this); } \ \ template \ +dec::dec(std::string const & s) \ + : i(s), ok(false) { verify(*this); } \ + \ +template \ dec::dec(INNER const & inner) : \ i(inner), ok(false) \ { verify(*this); } \ ============================================================ --- work.cc d8abf8091373fda63af5b8e6343d0ab7bb0a2603 +++ work.cc 0db4f196f31d8c2262a68b0985a1487f48cba55a @@ -271,13 +271,13 @@ workspace::get_ws_options(utf8 & databas parser.str(val); if (opt == "database") - database_option = val; + database_option = utf8(val); else if (opt == "branch") - branch_option = val; + branch_option = utf8(val); else if (opt == "key") - key_option = val; + key_option = utf8(val); else if (opt == "keydir") - keydir_option =val; + keydir_option = utf8(val); else W(F("unrecognized key '%s' in options file %s - ignored") % opt % o_path); @@ -315,13 +315,13 @@ workspace::set_ws_options(utf8 & databas basic_io::stanza st; if (!database_option().empty()) - st.push_str_pair(string("database"), database_option()); + st.push_str_pair(symbol("database"), database_option()); if (!branch_option().empty()) - st.push_str_pair(string("branch"), branch_option()); + st.push_str_pair(symbol("branch"), branch_option()); if (!key_option().empty()) - st.push_str_pair(string("key"), key_option()); + st.push_str_pair(symbol("key"), key_option()); if (!keydir_option().empty()) - st.push_str_pair(string("keydir"), keydir_option()); + st.push_str_pair(symbol("keydir"), keydir_option()); basic_io::printer pr; pr.print_stanza(st); @@ -330,7 +330,7 @@ workspace::set_ws_options(utf8 & databas get_options_path(o_path); try { - write_data(o_path, pr.buf); + write_data(o_path, data(pr.buf)); } catch(exception & e) {