Code review comment for lp:~jml/bzr/rubberstamp

Revision history for this message
Martin Pool (mbp) wrote :

That seems like a good feature? Could anyone be surprised by the change and
want the old behavior? Maybe not.

It should be in NEWS.

  vote approve
On 23 Oct 2012 03:30, "Jonathan Lange" <email address hidden> wrote:

> Jonathan Lange has proposed merging lp:~jml/bzr/rubberstamp into lp:bzr.
>
> Commit message:
> Set approved revision and vote "Approve" when using lp-propose --approve
>
> Requested reviews:
> bzr-core (bzr-core)
>
> For more details, see:
> https://code.launchpad.net/~jml/bzr/rubberstamp/+merge/130850
>
> The common use case for me using lp-propose --approve is when I'm creating
> a merge proposal that will then be taken up by another system, like tarmac,
> for processing and landing.
>
> This branch caters to that use case by voting "Approve" and by setting the
> approved revision. Both of these enable the default tarmac set up to land
> the merge proposal. Altogether, this makes 'lp-propose --approve'
> something of a rubberstamping operation.
>
>
> --
> https://code.launchpad.net/~jml/bzr/rubberstamp/+merge/130850
> Your team bzr-core is requested to review the proposed merge of
> lp:~jml/bzr/rubberstamp into lp:bzr.
>
> === modified file 'bzrlib/plugins/launchpad/cmds.py'
> --- bzrlib/plugins/launchpad/cmds.py 2012-07-23 19:19:05 +0000
> +++ bzrlib/plugins/launchpad/cmds.py 2012-10-22 16:29:21 +0000
> @@ -293,7 +293,8 @@
> Option('message', short_name='m', type=unicode,
> help='Commit message.'),
> Option('approve',
> - help='Mark the proposal as approved
> immediately.'),
> + help=('Mark the proposal as approved
> immediately, '
> + 'setting the approved revision to
> tip.')),
> Option('fixes', 'The bug this proposal fixes.', str),
> ListOption('review', short_name='R', type=unicode,
> help='Requested reviewer and optional type.')]
>
> === modified file 'bzrlib/plugins/launchpad/lp_propose.py'
> --- bzrlib/plugins/launchpad/lp_propose.py 2012-02-26 15:43:02 +0000
> +++ bzrlib/plugins/launchpad/lp_propose.py 2012-10-22 16:29:21 +0000
> @@ -137,6 +137,15 @@
> })
> return body
>
> + def get_source_revid(self):
> + """Get the revision ID of the source branch."""
> + source_branch = self.source_branch.bzr
> + source_branch.lock_read()
> + try:
> + return source_branch.last_revision()
> + finally:
> + source_branch.unlock()
> +
> def check_proposal(self):
> """Check that the submission is sensible."""
> if self.source_branch.lp.self_link ==
> self.target_branch.lp.self_link:
> @@ -180,6 +189,15 @@
> error_lines.append(line)
> raise Exception(''.join(error_lines))
>
> + def approve_proposal(self, mp):
> + revid = self.get_source_revid()
> + self.call_webservice(
> + mp.createComment,
> + vote=u'Approve',
> + subject='', # Use the default subject.
> + content=u"Rubberstamp! Proposer approves of own proposal.")
> + self.call_webservice(mp.setStatus, status=u'Approved',
> revid=revid)
> +
> def create_proposal(self):
> """Perform the submission."""
> prerequisite_branch = self._get_prerequisite_branch()
> @@ -203,7 +221,7 @@
> commit_message=self.commit_message, reviewers=reviewers,
> review_types=review_types)
> if self.approve:
> - self.call_webservice(mp.setStatus, status='Approved')
> + self.approve_proposal(mp)
> if self.fixes:
> if self.fixes.startswith('lp:'):
> self.fixes = self.fixes[3:]
>
>
>

review: Approve

« Back to merge proposal