~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/plugins/launchpad/lp_propose.py

  • Committer: John Arbash Meinel
  • Date: 2012-09-19 07:58:27 UTC
  • mfrom: (6437.63.9 2.5)
  • mto: This revision was merged to the branch mainline in revision 6563.
  • Revision ID: john@arbash-meinel.com-20120919075827-36b2b042kiaps0d3
Merge bzr-2.5.2 into trunk to get the fixes for ConnectionReset.

Show diffs side-by-side

added added

removed removed

Lines of Context:
94
94
 
95
95
    def get_comment(self, prerequisite_branch):
96
96
        """Determine the initial comment for the merge proposal."""
97
 
        if self.commit_message is not None:
98
 
            return self.commit_message.strip().encode('utf-8')
99
97
        info = ["Source: %s\n" % self.source_branch.lp.bzr_identity]
100
98
        info.append("Target: %s\n" % self.target_branch.lp.bzr_identity)
101
99
        if prerequisite_branch is not None:
139
137
            })
140
138
        return body
141
139
 
142
 
    def get_source_revid(self):
143
 
        """Get the revision ID of the source branch."""
144
 
        source_branch = self.source_branch.bzr
145
 
        source_branch.lock_read()
146
 
        try:
147
 
            return source_branch.last_revision()
148
 
        finally:
149
 
            source_branch.unlock()
150
 
 
151
140
    def check_proposal(self):
152
141
        """Check that the submission is sensible."""
153
142
        if self.source_branch.lp.self_link == self.target_branch.lp.self_link:
191
180
                error_lines.append(line)
192
181
            raise Exception(''.join(error_lines))
193
182
 
194
 
    def approve_proposal(self, mp):
195
 
        revid = self.get_source_revid()
196
 
        self.call_webservice(
197
 
            mp.createComment,
198
 
            vote=u'Approve',
199
 
            subject='', # Use the default subject.
200
 
            content=u"Rubberstamp! Proposer approves of own proposal.")
201
 
        self.call_webservice(mp.setStatus, status=u'Approved', revid=revid)
202
 
 
203
183
    def create_proposal(self):
204
184
        """Perform the submission."""
205
185
        prerequisite_branch = self._get_prerequisite_branch()
223
203
            commit_message=self.commit_message, reviewers=reviewers,
224
204
            review_types=review_types)
225
205
        if self.approve:
226
 
            self.approve_proposal(mp)
 
206
            self.call_webservice(mp.setStatus, status='Approved')
227
207
        if self.fixes:
228
208
            if self.fixes.startswith('lp:'):
229
209
                self.fixes = self.fixes[3:]