~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge_directive.py

  • Committer: John Arbash Meinel
  • Date: 2007-07-20 14:28:59 UTC
  • mfrom: (2625.6.3 bzr.email_message)
  • mto: This revision was merged to the branch mainline in revision 2640.
  • Revision ID: john@arbash-meinel.com-20070720142859-a24s0khul0yw91bh
(Adeodato Simó) EmailMessage class, allowing much nicer access to Email object than stdlib

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
 
18
 
from email import Message
19
18
from StringIO import StringIO
20
19
import re
21
20
 
33
32
from bzrlib.bundle import (
34
33
    serializer as bundle_serializer,
35
34
    )
 
35
from bzrlib.email_message import EmailMessage
36
36
 
37
37
 
38
38
class _BaseMergeDirective(object):
170
170
        :return: an email message
171
171
        """
172
172
        mail_from = branch.get_config().username()
173
 
        message = Message.Message()
174
 
        message['To'] = mail_to
175
 
        message['From'] = mail_from
176
173
        if self.message is not None:
177
 
            message['Subject'] = self.message
 
174
            subject = self.message
178
175
        else:
179
176
            revision = branch.repository.get_revision(self.revision_id)
180
 
            message['Subject'] = revision.message
 
177
            subject = revision.message
181
178
        if sign:
182
179
            body = self.to_signed(branch)
183
180
        else:
184
181
            body = ''.join(self.to_lines())
185
 
        message.set_payload(body)
 
182
        message = EmailMessage(mail_from, mail_to, subject, body)
186
183
        return message
187
184
 
188
185
    def install_revisions(self, target_repo):