mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
CmdImport: Removed unused method
This commit is contained in:
parent
e1a102d717
commit
0747cc38aa
2 changed files with 0 additions and 59 deletions
|
@ -96,64 +96,6 @@ int CmdImport::execute (std::string& output)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
int CmdImport::import (std::vector <std::string>& lines)
|
|
||||||
{
|
|
||||||
int count = 0;
|
|
||||||
for (auto& line : lines)
|
|
||||||
{
|
|
||||||
std::string object = trimLeft (
|
|
||||||
trimRight (
|
|
||||||
trimRight (
|
|
||||||
trim (line),
|
|
||||||
","),
|
|
||||||
"]"),
|
|
||||||
"[");
|
|
||||||
|
|
||||||
// Skip blanks. May be caused by the trim calls above.
|
|
||||||
if (! object.length ())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Parse the whole thing.
|
|
||||||
Task task (object);
|
|
||||||
|
|
||||||
// Check whether the imported task is new or a modified existing task.
|
|
||||||
Task before;
|
|
||||||
if (context.tdb2.get (task.get ("uuid"), before))
|
|
||||||
{
|
|
||||||
// "modified:" is automatically set to the current time when a task is
|
|
||||||
// changed. If the imported task has a modification timestamp we need
|
|
||||||
// to ignore it in taskDiff() in order to check for meaningful
|
|
||||||
// differences. Setting it to the previous value achieves just that.
|
|
||||||
task.set ("modified", before.get ("modified"));
|
|
||||||
if (taskDiff (before, task))
|
|
||||||
{
|
|
||||||
CmdModify modHelper;
|
|
||||||
modHelper.checkConsistency (before, task);
|
|
||||||
count += modHelper.modifyAndUpdate (before, task);
|
|
||||||
std::cout << " mod ";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::cout << " skip ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
context.tdb2.add (task);
|
|
||||||
std::cout << " add ";
|
|
||||||
++count;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cout << task.get ("uuid")
|
|
||||||
<< " "
|
|
||||||
<< task.get ("description")
|
|
||||||
<< "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
int CmdImport::import (const std::string& input)
|
int CmdImport::import (const std::string& input)
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,7 +38,6 @@ public:
|
||||||
int execute (std::string&);
|
int execute (std::string&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int import (std::vector <std::string>&);
|
|
||||||
int import (const std::string&);
|
int import (const std::string&);
|
||||||
void importSingleTask (json::object*);
|
void importSingleTask (json::object*);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue