~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2012-10-10 18:29:39 UTC
  • mto: This revision was merged to the branch mainline in revision 6569.
  • Revision ID: v.ladeuil+lp@free.fr-20121010182939-iv6e9wj26rp61nc2
Fix formattting.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
 
17
from __future__ import absolute_import
 
18
 
17
19
from bzrlib import (
18
20
    errors,
19
21
    hooks,
25
27
from bzrlib import (
26
28
    msgeditor,
27
29
    )
 
30
from bzrlib.i18n import gettext
28
31
from bzrlib.plugins.launchpad import (
29
32
    lp_api,
30
33
    lp_registration,
49
52
    hooks = ProposeMergeHooks()
50
53
 
51
54
    def __init__(self, tree, source_branch, target_branch, message, reviews,
52
 
                 staging=False, approve=False):
 
55
                 staging=False, approve=False, fixes=None):
53
56
        """Constructor.
54
57
 
55
58
        :param tree: The working tree for the source branch.
87
90
                            for reviewer, review_type in
88
91
                            reviews]
89
92
        self.approve = approve
 
93
        self.fixes = fixes
90
94
 
91
95
    def get_comment(self, prerequisite_branch):
92
96
        """Determine the initial comment for the merge proposal."""
142
146
            if mp.queue_status in ('Merged', 'Rejected'):
143
147
                continue
144
148
            if mp.target_branch.self_link == self.target_branch.lp.self_link:
145
 
                raise errors.BzrCommandError(
146
 
                    'There is already a branch merge proposal: %s' %
 
149
                raise errors.BzrCommandError(gettext(
 
150
                    'There is already a branch merge proposal: %s') %
147
151
                    lp_api.canonical_url(mp))
148
152
 
149
153
    def _get_prerequisite_branch(self):
200
204
            review_types=review_types)
201
205
        if self.approve:
202
206
            self.call_webservice(mp.setStatus, status='Approved')
 
207
        if self.fixes:
 
208
            if self.fixes.startswith('lp:'):
 
209
                self.fixes = self.fixes[3:]
 
210
            self.call_webservice(
 
211
                self.source_branch.lp.linkBug,
 
212
                bug=self.launchpad.bugs[int(self.fixes)])
203
213
        webbrowser.open(lp_api.canonical_url(mp))
204
214
 
205
215