no-delete-local patch for offlineimap
Edward Z. Yang
ezyang at mit.edu
Wed May 27 17:12:21 BST 2015
Was listening along. I noticed that the patch that was submitted
here is old. Here's a newer version of it which I'm currently running:
https://github.com/ezyang/offlineimap/commit/06428af0adf74d25011a42ebd97b39f930769b58
but I have not really cleaned it up for submission.
In any case, here are the comments that still apply
> > +# no-delete-local = no
>
> We avoid dashes in configuration options.
OK
> > +
> > +
>
> Should have the "header": # This option stands in the [Account Test] section.
OK
> > diff --git a/offlineimap/folder/Base.py b/offlineimap/folder/Base.py
> > index 6f6f364..d5c5425 100644
> > --- a/offlineimap/folder/Base.py
> > +++ b/offlineimap/folder/Base.py
> > @@ -294,7 +294,7 @@ def deletemessages(self, uidlist):
> > for uid in uidlist:
> > self.deletemessage(uid)
> >
> > - def copymessageto(self, uid, dstfolder, statusfolder, register = 1):
> > + def copymessageto(self, uid, dstfolder, statusfolder, always_sync_deletes, register = 1):
>
> always_sync_deletes sounds a poor name but I'm more worried about why
> this feature goes so deeply to low-level code. I don't get why we should
> change the signature of such a central method.
The reason is syncmessagesto gets called twice: once from local to
status, and once from remote to status. These need to be treated
differently, since no-delete-local is an asymmetric option. The
alternate choice is to test dstfolder against... something to
distinguish these two cases.
BTW, I definitely DO want local deletes to synchronize to the remote.
> > This function checks and protects us from action in ryrun mode.
> > """
> > + # This is functionally equivalent to having an empty deletelist
> > + # in the case of not always_sync_deletes and no-delete-local turned on; the
> > + # only difference is that in this regime we eagerly clear out
> > + # "stale" entries from statusfolder, i.e. ones that are not
> > + # present in the local or destination folder, whereas if we were
> > + # to skip this the entries hang around until a not always_sync_deletes
> > + # run.
> > + sync_deletes = always_sync_deletes or not self.config.getdefaultboolean("Account " + self.accountname, "no-delete-local", False)
>
> So, this is where we read this configuration option. Why here?
Where else?
Edward
More information about the OfflineIMAP-project
mailing list