/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/mail_client.py

  • Committer: Vincent Ladeuil
  • Date: 2012-01-18 14:09:19 UTC
  • mto: This revision was merged to the branch mainline in revision 6468.
  • Revision ID: v.ladeuil+lp@free.fr-20120118140919-rlvdrhpc0nq1lbwi
Change set/remove to require a lock for the branch config files.

This means that tests (or any plugin for that matter) do not requires an
explicit lock on the branch anymore to change a single option. This also
means the optimisation becomes "opt-in" and as such won't be as
spectacular as it may be and/or harder to get right (nothing fails
anymore).

This reduces the diff by ~300 lines.

Code/tests that were updating more than one config option is still taking
a lock to at least avoid some IOs and demonstrate the benefits through
the decreased number of hpss calls.

The duplication between BranchStack and BranchOnlyStack will be removed
once the same sharing is in place for local config files, at which point
the Stack class itself may be able to host the changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
import bzrlib
26
26
from bzrlib import (
27
 
    config as _mod_config,
28
27
    email_message,
29
28
    errors,
30
29
    msgeditor,
112
111
        if body == '':
113
112
            raise errors.NoMessageSupplied()
114
113
        email_message.EmailMessage.send(self.config,
115
 
                                        self.config.get('email'),
 
114
                                        self.config.username(),
116
115
                                        to,
117
116
                                        subject,
118
117
                                        body,
379
378
                 extension, body=None, from_=None):
380
379
        """See ExternalMailClient._compose"""
381
380
        if from_ is None:
382
 
            from_ = self.config.get('email')
 
381
            from_ = self.config.get_user_option('email')
383
382
        super(Claws, self)._compose(prompt, to, subject, attach_path,
384
383
                                    mime_subtype, extension, body, from_)
385
384
 
618
617
        """See MailClient.compose"""
619
618
        try:
620
619
            return self._mail_client().compose(prompt, to, subject,
621
 
                                               attachment, mime_subtype,
 
620
                                               attachment, mimie_subtype,
622
621
                                               extension, basename, body)
623
622
        except errors.MailClientNotFound:
624
623
            return Editor(self.config).compose(prompt, to, subject,
625
 
                          attachment, mime_subtype, extension, body)
 
624
                          attachment, mimie_subtype, extension, body)
626
625
 
627
626
    def compose_merge_request(self, to, subject, directive, basename=None,
628
627
                              body=None):
637
636
                              help=DefaultMail.__doc__)
638
637
mail_client_registry.default_key = 'default'
639
638
 
640
 
opt_mail_client = _mod_config.RegistryOption('mail_client',
641
 
        mail_client_registry, help='E-mail client to use.', invalid='error')
 
639