From: Tomas Babej Date: Thu, 6 Aug 2015 17:57:39 +0000 (+0200) Subject: Task: Bail out if more than one task has been matched on refresh X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/commitdiff_plain/8a2ba91cb471ad97094311172b86b9bf3afed725 Task: Bail out if more than one task has been matched on refresh --- diff --git a/tasklib/task.py b/tasklib/task.py index ce915bf..cbc1192 100644 --- a/tasklib/task.py +++ b/tasklib/task.py @@ -753,6 +753,14 @@ class Task(TaskResource): # of newly saved tasks. Any other place in the code is fine # with using UUID only. args = [self['uuid'] or self['id'], 'export'] + output = self.warrior.execute_command(args) + + # If more than 1 task has been matched, raise exception + if len(output) > 1: + raise TaskWarriorException( + "Unique identifier {0} matches multiple tasks: {1}".format( + self['uuid'] or self['id'], output)) + new_data = json.loads(self.warrior.execute_command(args)[0]) if only_fields: to_update = dict(