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

Proposed by James Westby on 2012-12-18
Status: Merged
Approved by: Jonathan Lange on 2012-12-19
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) 2012-12-18 Approve on 2012-12-19
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.
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
1=== modified file 'tarmac/bin/commands.py'
2--- tarmac/bin/commands.py 2012-12-18 21:24:40 +0000
3+++ tarmac/bin/commands.py 2012-12-18 21:24:40 +0000
4@@ -332,9 +332,10 @@
5 options.debug_option,
6 options.imply_commit_message_option,
7 options.one_option,
8+ options.verify_command_option,
9 ]
10
11- def _do_merges(self, branch_url):
12+ def _do_merges(self, branch_url, verify_command=None):
13
14 lp_branch = self.launchpad.branches.getByUrl(url=branch_url)
15 if lp_branch is None:
16@@ -354,11 +355,13 @@
17 proposals = proposals[0]
18
19 target = Branch.create(lp_branch, self.config, create_tree=True)
20+ if verify_command is not None:
21+ setattr(target.config, 'verify_command', verify_command)
22 statuses = merge_proposals(target, proposals, self.logger, self.config, self)
23 return statuses
24
25
26- def run(self, branch_url=None, launchpad=None, **kwargs):
27+ def run(self, branch_url=None, launchpad=None, verify_command=None, **kwargs):
28 for key, value in kwargs.iteritems():
29 self.config.set('Tarmac', key, value)
30
31@@ -378,14 +381,14 @@
32 'branch_url': branch_url})
33 if not branch_url.startswith('lp:'):
34 raise TarmacCommandError('Branch urls must start with lp:')
35- statuses.extend(self._do_merges(branch_url))
36+ statuses.extend(self._do_merges(branch_url, verify_command=verify_command))
37 else:
38 for branch in self.config.branches:
39 self.logger.debug(
40 'Merging approved branches against %(branch)s' % {
41 'branch': branch})
42 try:
43- statuses.extend(self._do_merges(branch))
44+ statuses.extend(self._do_merges(branch, verify_command=verify_command))
45
46 # If we've been asked to only merge one branch, then exit.
47 if statuses and self.config.one:
48
49=== modified file 'tarmac/bin/options.py'
50--- tarmac/bin/options.py 2012-05-26 04:14:45 +0000
51+++ tarmac/bin/options.py 2012-12-18 21:24:40 +0000
52@@ -18,3 +18,6 @@
53 one_option = Option(
54 'one', short_name='1',
55 help='Merge only one branch and exit.')
56+verify_command_option = Option(
57+ 'verify-command', type=str,
58+ help='The verify command to run.')

Subscribers

People subscribed via source and target branches