# # # patch "cmd_db.cc" # from [05124dc0f527bbdb045e172f8ae6837f8ed05afa] # to [8bc592fb9d5ee0a4810e6cc4161be06c863f2fe4] # # patch "revision.cc" # from [ee71418011758974d4b57e7905d2b587bea32007] # to [653c0d415774965b2874e294e122cc1fb179b544] # ============================================================ --- cmd_db.cc 05124dc0f527bbdb045e172f8ae6837f8ed05afa +++ cmd_db.cc 8bc592fb9d5ee0a4810e6cc4161be06c863f2fe4 @@ -16,6 +16,7 @@ #include "revision.hh" #include "constants.hh" #include "app_state.hh" +#include "keys.hh" using std::cin; using std::cout; @@ -223,6 +224,14 @@ CMD(db_changesetify, "changesetify", "", N(args.size() == 0, F("no arguments needed")); + app.db.ensure_open_for_format_changes(); + app.db.check_is_not_rosterified(); + + // early short-circuit to avoid failure after lots of work + rsa_keypair_id key; + get_user_key(key, app.db); + require_password(key, app.keys); + build_changesets_from_manifest_ancestry(app.db); } @@ -234,6 +243,14 @@ CMD(db_rosterify, "rosterify", "", CMD_R N(args.size() == 0, F("no arguments needed")); + app.db.ensure_open_for_format_changes(); + app.db.check_is_not_rosterified(); + + // early short-circuit to avoid failure after lots of work + rsa_keypair_id key; + get_user_key(key, app.db); + require_password(key, app.keys); + build_roster_style_revs_from_manifest_style_revs(app.db); } ============================================================ --- revision.cc ee71418011758974d4b57e7905d2b587bea32007 +++ revision.cc 653c0d415774965b2874e294e122cc1fb179b544 @@ -30,7 +30,6 @@ #include "cset.hh" #include "constants.hh" #include "interner.hh" -#include "keys.hh" #include "numeric_vocab.hh" #include "revision.hh" #include "mtn-sanity.hh" @@ -1641,22 +1640,12 @@ build_roster_style_revs_from_manifest_st void build_roster_style_revs_from_manifest_style_revs(database & db) { - db.ensure_open_for_format_changes(); - db.check_is_not_rosterified(); - real_sanity.set_relaxed(true); anc_graph graph(true, db); P(F("converting existing revision graph to new roster-style revisions")); multimap existing_graph; - { - // early short-circuit to avoid failure after lots of work - rsa_keypair_id key; - get_user_key(key, db); - require_password(key, db.get_key_store()); - } - // cross-check that we're getting everything // in fact the code in this function is wrong, because if a revision has no // parents and no children (it is a root revision, and no children have been @@ -1697,20 +1686,10 @@ build_changesets_from_manifest_ancestry( void build_changesets_from_manifest_ancestry(database & db) { - db.ensure_open_for_format_changes(); - db.check_is_not_rosterified(); - anc_graph graph(false, db); P(F("rebuilding revision graph from manifest certs")); - { - // early short-circuit to avoid failure after lots of work - rsa_keypair_id key; - get_user_key(key, db); - require_password(key, db.get_key_store()); - } - vector< manifest > tmp; db.get_manifest_certs(cert_name("ancestor"), tmp); erase_bogus_certs(tmp, db);