fix: when called with -a, mbnames must not erase entries of other accounts

Make mbnames to work with intermediate files, one per account, in the JSON
format. The mbnames target is built from those intermediate files.

Github-Fix: https://github.com/OfflineIMAP/offlineimap/issues/66
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht
2016-06-23 00:20:57 +02:00
parent 52120beb27
commit 092264c8e7
5 changed files with 197 additions and 82 deletions

View File

@ -369,9 +369,7 @@ class SyncableAccount(Account):
# wait for all threads to finish
for thr in folderthreads:
thr.join()
# Write out mailbox names if required and not in dry-run mode
if not self.dryrun:
mbnames.write(False)
mbnames.writeIntermediateFile(self.name) # Write out mailbox names.
localrepos.forgetfolders()
remoterepos.forgetfolders()
except:
@ -512,9 +510,9 @@ def syncfolder(account, remotefolder, quick):
# Load local folder.
localfolder = account.get_local_folder(remotefolder)
# Write the mailboxes
mbnames.add(account.name, localfolder.getname(),
localrepos.getlocalroot())
# Add the folder to the mbnames mailboxes.
mbnames.add(account.name, localrepos.getlocalroot(),
localfolder.getname())
# Load status folder.
statusfolder = statusrepos.getfolder(remotefolder.getvisiblename().