12
12
"""Raised when we try to get a review message without enough reviewers."""
15
class MissingBugsError(Exception):
16
"""Merge proposal has no linked bugs and no [no-qa] tag."""
19
class MissingBugsIncrementalError(Exception):
20
"""Merge proposal has the [incr] tag but no linked bugs."""
23
15
class LaunchpadBranchLander:
25
17
name = 'launchpad-branch-lander'
160
152
# URL. Do it ourselves.
161
153
return URI(scheme='bzr+ssh', host=host, path='/' + branch.unique_name)
163
def get_commit_message(self, commit_text, testfix=False, no_qa=False,
155
def get_commit_message(self, commit_text, testfix=False):
165
156
"""Get the Launchpad-style commit message for a merge proposal."""
166
157
reviews = self.get_reviews()
167
158
bugs = self.get_bugs()
170
get_testfix_clause(testfix),
160
testfix = '[testfix]'
163
return '%s%s%s %s' % (
171
165
get_reviewer_clause(reviews),
172
166
get_bugs_clause(bugs),
173
get_qa_clause(bugs, no_qa,
177
return '%s %s' % (tags, commit_text)
180
def get_testfix_clause(testfix=False):
181
"""Get the testfix clause."""
183
testfix_clause = '[testfix]'
186
return testfix_clause
189
def get_qa_clause(bugs, no_qa=False, incremental=False):
190
"""Check the no-qa and incremental options, getting the qa clause.
192
The qa clause will always be or no-qa, or incremental or no tags, never both at
197
if not bugs and not no_qa and not incremental:
198
raise MissingBugsError
200
if incremental and not bugs:
201
raise MissingBugsIncrementalError
206
qa_clause = '[no-qa]'
213
170
def get_email(person):