mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
TDB2 Conversion
- Migrated several commands over to use TDB2. Have to start somewhere.
This commit is contained in:
parent
e573801517
commit
1dc2257156
8 changed files with 49 additions and 49 deletions
35
src/TDB2.cpp
35
src/TDB2.cpp
|
@ -25,7 +25,7 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//#include <iostream> // TODO Remove.
|
||||
#include <iostream> // TODO Remove.
|
||||
#include <Context.h>
|
||||
#include <Color.h>
|
||||
#include <text.h>
|
||||
|
@ -98,6 +98,13 @@ void TF2::add_task (const Task& task)
|
|||
|
||||
_tasks.push_back (task); // For subsequent queries
|
||||
_added_tasks.push_back (task); // For commit/synch
|
||||
|
||||
/*
|
||||
int id = next_id ();
|
||||
_I2U[id] = task.get ("uuid");
|
||||
_U2I[task.get ("uuid")] = id;
|
||||
*/
|
||||
|
||||
_dirty = true;
|
||||
}
|
||||
|
||||
|
@ -237,6 +244,25 @@ void TF2::commit ()
|
|||
*/
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void TF2::commitUndo ()
|
||||
{
|
||||
/*
|
||||
for each _added_task
|
||||
fprintf (file,
|
||||
"time %u\nnew %s---\n",
|
||||
(unsigned int) time (NULL),
|
||||
after.composeF4 ().c_str ());
|
||||
|
||||
for each _modified_task
|
||||
fprintf (file,
|
||||
"time %u\nold %snew %s---\n",
|
||||
(unsigned int) time (NULL),
|
||||
before.composeF4 ().c_str (),
|
||||
after.composeF4 ().c_str ());
|
||||
*/
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void TF2::load_tasks ()
|
||||
{
|
||||
|
@ -451,6 +477,7 @@ void TDB2::add (const Task& task)
|
|||
else
|
||||
pending.add_task (task);
|
||||
|
||||
undo.add_task (task);
|
||||
backlog.add_task (task);
|
||||
}
|
||||
|
||||
|
@ -477,7 +504,7 @@ void TDB2::commit ()
|
|||
|
||||
pending.commit ();
|
||||
completed.commit ();
|
||||
undo.commit ();
|
||||
undo.commitUndo ();
|
||||
backlog.commit ();
|
||||
synch_key.commit ();
|
||||
|
||||
|
@ -535,7 +562,7 @@ int TDB2::gc ()
|
|||
int TDB2::next_id ()
|
||||
{
|
||||
if (! pending._loaded_tasks)
|
||||
pending.load_tasks ();
|
||||
pending.load_tasks ();
|
||||
|
||||
_id = pending._tasks.back ().id + 1;
|
||||
return _id++;
|
||||
|
@ -544,7 +571,7 @@ int TDB2::next_id ()
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool TDB2::verifyUniqueUUID (const std::string& uuid)
|
||||
{
|
||||
if (pending.id (uuid) != 0 ||
|
||||
if (pending.id (uuid) != 0 ||
|
||||
completed.id (uuid) != 0)
|
||||
return false;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue