[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-commits-diffs] net.venge.monotone.issue-130: 522617dff02c1ffd
From: |
code |
Subject: |
[Monotone-commits-diffs] net.venge.monotone.issue-130: 522617dff02c1ffd0ef9d0ddfd4770c05e1ae7bf |
Date: |
Sun, 16 Jan 2011 20:41:06 GMT |
revision: 522617dff02c1ffd0ef9d0ddfd4770c05e1ae7bf
date: 2011-01-16T20:40:28
author: Richard Levitte <address@hidden>
branch: net.venge.monotone.issue-130
changelog:
Start on issue 130: databse-optional commands require a database now
manifest:
format_version "1"
new_manifest [be85367603d37b0043bec1b5e61ef042fd712629]
old_revision [452b0e730e9980812c3202c19d3971024eb63d42]
patch "cmd_key_cert.cc"
from [0b6074acdf9014b625369a976da51ce3677e0630]
to [50b19b40296887cfe4b381547ba9ee42596e949a]
patch "cmd_packet.cc"
from [31321e792e77dd18121f7689413777c23045537a]
to [d0ade7e96bb5ab2c5f1805fa0c3b658229fe15b5]
patch "database.cc"
from [9b6b20b6b342f4294e9e9d6cfd42d228db7ad18f]
to [d0af7d0ee418f25dbd461dd55b0fd1e7ef13e352]
patch "database.hh"
from [18a9504000bb0856b693577e3de47861d7a7f5e0]
to [9a9eabf2983afcf7b3ac07c7cbdff0998dd45f3b]
============================================================
--- database.cc 9b6b20b6b342f4294e9e9d6cfd42d228db7ad18f
+++ database.cc d0af7d0ee418f25dbd461dd55b0fd1e7ef13e352
@@ -509,14 +509,14 @@ database_cache database::dbcache;
database_cache database::dbcache;
-database::database(app_state & app)
- : opts(app.opts), lua(app.lua)
+database::database(app_state & app, dboptions d)
+ : opts(app.opts), lua(app.lua), dbopts(d)
{
init();
}
-database::database(options const & o, lua_hooks & l)
- : opts(o), lua(l)
+database::database(options const & o, lua_hooks & l, dboptions d)
+ : opts(o), lua(l), dbopts(d)
{
init();
}
@@ -526,7 +526,7 @@ database::init()
{
database_path_helper helper(lua);
system_path dbpath;
- helper.get_database_path(opts, dbpath);
+ helper.get_database_path(opts, dbpath, dbopts);
// FIXME: for all :memory: databases an empty path is returned above, thus
// all requests for a :memory: database point to the same database
@@ -4923,13 +4923,20 @@ void
}
void
-database_path_helper::get_database_path(options const & opts, system_path & path)
+database_path_helper::get_database_path(options const & opts,
+ system_path & path,
+ dboptions dbopts)
{
if (!opts.dbname_given ||
(opts.dbname.as_internal().empty() &&
opts.dbname_alias.empty() &&
opts.dbname_type != memory_db))
{
+ if (dbopts == maybe_unspecified)
+ {
+ L(FL("no database option given or options empty"));
+ return;
+ }
E(false, origin::user, F("no database specified"));
}
============================================================
--- database.hh 18a9504000bb0856b693577e3de47861d7a7f5e0
+++ database.hh 9a9eabf2983afcf7b3ac07c7cbdff0998dd45f3b
@@ -81,14 +81,18 @@ typedef std::map<system_path, boost::sha
typedef std::map<system_path, boost::shared_ptr<database_impl> > database_cache;
+// database options
+typedef enum { none, maybe_unspecified } dboptions;
+
class database
{
//
// --== Opening the database and schema checking ==--
//
public:
- explicit database(app_state & app);
- database(options const & o, lua_hooks & l);
+public:
+ explicit database(app_state & app, dboptions dbopts = none);
+ database(options const & o, lua_hooks & l, dboptions dbopts = none);
~database();
system_path get_filename();
@@ -499,6 +503,7 @@ private:
boost::shared_ptr<database_impl> imp;
options opts;
lua_hooks & lua;
+ dboptions dbopts;
};
// not a member function, defined in database_check.cc
@@ -607,7 +612,8 @@ public:
public:
database_path_helper(lua_hooks & l) : lua(l) {}
- void get_database_path(options const & opts, system_path & path);
+ void get_database_path(options const & opts, system_path & path,
+ dboptions dbopts = none);
void maybe_set_default_alias(options & opts);
============================================================
--- cmd_key_cert.cc 0b6074acdf9014b625369a976da51ce3677e0630
+++ cmd_key_cert.cc 50b19b40296887cfe4b381547ba9ee42596e949a
@@ -47,7 +47,7 @@ CMD(genkey, "genkey", "", CMD_REF(key_an
"",
options::opts::force_duplicate_key)
{
- database db(app);
+ database db(app, maybe_unspecified);
key_store keys(app);
if (args.size() != 1)
@@ -80,7 +80,7 @@ CMD_AUTOMATE(generate_key, N_("KEY_NAME
E(args.size() == 2, origin::user,
F("wrong argument count"));
- database db(app);
+ database db(app, maybe_unspecified);
key_store keys(app);
key_name name = typecast_vocab<key_name>(idx(args, 0));
@@ -124,7 +124,7 @@ dropkey_common(app_state & app,
args_vector args,
bool drop_private)
{
- database db(app);
+ database db(app, maybe_unspecified);
key_store keys(app);
bool key_deleted = false;
bool checked_db = false;
============================================================
--- cmd_packet.cc 31321e792e77dd18121f7689413777c23045537a
+++ cmd_packet.cc d0ade7e96bb5ab2c5f1805fa0c3b658229fe15b5
@@ -85,7 +85,7 @@ pubkey_common(app_state & app,
args_vector args,
std::ostream & output)
{
- database db(app);
+ database db(app, maybe_unspecified);
key_store keys(app);
project_t project(db);
@@ -141,7 +141,7 @@ CMD(privkey, "privkey", "", CMD_REF(pack
"",
options::opts::none)
{
- database db(app);
+ database db(app, maybe_unspecified);
key_store keys(app);
project_t project(db);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Monotone-commits-diffs] net.venge.monotone.issue-130: 522617dff02c1ffd0ef9d0ddfd4770c05e1ae7bf,
code <=