~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge_directive.py

  • Committer: Aaron Bentley
  • Date: 2009-05-11 19:11:14 UTC
  • mto: This revision was merged to the branch mainline in revision 4351.
  • Revision ID: aaron@aaronbentley.com-20090511191114-g0u190bdpfou9bbw
Gracefully handle mail clients that don't support bodies.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
    rio,
30
30
    testament,
31
31
    timestamp,
 
32
    trace,
32
33
    )
33
34
from bzrlib.bundle import (
34
35
    serializer as bundle_serializer,
286
287
        else:
287
288
            revision = branch.repository.get_revision(self.revision_id)
288
289
            subject += revision.get_summary()
289
 
        orig_body = body
290
 
        for hook in self.hooks['merge_request_body']:
291
 
            params = MergeRequestBodyParams(body, orig_body, self,
292
 
                                            to, basename, subject, branch,
293
 
                                            tree)
294
 
            body = hook(params)
 
290
        if getattr(mail_client, 'supports_body', False):
 
291
            orig_body = body
 
292
            for hook in self.hooks['merge_request_body']:
 
293
                params = MergeRequestBodyParams(body, orig_body, self,
 
294
                                                to, basename, subject, branch,
 
295
                                                tree)
 
296
                body = hook(params)
 
297
        elif len(self.hooks['merge_request_body']) > 0:
 
298
            trace.warning('Cannot run merge_request_body hooks because mail'
 
299
                          ' client %s does not support message bodies.',
 
300
                        mail_client.__class__.__name__)
295
301
        mail_client.compose_merge_request(to, subject,
296
302
                                          ''.join(self.to_lines()),
297
303
                                          basename, body)