~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Ross Lagerwall
  • Date: 2012-08-07 06:32:51 UTC
  • mto: (6437.63.5 2.5)
  • mto: This revision was merged to the branch mainline in revision 6558.
  • Revision ID: rosslagerwall@gmail.com-20120807063251-x9p03ghg2ws8oqjc
Add bzrlib/locale to .bzrignore

bzrlib/locale is generated with ./setup.py build_mo which is in turn called
by ./setup.py build

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
    hooks = ProposeMergeHooks()
53
53
 
54
54
    def __init__(self, tree, source_branch, target_branch, message, reviews,
55
 
                 staging=False, approve=False, fixes=None):
 
55
                 staging=False, approve=False):
56
56
        """Constructor.
57
57
 
58
58
        :param tree: The working tree for the source branch.
90
90
                            for reviewer, review_type in
91
91
                            reviews]
92
92
        self.approve = approve
93
 
        self.fixes = fixes
94
93
 
95
94
    def get_comment(self, prerequisite_branch):
96
95
        """Determine the initial comment for the merge proposal."""
137
136
            })
138
137
        return body
139
138
 
140
 
    def get_source_revid(self):
141
 
        """Get the revision ID of the source branch."""
142
 
        source_branch = self.source_branch.bzr
143
 
        source_branch.lock_read()
144
 
        try:
145
 
            return source_branch.last_revision()
146
 
        finally:
147
 
            source_branch.unlock()
148
 
 
149
139
    def check_proposal(self):
150
140
        """Check that the submission is sensible."""
151
141
        if self.source_branch.lp.self_link == self.target_branch.lp.self_link:
189
179
                error_lines.append(line)
190
180
            raise Exception(''.join(error_lines))
191
181
 
192
 
    def approve_proposal(self, mp):
193
 
        revid = self.get_source_revid()
194
 
        self.call_webservice(
195
 
            mp.createComment,
196
 
            vote=u'Approve',
197
 
            subject='', # Use the default subject.
198
 
            content=u"Rubberstamp! Proposer approves of own proposal.")
199
 
        self.call_webservice(mp.setStatus, status=u'Approved', revid=revid)
200
 
 
201
182
    def create_proposal(self):
202
183
        """Perform the submission."""
203
184
        prerequisite_branch = self._get_prerequisite_branch()
221
202
            commit_message=self.commit_message, reviewers=reviewers,
222
203
            review_types=review_types)
223
204
        if self.approve:
224
 
            self.approve_proposal(mp)
225
 
        if self.fixes:
226
 
            if self.fixes.startswith('lp:'):
227
 
                self.fixes = self.fixes[3:]
228
 
            self.call_webservice(
229
 
                self.source_branch.lp.linkBug,
230
 
                bug=self.launchpad.bugs[int(self.fixes)])
 
205
            self.call_webservice(mp.setStatus, status='Approved')
231
206
        webbrowser.open(lp_api.canonical_url(mp))
232
207
 
233
208