mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-04 12:28:35 +02:00
TDB2
- Eliminated the now obsolete TDB code from Context. - Added auto-commit code for commands that auto-gc.
This commit is contained in:
parent
5d6f6e2073
commit
1b3ac82d7e
2 changed files with 10 additions and 10 deletions
|
@ -51,7 +51,6 @@ Context::Context ()
|
||||||
, data_dir ()
|
, data_dir ()
|
||||||
, extension_dir ()
|
, extension_dir ()
|
||||||
, config ()
|
, config ()
|
||||||
, tdb ()
|
|
||||||
, tdb2 ()
|
, tdb2 ()
|
||||||
, dom ()
|
, dom ()
|
||||||
, determine_color_use (true)
|
, determine_color_use (true)
|
||||||
|
@ -150,8 +149,6 @@ int Context::initialize (int argc, const char** argv)
|
||||||
locale = locale.substr (0, period);
|
locale = locale.substr (0, period);
|
||||||
|
|
||||||
// Initialize the database.
|
// Initialize the database.
|
||||||
tdb.clear (); // TODO Obsolete
|
|
||||||
tdb.location (data_dir); // TODO Obsolete
|
|
||||||
tdb2.set_location (data_dir);
|
tdb2.set_location (data_dir);
|
||||||
|
|
||||||
// Hook system init, plus post-start event occurring at the first possible
|
// Hook system init, plus post-start event occurring at the first possible
|
||||||
|
@ -316,11 +313,13 @@ int Context::dispatch (std::string &out)
|
||||||
|
|
||||||
Command* c = commands[command];
|
Command* c = commands[command];
|
||||||
|
|
||||||
// GC is invoked prior to running any command that displays task IDs.
|
// GC is invoked prior to running any command that displays task IDs, if
|
||||||
if (c->displays_id ())
|
// possible.
|
||||||
|
bool auto_commit = false;
|
||||||
|
if (c->displays_id () && !tdb2.read_only ())
|
||||||
{
|
{
|
||||||
tdb.gc ();
|
|
||||||
tdb2.gc ();
|
tdb2.gc ();
|
||||||
|
auto_commit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only read-only commands can be run when TDB2 is read-only.
|
// Only read-only commands can be run when TDB2 is read-only.
|
||||||
|
@ -330,7 +329,11 @@ int Context::dispatch (std::string &out)
|
||||||
throw std::string ("");
|
throw std::string ("");
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return c->execute (out);
|
int rc = c->execute (out);
|
||||||
|
if (auto_commit)
|
||||||
|
tdb2.commit ();
|
||||||
|
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
return commands["help"]->execute (out);
|
return commands["help"]->execute (out);
|
||||||
|
@ -557,7 +560,6 @@ void Context::decomposeSortField (
|
||||||
// be initialized. That makes this method something of a misnomer. So be it.
|
// be initialized. That makes this method something of a misnomer. So be it.
|
||||||
void Context::clear ()
|
void Context::clear ()
|
||||||
{
|
{
|
||||||
tdb.clear (); // TODO Obsolete
|
|
||||||
tdb2.clear ();
|
tdb2.clear ();
|
||||||
a3.clear ();
|
a3.clear ();
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
#include <Column.h>
|
#include <Column.h>
|
||||||
#include <Config.h>
|
#include <Config.h>
|
||||||
#include <Task.h>
|
#include <Task.h>
|
||||||
#include <TDB.h>
|
|
||||||
#include <TDB2.h>
|
#include <TDB2.h>
|
||||||
#include <Hooks.h>
|
#include <Hooks.h>
|
||||||
#include <DOM.h>
|
#include <DOM.h>
|
||||||
|
@ -89,7 +88,6 @@ public:
|
||||||
Directory extension_dir;
|
Directory extension_dir;
|
||||||
Config config;
|
Config config;
|
||||||
|
|
||||||
TDB tdb; // TODO Obsolete
|
|
||||||
TDB2 tdb2;
|
TDB2 tdb2;
|
||||||
std::map <std::string, std::string> aliases;
|
std::map <std::string, std::string> aliases;
|
||||||
Hooks hooks;
|
Hooks hooks;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue