Commit 93544521 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Evaluate all p: tags when cleaning them

Don't just consider the first p tag value in a todo item, consider all
of them.
parent 709c5a73
......@@ -420,5 +420,19 @@ class TodoListCleanDependencyTester(TopydoTest):
self.assertFalse(self.todolist.todo(1).has_tag('id'))
def test_clean_dependencies4(self):
""" Clean p: items when siblings are still connected to parent. """
self.todolist.add("Foo id:1")
self.todolist.add("Bar p:1")
self.todolist.add("Baz p:1 id:2")
self.todolist.add("Buzz p:2 p:1")
self.todolist.clean_dependencies()
self.assertFalse(self.todolist.todo(4).has_tag('p', '1'))
self.assertTrue(self.todolist.todo(1).has_tag('id', '1'))
self.assertTrue(self.todolist.todo(2).has_tag('p', '1'))
if __name__ == '__main__':
unittest.main()
......@@ -227,11 +227,11 @@ class TodoList(TodoListBase):
"""
for todo in [todo for todo in self._todos if todo.has_tag('p')]:
value = todo.tag_value('p')
parent = self.todo_by_dep_id(value)
for value in todo.tag_values('p'):
parent = self.todo_by_dep_id(value)
if not self._depgraph.has_edge(hash(parent), hash(todo)):
remove_tag(todo, 'p', value)
if not self._depgraph.has_edge(hash(parent), hash(todo)):
remove_tag(todo, 'p', value)
self._depgraph.transitively_reduce()
clean_parent_relations()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment