~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/devscripts/autoland.py

  • Committer: Michael Hudson
  • Date: 2010-07-27 05:07:09 UTC
  • mto: (11128.11.2)
  • mto: This revision was merged to the branch mainline in revision 11299.
  • Revision ID: michael.hudson@linaro.org-20100727050709-lue5tgfc3w5bhgj8
merge more separate apache config from later pipe

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
    """Raised when we try to get a review message without enough reviewers."""
13
13
 
14
14
 
15
 
class MissingBugsError(Exception):
16
 
    """Merge proposal has no linked bugs and no [no-qa] tag."""
17
 
 
18
 
 
19
 
class MissingBugsIncrementalError(Exception):
20
 
    """Merge proposal has the [incr] tag but no linked bugs."""
21
 
 
22
 
 
23
15
class LaunchpadBranchLander:
24
16
 
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)
162
154
 
163
 
    def get_commit_message(self, commit_text, testfix=False, no_qa=False,
164
 
                           incremental=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()
168
 
 
169
 
        tags = ''.join([
170
 
            get_testfix_clause(testfix),
 
159
        if testfix:
 
160
            testfix = '[testfix]'
 
161
        else:
 
162
            testfix = ''
 
163
        return '%s%s%s %s' % (
 
164
            testfix,
171
165
            get_reviewer_clause(reviews),
172
166
            get_bugs_clause(bugs),
173
 
            get_qa_clause(bugs, no_qa,
174
 
                incremental),
175
 
            ])
176
 
 
177
 
        return '%s %s' % (tags, commit_text)
178
 
 
179
 
 
180
 
def get_testfix_clause(testfix=False):
181
 
    """Get the testfix clause."""
182
 
    if testfix:
183
 
        testfix_clause = '[testfix]'
184
 
    else:
185
 
        testfix_clause = ''
186
 
    return testfix_clause
187
 
 
188
 
 
189
 
def get_qa_clause(bugs, no_qa=False, incremental=False):
190
 
    """Check the no-qa and incremental options, getting the qa clause.
191
 
 
192
 
    The qa clause will always be or no-qa, or incremental or no tags, never both at
193
 
    the same time.
194
 
    """
195
 
    qa_clause = ""
196
 
 
197
 
    if not bugs and not no_qa and not incremental:
198
 
        raise MissingBugsError
199
 
 
200
 
    if incremental and not bugs:
201
 
        raise MissingBugsIncrementalError
202
 
 
203
 
    if incremental:
204
 
        qa_clause = '[incr]'
205
 
    elif no_qa:
206
 
        qa_clause = '[no-qa]'
207
 
    else:
208
 
        qa_clause = ''
209
 
 
210
 
    return qa_clause
 
167
            commit_text)
211
168
 
212
169
 
213
170
def get_email(person):