~ursinha/lp-qa-tools/bzr-tarmacland

« back to all changes in this revision

Viewing changes to pqm_submit.py

  • Committer: James Henstridge
  • Date: 2008-03-25 05:08:50 UTC
  • Revision ID: james@jamesh.id.au-20080325050850-cev83yy11mbrowrj
* Use the standard NoPublicBranch exception to complain about a missing 
  public_branch rather than BzrCommandError.
* Add a NoPQMSubmissionAddress exception for the case when pqm_email is 
  missing from the config file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
        self.msg = message
38
38
 
39
39
 
 
40
class NoPQMSubmissionAddress(errors.BzrError):
 
41
 
 
42
    _fmt = "No PQM submission email address specified for %(branch_url)s."
 
43
 
 
44
    def __init__(self, branch):
 
45
        branch_url = urlutils.unescape_for_display(branch.base, 'ascii')
 
46
        errors.BzrError.__init__(self, branch_url=branch_url)
 
47
 
 
48
 
40
49
class PQMEmailMessage(EmailMessage):
41
50
    """PQM doesn't support proper email subjects, so we hack around it."""
42
51
 
87
96
                    public_location = urlutils.join(public_repo, branch_relpath)
88
97
 
89
98
            if public_location is None:
90
 
                raise errors.BzrCommandError(
91
 
                    'No public branch location given.  Please specify with '
92
 
                    '--public-location or see "bzr help pqm-submit" to see how '
93
 
                    'to set it in ~/.bazaar/locations.conf')
 
99
                raise errors.NoPublicBranch(self.source_branch)
94
100
        self.public_location = public_location
95
101
 
96
102
        if submit_location is None:
197
203
    mail_from = mail_from.encode('utf8') # Make sure this isn't unicode
198
204
    mail_to = config.get_user_option('pqm_email')
199
205
    if not mail_to:
200
 
        raise errors.BzrCommandError('No PQM submission address specified '
201
 
                                     'in configuration')
 
206
        raise NoPQMSubmissionAddress(branch)
202
207
    mail_to = mail_to.encode('utf8') # same here
203
208
 
204
209
    submission.check_tree()