TW-303: Make "task import" update existing tasks

This commit is contained in:
Wilhelm Schuermann 2015-05-29 19:49:54 +02:00
parent 45088dc9ce
commit 9d6067e2fe
7 changed files with 50 additions and 19 deletions

View file

@ -110,11 +110,22 @@ int CmdImport::import (std::vector <std::string>& lines)
// Parse the whole thing.
Task task (object);
context.tdb2.add (task);
// Check whether the imported task is new or a modified existing task.
Task dummy;
if (context.tdb2.get (task.get ("uuid"), dummy))
{
context.tdb2.modify (task);
std::cout << " mod ";
}
else
{
context.tdb2.add (task);
std::cout << " add ";
}
++count;
std::cout << " "
<< task.get ("uuid")
std::cout << task.get ("uuid")
<< " "
<< task.get ("description")
<< "\n";