From f4361d5c654192387c016163cc975601f2df0d63 Mon Sep 17 00:00:00 2001 From: Wilhelm Schuermann Date: Sun, 31 May 2015 16:05:54 +0200 Subject: [PATCH] Import: Reuse CmdModify's checks - Make updating tasks with "task import" run the same checks and update the same things as "task modify" would. --- doc/man/task.1.in | 3 +++ src/commands/CmdImport.cpp | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/man/task.1.in b/doc/man/task.1.in index 1194e5914..98cf9e74e 100644 --- a/doc/man/task.1.in +++ b/doc/man/task.1.in @@ -351,6 +351,9 @@ existing ones. Tasks are identified by their UUID. If no file or "-" is specified, import tasks from STDIN. +Setting rc.recurrence.confirmation to an appropriate level is recommended +if import is to be used in automated workflows. See taskrc(5). + For importing other file formats, the standard task release comes with a few example scripts, such as: diff --git a/src/commands/CmdImport.cpp b/src/commands/CmdImport.cpp index 9cd3df821..c903f175e 100644 --- a/src/commands/CmdImport.cpp +++ b/src/commands/CmdImport.cpp @@ -34,6 +34,7 @@ #include #include #include +#include extern Context context; @@ -122,9 +123,10 @@ int CmdImport::import (std::vector & lines) task.set ("modified", before.get ("modified")); if (taskDiff (before, task)) { - context.tdb2.modify (task); + CmdModify modHelper; + modHelper.checkConsistency (before, task); + count += modHelper.modifyAndUpdate (before, task); std::cout << " mod "; - ++count; } else {