Commit 958398e1 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Use TodoListBase for archive files.

No dependency tracking is needed and gives a huge performance
improvement for huge done.txt files.
parent eb0b1f74
...@@ -82,6 +82,7 @@ from topydo.lib.SortCommand import SortCommand ...@@ -82,6 +82,7 @@ from topydo.lib.SortCommand import SortCommand
from topydo.lib.TagCommand import TagCommand from topydo.lib.TagCommand import TagCommand
from topydo.lib import TodoFile from topydo.lib import TodoFile
from topydo.lib import TodoList from topydo.lib import TodoList
from topydo.lib import TodoListBase
from topydo.lib.Utils import escape_ansi from topydo.lib.Utils import escape_ansi
class CLIApplication(object): class CLIApplication(object):
...@@ -96,7 +97,7 @@ class CLIApplication(object): ...@@ -96,7 +97,7 @@ class CLIApplication(object):
(defaults to done.txt). (defaults to done.txt).
""" """
archive_file = TodoFile.TodoFile(config().archive()) archive_file = TodoFile.TodoFile(config().archive())
archive = TodoList.TodoList(archive_file.read()) archive = TodoListBase.TodoListBase(archive_file.read())
if archive: if archive:
command = ArchiveCommand(self.todolist, archive) command = ArchiveCommand(self.todolist, archive)
......
...@@ -18,6 +18,14 @@ import Command ...@@ -18,6 +18,14 @@ import Command
class ArchiveCommand(Command.Command): class ArchiveCommand(Command.Command):
def __init__(self, p_todolist, p_archive_list): def __init__(self, p_todolist, p_archive_list):
"""
Constructor.
p_todolist where all completed items will be moved from.
p_archive_list is the list where the items go to. This can be a
TodoListBase class which does no dependency checking, so a better
choice for huge done.txt files.
"""
super(ArchiveCommand, self).__init__([], p_todolist) super(ArchiveCommand, self).__init__([], p_todolist)
self.archive = p_archive_list self.archive = p_archive_list
......
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