[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-devel] Updated Issue 130 - databse-optional commands require a
From: |
code |
Subject: |
[Monotone-devel] Updated Issue 130 - databse-optional commands require a database now (monotone) |
Date: |
Sun, 16 Jan 2011 10:50:36 GMT |
Hello,
The following issue has been updated:
130 - databse-optional commands require a database now
Project: monotone
Status: Accepted
Reported by: Timothy Brownawell
URL: https://code.monotone.ca/p/monotone/issues/130/
Labels:
Type:Incorrect Behavior
Priority:Medium
Comments (last first):
# By Richard Levitte, Jan 16, 2011:
I experimented a bit with Timmothy's idea, but it became a bit clumsy... I
would rather think that an option argument for the constructor
database::database(app_state&), making it database::database(app_state&,
database::options=database::options::none). database::options would be an enum:
enum { none, maybe_unspecified } options;
All that's needed is to have a proper test for it in
database_path_helper::get_database_path.
# By Thomas Keller, Jan 11, 2011:
Status: Accepted
Owner: tommyd
# By Timothy Brownawell, Jan 10, 2011:
Steps to reproduce the problem:
-------------------------------
1. mtn privkey $KEY --no-workspace
2. mtn genkey address@hidden --no-workspace
3. mtn ls keys --no-workspace
Expected result:
----------------
Those should all work.
Actual results:
---------------
mtn: misuse: no database specified
Output of `mtn version --full`:
-------------------------------
3903ea47e7b1a656e0695f10d57bc0e9deca205b (current head; probably broken by the
"don't assume :memory:" fix)
There is a database::database_specified() that a few places use to check
whether there really is a db. Previously constructing a database object without
an actual database would work, and it would only error out when you tried to
use it. Possibly instead we want something like
class maybe_database {
// we own it
shared_ptr<database> const _db;
// we don't own it
database * const __db;
public:
explicit maybe_database(app_state & app)
: _db(app.opts.dbname_given ? new database(app) : 0),
__db(0) { }
/*explicit*/ maybe_database(database & db)
: __db(&db) { }
bool exists() const { return _db || __db; }
database & get() const {
if (_db) return *_db;
if (__db) return *__db;
I(false);
}
};
and then things that currently call database::database_specified() would
instead accept one of these.
--
Issue: https://code.monotone.ca/p/monotone/issues/130/
- [Monotone-devel] Issue 130 - databse-optional commands require a database now (monotone), code, 2011/01/10
- [Monotone-devel] Updated Issue 130 - databse-optional commands require a database now (monotone), code, 2011/01/11
- [Monotone-devel] Updated Issue 130 - databse-optional commands require a database now (monotone),
code <=
- [Monotone-devel] Updated Issue 130 - databse-optional commands require a database now (monotone), code, 2011/01/17
- [Monotone-devel] Updated Issue 130 - databse-optional commands require a database now (monotone), code, 2011/01/17
- [Monotone-devel] Updated Issue 130 - database-optional commands require a database now (monotone), code, 2011/01/18
- [Monotone-devel] Updated Issue 130 - database-optional commands require a database now (monotone), code, 2011/01/23
- [Monotone-devel] Updated Issue 130 - database-optional commands require a database now (monotone), code, 2011/01/23
- [Monotone-devel] Updated Issue 130 - database-optional commands require a database now (monotone), code, 2011/01/23