summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-04-07 15:46:57 +0300
committerLars Wirzenius <liw@liw.fi>2017-04-07 15:46:57 +0300
commitbe9eeba4c4c92568ad6c473102f5fb91abfca2d1 (patch)
treea9e1bf416c6207c41ca1d54b50468a74db8bdfe8
parenta6c3c3e987b9762ec7dc0694526a6df6c88f8147 (diff)
downloaddistix-be9eeba4c4c92568ad6c473102f5fb91abfca2d1.tar.gz
Move all_ticket_ids into context
-rw-r--r--distixlib/plugins/import_mail_plugin.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/distixlib/plugins/import_mail_plugin.py b/distixlib/plugins/import_mail_plugin.py
index 6e0a83a..56ad188 100644
--- a/distixlib/plugins/import_mail_plugin.py
+++ b/distixlib/plugins/import_mail_plugin.py
@@ -62,11 +62,11 @@ class ImportMailPlugin(cliapp.Plugin):
context = _ImportContext()
context.set_repo(distixlib.Repository(repo_dirname))
context.repo.require_clean_working_tree()
+ context.all_ticket_ids = context.store.get_ticket_ids()
- all_ticket_ids = context.store.get_ticket_ids()
cache = _MessageIdCache()
filenames = self._import_msg_to_ticket_store(
- context, all_ticket_ids, msg, cache, key, value)
+ context, msg, cache, key, value)
if filenames:
context.repo.commit_changes(filenames, self.commit_msg)
@@ -87,8 +87,8 @@ class ImportMailPlugin(cliapp.Plugin):
context = _ImportContext()
context.set_repo(distixlib.Repository(repo_dirname))
context.repo.require_clean_working_tree()
+ context.all_ticket_ids = context.store.get_ticket_ids()
- all_ticket_ids = context.store.get_ticket_ids()
cache = _MessageIdCache()
filenames = []
if self.app.settings['quiet']:
@@ -100,7 +100,7 @@ class ImportMailPlugin(cliapp.Plugin):
for msg in folder:
progress.next_msg()
filenames += self._import_msg_to_ticket_store(
- context, all_ticket_ids, msg, cache, key, value)
+ context, msg, cache, key, value)
filenames += context.store.save_changes()
if filenames:
context.repo.commit_changes(filenames, self.commit_msg)
@@ -125,10 +125,10 @@ class ImportMailPlugin(cliapp.Plugin):
return email.message_from_file(f)
def _import_msg_to_ticket_store(
- self, context, all_ticket_ids, msg, cache, key, value):
+ self, context, msg, cache, key, value):
referenced_ids = self._find_tickets_with_mails_referenced_by_msg(
- context.store, all_ticket_ids, msg, cache)
+ context.store, context.all_ticket_ids, msg, cache)
msg_ids = distixlib.get_ids_from_message(msg)
filenames = []
@@ -142,12 +142,12 @@ class ImportMailPlugin(cliapp.Plugin):
ticket.get_ticket_id(), msg_ids)
else:
if not self._is_already_imported(
- context.store, msg, all_ticket_ids):
+ context.store, msg, context.all_ticket_ids):
new_ticket = self._create_ticket_from_msg(context.repo, msg)
self._set_key_value(new_ticket, key, value)
cache.add_msg_ids_for_ticket_id(
new_ticket.get_ticket_id(), msg_ids)
- all_ticket_ids.append(new_ticket.get_ticket_id())
+ context.all_ticket_ids.append(new_ticket.get_ticket_id())
filenames = context.store.add_ticket(new_ticket)
filenames += context.store.save_changes()