From 24936aee5ff308f95dc1223231a375783471f37f Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Mon, 29 Dec 2014 09:35:05 +0100 Subject: [PATCH] VimwikiTask: Track dependency in a extra attribute, since Task object may not be saved yet --- autoload/vimwiki_pytasks.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/autoload/vimwiki_pytasks.py b/autoload/vimwiki_pytasks.py index b46a291..7d65ce4 100644 --- a/autoload/vimwiki_pytasks.py +++ b/autoload/vimwiki_pytasks.py @@ -97,6 +97,11 @@ class VimwikiTask(object): self.completed = self.completed_mark is 'X' self.line_number = position + # We need to track depedency set in a extra attribute, since + # this may be a new task, and hence it need not to be saved yet. + # We circumvent this problem by iteration order in the TaskCache + self.add_dependencies = set() + # First set the task attribute to None, then try to load it, if possible self.task = None @@ -111,6 +116,10 @@ class VimwikiTask(object): self.parent = self.find_parent_task() + # Make parent task dependant on this task + if self.parent: + self.parent.add_dependencies |= set([self]) + def save_to_tw(self): # Push the values to the Task