TDB2
- Converted 'duplicate' to TDB2.
This commit is contained in:
@@ -54,14 +54,9 @@ int CmdDuplicate::execute (std::string& output)
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
|
|
||||||
std::vector <Task> tasks;
|
|
||||||
context.tdb.lock (context.config.getBoolean ("locking"));
|
|
||||||
context.tdb.loadPending (tasks);
|
|
||||||
|
|
||||||
// Apply filter.
|
// Apply filter.
|
||||||
std::vector <Task> filtered;
|
std::vector <Task> filtered;
|
||||||
filter (tasks, filtered);
|
filter (filtered);
|
||||||
|
|
||||||
if (filtered.size () == 0)
|
if (filtered.size () == 0)
|
||||||
{
|
{
|
||||||
context.footnote (STRING_FEEDBACK_NO_TASKS_SP);
|
context.footnote (STRING_FEEDBACK_NO_TASKS_SP);
|
||||||
@@ -100,7 +95,7 @@ int CmdDuplicate::execute (std::string& output)
|
|||||||
// Only allow valid tasks.
|
// Only allow valid tasks.
|
||||||
dup.validate ();
|
dup.validate ();
|
||||||
|
|
||||||
context.tdb.add (dup);
|
context.tdb2.add (dup);
|
||||||
++count;
|
++count;
|
||||||
|
|
||||||
if (context.config.getBoolean ("echo.command"))
|
if (context.config.getBoolean ("echo.command"))
|
||||||
@@ -116,13 +111,9 @@ int CmdDuplicate::execute (std::string& output)
|
|||||||
context.footnote (onProjectChange (dup));
|
context.footnote (onProjectChange (dup));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count)
|
|
||||||
context.tdb.commit ();
|
|
||||||
|
|
||||||
context.tdb.unlock ();
|
|
||||||
|
|
||||||
// TODO Add count summary, like the 'done' command.
|
// TODO Add count summary, like the 'done' command.
|
||||||
|
|
||||||
|
context.tdb2.commit ();
|
||||||
output = out.str ();
|
output = out.str ();
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user