~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-03-12 09:57:36 UTC
  • mfrom: (4098.5.13 send-hookage)
  • Revision ID: pqm@pqm.ubuntu.com-20090312095736-fizxxpwp4gj9zqx9
(abentley) bzr send accepts --body

Show diffs side-by-side

added added

removed removed

Lines of Context:
4743
4743
               type=unicode),
4744
4744
        'revision',
4745
4745
        'message',
 
4746
        Option('body', help='Body for the email.', type=unicode),
4746
4747
        RegistryOption.from_kwargs('format',
4747
4748
        'Use the specified output format.',
4748
4749
        **{'4': 'Bundle format 4, Merge Directive 2 (default)',
4751
4752
 
4752
4753
    def run(self, submit_branch=None, public_branch=None, no_bundle=False,
4753
4754
            no_patch=False, revision=None, remember=False, output=None,
4754
 
            format='4', mail_to=None, message=None, **kwargs):
 
4755
            format='4', mail_to=None, message=None, body=None, **kwargs):
4755
4756
        return self._run(submit_branch, revision, public_branch, remember,
4756
4757
                         format, no_bundle, no_patch, output,
4757
 
                         kwargs.get('from', '.'), mail_to, message)
 
4758
                         kwargs.get('from', '.'), mail_to, message, body)
4758
4759
 
4759
4760
    def _run(self, submit_branch, revision, public_branch, remember, format,
4760
 
             no_bundle, no_patch, output, from_, mail_to, message):
 
4761
             no_bundle, no_patch, output, from_, mail_to, message, body):
4761
4762
        from bzrlib.revision import NULL_REVISION
4762
4763
        branch = Branch.open_containing(from_)[0]
4763
4764
        if output is None:
4775
4776
                if mail_to is None:
4776
4777
                    mail_to = config.get_user_option('submit_to')
4777
4778
                mail_client = config.get_mail_client()
 
4779
                if (not getattr(mail_client, 'supports_body', False)
 
4780
                    and body is not None):
 
4781
                    raise errors.BzrCommandError(
 
4782
                        'Mail client "%s" does not support specifying body' %
 
4783
                        mail_client.__class__.__name__)
4778
4784
            if remember and submit_branch is None:
4779
4785
                raise errors.BzrCommandError(
4780
4786
                    '--remember requires a branch to be specified.')
4857
4863
                    subject += revision.get_summary()
4858
4864
                basename = directive.get_disk_name(branch)
4859
4865
                mail_client.compose_merge_request(mail_to, subject,
4860
 
                                                  outfile.getvalue(), basename)
 
4866
                                                  outfile.getvalue(),
 
4867
                                                  basename, body)
4861
4868
        finally:
4862
4869
            if output != '-':
4863
4870
                outfile.close()
4931
4938
            output = '-'
4932
4939
        return self._run(submit_branch, revision, public_branch, remember,
4933
4940
                         format, no_bundle, no_patch, output,
4934
 
                         kwargs.get('from', '.'), None, None)
 
4941
                         kwargs.get('from', '.'), None, None, None)
4935
4942
 
4936
4943
 
4937
4944
class cmd_tag(Command):