Merge lp:~james-w/tarmac/verify-command into lp:~ubuntuone-hackers/tarmac/trunk

Proposed by James Westby
Status: Merged
Approved by: Jonathan Lange
Approved revision: 422
Merged at revision: 423
Proposed branch: lp:~james-w/tarmac/verify-command
Merge into: lp:~ubuntuone-hackers/tarmac/trunk
Prerequisite: lp:~james-w/tarmac/check-command
Diff against target: 58 lines (+10/-4)
2 files modified
tarmac/bin/commands.py (+7/-4)
tarmac/bin/options.py (+3/-0)
To merge this branch: bzr merge lp:~james-w/tarmac/verify-command
Reviewer Review Type Date Requested Status
Jonathan Lange (community) Approve
Review via email: mp+140551@code.launchpad.net

Description of the change

Hi,

This allows for the verify-command to be supplied as a command line argument,
allowing for running without a config file in the simplest cases.

Thanks,

James

To post a comment you must log in.
Revision history for this message
Jonathan Lange (jml) wrote :

This looks like a straight-up, obvious improvement. Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tarmac/bin/commands.py'
--- tarmac/bin/commands.py 2012-12-18 21:24:40 +0000
+++ tarmac/bin/commands.py 2012-12-18 21:24:40 +0000
@@ -332,9 +332,10 @@
332 options.debug_option,332 options.debug_option,
333 options.imply_commit_message_option,333 options.imply_commit_message_option,
334 options.one_option,334 options.one_option,
335 options.verify_command_option,
335 ]336 ]
336337
337 def _do_merges(self, branch_url):338 def _do_merges(self, branch_url, verify_command=None):
338339
339 lp_branch = self.launchpad.branches.getByUrl(url=branch_url)340 lp_branch = self.launchpad.branches.getByUrl(url=branch_url)
340 if lp_branch is None:341 if lp_branch is None:
@@ -354,11 +355,13 @@
354 proposals = proposals[0]355 proposals = proposals[0]
355356
356 target = Branch.create(lp_branch, self.config, create_tree=True)357 target = Branch.create(lp_branch, self.config, create_tree=True)
358 if verify_command is not None:
359 setattr(target.config, 'verify_command', verify_command)
357 statuses = merge_proposals(target, proposals, self.logger, self.config, self)360 statuses = merge_proposals(target, proposals, self.logger, self.config, self)
358 return statuses361 return statuses
359362
360363
361 def run(self, branch_url=None, launchpad=None, **kwargs):364 def run(self, branch_url=None, launchpad=None, verify_command=None, **kwargs):
362 for key, value in kwargs.iteritems():365 for key, value in kwargs.iteritems():
363 self.config.set('Tarmac', key, value)366 self.config.set('Tarmac', key, value)
364367
@@ -378,14 +381,14 @@
378 'branch_url': branch_url})381 'branch_url': branch_url})
379 if not branch_url.startswith('lp:'):382 if not branch_url.startswith('lp:'):
380 raise TarmacCommandError('Branch urls must start with lp:')383 raise TarmacCommandError('Branch urls must start with lp:')
381 statuses.extend(self._do_merges(branch_url))384 statuses.extend(self._do_merges(branch_url, verify_command=verify_command))
382 else:385 else:
383 for branch in self.config.branches:386 for branch in self.config.branches:
384 self.logger.debug(387 self.logger.debug(
385 'Merging approved branches against %(branch)s' % {388 'Merging approved branches against %(branch)s' % {
386 'branch': branch})389 'branch': branch})
387 try:390 try:
388 statuses.extend(self._do_merges(branch))391 statuses.extend(self._do_merges(branch, verify_command=verify_command))
389392
390 # If we've been asked to only merge one branch, then exit.393 # If we've been asked to only merge one branch, then exit.
391 if statuses and self.config.one:394 if statuses and self.config.one:
392395
=== modified file 'tarmac/bin/options.py'
--- tarmac/bin/options.py 2012-05-26 04:14:45 +0000
+++ tarmac/bin/options.py 2012-12-18 21:24:40 +0000
@@ -18,3 +18,6 @@
18one_option = Option(18one_option = Option(
19 'one', short_name='1',19 'one', short_name='1',
20 help='Merge only one branch and exit.')20 help='Merge only one branch and exit.')
21verify_command_option = Option(
22 'verify-command', type=str,
23 help='The verify command to run.')

Subscribers

People subscribed via source and target branches