Avoid double cleanup() call (#1091)

Now we call cleanup() even for skipped tasks. Archive tasks need this; other
tasks can ignore it.
This commit is contained in:
Adrian Sampson 2014-11-16 19:55:27 -08:00
parent 17fd77ff66
commit 0c7fc8fb6b

View file

@ -498,24 +498,22 @@ class ImportTask(object):
if session.config['incremental']:
self.save_history()
if not self.skip:
self.cleanup(copy=session.config['copy'],
delete=session.config['delete'],
move=session.config['move'])
self._emit_imported(session.lib)
self.cleanup(copy=session.config['copy'],
delete=session.config['delete'],
move=session.config['move'])
if isinstance(self, ArchiveImportTask):
self.cleanup()
if not self.skip:
self._emit_imported(session.lib)
def cleanup(self, copy=False, delete=False, move=False):
"""Remove and prune imported paths.
"""
# FIXME Maybe the keywords should be task properties.
# FIXME This shouldn't be here. Skipping should be handled in
# the stages.
# Do not delete any files or prune directories when skipping.
if self.skip:
return
items = self.imported_items()
# When copying and deleting originals, delete old files.