# # # patch "cmd_db.cc" # from [54d30842895c736e1f2e71c63b6577935002cd98] # to [c647b4d7745e3daa2bdb12fc13a23405f272dbd2] # # patch "cmd_list.cc" # from [32379aca6b212b98988604dc1aa1fce4594345a7] # to [1f78175c59f892f6389f046b3e732d00085553a0] # # patch "database.cc" # from [fed4a1460ddef1784907fbce73c0aa67b262683a] # to [64f2a0636ca7730aff1b28e728dbb4f87be985a2] # # patch "database.hh" # from [ea6f156a45cccbf101e7f6befe00c77b8496def5] # to [ac80c0cd73c9aa0f0cb24b30c61574f384ccd9bb] # # patch "epoch.cc" # from [23883766eb0943d7d65ff7c5737ada2196b45a3f] # to [acc8e97b3406db8d5ee3720648f46703d922f84a] # # patch "epoch.hh" # from [763a85bee0d86814ae201da9e1ad128ef0c359e4] # to [cca55b456104aba914581f7bda839d1b303ffb13] # # patch "netsync.cc" # from [92e2302554f48a5a6fdee6bb42cba24f22152c97] # to [a4c703b9007b142478b1d8ecddf9d6c389e6d00c] # # patch "revision.cc" # from [993b5f1f83f737bdffe63f69044f8a87ce8b8631] # to [f22703d784fb1f7fab53662f2337e5b85d76c95b] # # patch "update.cc" # from [51b3d312313c0d4dd25fc43b3bdaaef1c299a928] # to [e5fa61130ca338a4a9f4aff804b50e0e23e748f2] # ============================================================ --- cmd_db.cc 54d30842895c736e1f2e71c63b6577935002cd98 +++ cmd_db.cc c647b4d7745e3daa2bdb12fc13a23405f272dbd2 @@ -93,7 +93,7 @@ CMD(db, N_("database"), else if (idx(args, 0)() == "kill_rev_locally") kill_rev_locally(app,idx(args, 1)()); else if (idx(args, 0)() == "clear_epoch") - app.db.clear_epoch(cert_value(idx(args, 1)())); + app.db.clear_epoch(branch_name(idx(args, 1)())); else if (idx(args, 0)() == "kill_branch_certs_locally") app.db.delete_branch_named(cert_value(idx(args, 1)())); else if (idx(args, 0)() == "kill_tag_locally") @@ -109,7 +109,7 @@ CMD(db, N_("database"), N(ed.inner()().size() == constants::epochlen, F("The epoch must be %s characters") % constants::epochlen); - app.db.set_epoch(cert_value(idx(args, 1)()), ed); + app.db.set_epoch(branch_name(idx(args, 1)()), ed); } else throw usage(name); ============================================================ --- cmd_list.cc 32379aca6b212b98988604dc1aa1fce4594345a7 +++ cmd_list.cc 1f78175c59f892f6389f046b3e732d00085553a0 @@ -261,12 +261,12 @@ ls_epochs(string name, app_state & app, static void ls_epochs(string name, app_state & app, vector const & args) { - map epochs; + map epochs; app.db.get_epochs(epochs); if (args.size() == 0) { - for (map::const_iterator + for (map::const_iterator i = epochs.begin(); i != epochs.end(); ++i) { @@ -279,7 +279,7 @@ ls_epochs(string name, app_state & app, i != args.end(); ++i) { - map::const_iterator j = epochs.find(cert_value((*i)())); + map::const_iterator j = epochs.find(branch_name((*i)())); N(j != epochs.end(), F("no epoch for branch %s") % *i); cout << j->second << " " << j->first << "\n"; } @@ -680,7 +680,7 @@ AUTOMATE(certs, N_("REV"), options::opts transaction_guard guard(app.db, false); - revision_id rid(hexenc(id(idx(args, 0)()))); + revision_id rid(idx(args, 0)()); N(app.db.revision_exists(rid), F("No such revision %s") % rid); hexenc ident(rid.inner()); ============================================================ --- database.cc fed4a1460ddef1784907fbce73c0aa67b262683a +++ database.cc 64f2a0636ca7730aff1b28e728dbb4f87be985a2 @@ -2778,14 +2778,14 @@ void // epochs void -database::get_epochs(map & epochs) +database::get_epochs(map & epochs) { epochs.clear(); results res; fetch(res, 2, any_rows, query("SELECT branch, epoch FROM branch_epochs")); for (results::const_iterator i = res.begin(); i != res.end(); ++i) { - cert_value decoded(idx(*i, 0)); + branch_name decoded(idx(*i, 0)); I(epochs.find(decoded) == epochs.end()); epochs.insert(make_pair(decoded, epoch_data(idx(*i, 1)))); } @@ -2793,7 +2793,7 @@ database::get_epoch(epoch_id const & eid void database::get_epoch(epoch_id const & eid, - cert_value & branch, epoch_data & epo) + branch_name & branch, epoch_data & epo) { I(epoch_exists(eid)); results res; @@ -2802,7 +2802,7 @@ database::get_epoch(epoch_id const & eid " WHERE hash = ?") % text(eid.inner()())); I(res.size() == 1); - branch = cert_value(idx(idx(res, 0), 0)); + branch = branch_name(idx(idx(res, 0), 0)); epo = epoch_data(idx(idx(res, 0), 1)); } @@ -2818,7 +2818,7 @@ void } void -database::set_epoch(cert_value const & branch, epoch_data const & epo) +database::set_epoch(branch_name const & branch, epoch_data const & epo) { epoch_id eid; epoch_hash_code(branch, epo, eid); @@ -2830,7 +2830,7 @@ void } void -database::clear_epoch(cert_value const & branch) +database::clear_epoch(branch_name const & branch) { execute(query("DELETE FROM branch_epochs WHERE branch = ?") % blob(branch())); ============================================================ --- database.hh ea6f156a45cccbf101e7f6befe00c77b8496def5 +++ database.hh ac80c0cd73c9aa0f0cb24b30c61574f384ccd9bb @@ -469,15 +469,15 @@ public: // --== Epochs ==-- // public: - void get_epochs(std::map & epochs); + void get_epochs(std::map & epochs); - void get_epoch(epoch_id const & eid, cert_value & branch, epoch_data & epo); + void get_epoch(epoch_id const & eid, branch_name & branch, epoch_data & epo); bool epoch_exists(epoch_id const & eid); - void set_epoch(cert_value const & branch, epoch_data const & epo); + void set_epoch(branch_name const & branch, epoch_data const & epo); - void clear_epoch(cert_value const & branch); + void clear_epoch(branch_name const & branch); // // --== Database 'vars' ==-- ============================================================ --- epoch.cc 23883766eb0943d7d65ff7c5737ada2196b45a3f +++ epoch.cc acc8e97b3406db8d5ee3720648f46703d922f84a @@ -18,7 +18,7 @@ read_epoch(string const & in, void read_epoch(string const & in, - cert_value & branch, epoch_data & epoch) + branch_name & branch, epoch_data & epoch) { size_t pos = 0; string raw_branch; @@ -26,14 +26,14 @@ read_epoch(string const & in, extract_variable_length_string(in, raw_branch, pos, "epoch, branch name"); raw_epoch = data(extract_substring(in, pos, constants::epochlen_bytes, "epoch, epoch data")); - branch = cert_value(raw_branch); + branch = branch_name(raw_branch); hexenc tmp; encode_hexenc(raw_epoch, tmp); epoch = epoch_data(tmp); } void -write_epoch(cert_value const & branch, epoch_data const & epoch, +write_epoch(branch_name const & branch, epoch_data const & epoch, string & out) { insert_variable_length_string(branch(), out); @@ -43,7 +43,7 @@ void } void -epoch_hash_code(cert_value const & branch, epoch_data const & epoch, +epoch_hash_code(branch_name const & branch, epoch_data const & epoch, epoch_id & eid) { string tmp(branch() + ":" + epoch.inner()()); ============================================================ --- epoch.hh 763a85bee0d86814ae201da9e1ad128ef0c359e4 +++ epoch.hh cca55b456104aba914581f7bda839d1b303ffb13 @@ -17,10 +17,10 @@ void read_epoch(std::string const & in, // epochs are pairs (branch name, random data) void read_epoch(std::string const & in, - cert_value & branch, epoch_data & epoch); -void write_epoch(cert_value const & branch, epoch_data const & epoch, + branch_name & branch, epoch_data & epoch); +void write_epoch(branch_name const & branch, epoch_data const & epoch, std::string & out); -void epoch_hash_code(cert_value const & branch, epoch_data const & epoch, +void epoch_hash_code(branch_name const & branch, epoch_data const & epoch, epoch_id & eid); // Local Variables: ============================================================ --- netsync.cc 92e2302554f48a5a6fdee6bb42cba24f22152c97 +++ netsync.cc a4c703b9007b142478b1d8ecddf9d6c389e6d00c @@ -1835,7 +1835,7 @@ session::load_data(netcmd_item_type type { case epoch_item: { - cert_value branch; + branch_name branch; epoch_data epoch; app.db.get_epoch(epoch_id(hitem), branch, epoch); write_epoch(branch, epoch, out); @@ -1904,13 +1904,13 @@ session::process_data_cmd(netcmd_item_ty { case epoch_item: { - cert_value branch; + branch_name branch; epoch_data epoch; read_epoch(dat, branch, epoch); L(FL("received epoch %s for branch %s") % epoch % branch); - map epochs; + map epochs; app.db.get_epochs(epochs); - map::const_iterator i; + map::const_iterator i; i = epochs.find(branch); if (i == epochs.end()) { @@ -3089,15 +3089,15 @@ session::rebuild_merkle_trees(app_state } { - map epochs; + map epochs; app.db.get_epochs(epochs); epoch_data epoch_zero(string(constants::epochlen, '0')); for (set::const_iterator i = branchnames.begin(); i != branchnames.end(); ++i) { - cert_value branch((*i)()); - map::const_iterator j; + branch_name const & branch(*i); + map::const_iterator j; j = epochs.find(branch); // Set to zero any epoch which is not yet set. ============================================================ --- revision.cc 993b5f1f83f737bdffe63f69044f8a87ce8b8631 +++ revision.cc f22703d784fb1f7fab53662f2337e5b85d76c95b @@ -899,7 +899,7 @@ void anc_graph::write_certs() encode_hexenc(data(string(buf, buf + constants::epochlen_bytes)), hexdata); epoch_data new_epoch(hexdata); L(FL("setting epoch for %s to %s") % *i % new_epoch); - app.db.set_epoch(cert_value(*i), new_epoch); + app.db.set_epoch(branch_name(*i), new_epoch); } } ============================================================ --- update.cc 51b3d312313c0d4dd25fc43b3bdaaef1c299a928 +++ update.cc e5fa61130ca338a4a9f4aff804b50e0e23e748f2 @@ -74,7 +74,7 @@ static bool } static bool -acceptable_descendent(cert_value const & branch, +acceptable_descendent(branch_name const & branch, revision_id const & base, map & base_results, revision_id const & target, @@ -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_name(branch()))) + if (!app.get_project().revision_is_in_branch(target, branch)) { L(FL("%s not in branch %s") % target % branch); return false; @@ -107,7 +107,7 @@ calculate_update_set(revision_id const & static void calculate_update_set(revision_id const & base, - cert_value const & branch, + branch_name const & branch, app_state & app, set & candidates) { @@ -160,7 +160,7 @@ void pick_update_candidates(revision_id F("cannot determine branch for update")); I(!null_id(base_ident)); - calculate_update_set(base_ident, cert_value(app.opts.branchname()), + calculate_update_set(base_ident, app.opts.branchname, app, candidates); }