1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
# Copyright (C) 2006-2010 by Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
"""Functionality for updating merge proposals for Tarmac submission.
"""
from bzrlib.commands import Command, register_command
from bzrlib.option import Option
from bzrlib.errors import BzrCommandError
version_info = (0, 0, 1, 'dev', 0)
if version_info[3] == 'final':
version_string = '%d.%d.%d' % version_info[:3]
else:
version_string = '%d.%d.%d%s%d' % version_info
__version__ = version_string
class cmd_tarmac_land(Command):
"""Set the Merge Proposal to be processed by Tarmac.
The branch will be handled by Tarmac according to the merge proposal. If
there is more than one one outstanding proposal for the branch, its
location must be specified.
"""
takes_args = ['location?']
takes_options = [
Option('dry-run', help='Display the commit message instead of sending.'),
Option(
'testfix',
help="This is a testfix (tags commit with [testfix])."),
Option(
'no-qa',
help="Does not require QA (tags commit with [no-qa])."),
Option(
'incremental',
help="Incremental to other bug fix (tags commit with [incr])."),
Option(
'rollback', type=int,
help=(
"Rollback given revision number. (tags commit with "
"[rollback=revno]).")),
]
def run(self, location=None, dry_run=False, testfix=False,
no_qa=False, incremental=False, rollback=None):
from bzrlib.plugins.tarmac_land.tarmac_land import Submitter
from bzrlib import branch as _mod_branch
from bzrlib.plugins.tarmac_land.tarmac_land import (
MissingReviewError, MissingBugsError, MissingBugsIncrementalError)
if dry_run:
outf = self.outf
else:
outf = None
branch = _mod_branch.Branch.open_containing('.')[0]
if rollback and (no_qa or incremental):
print "--rollback option used. Ignoring --no-qa and --incremental."
try:
submitter = Submitter(branch, location, testfix, no_qa,
incremental, rollback=rollback).run(outf)
except MissingReviewError:
raise BzrCommandError(
"Cannot land branches that haven't got approved code "
"reviews. Get an 'Approved' vote so we can fill in the "
"[r=REVIEWER] section.")
except MissingBugsError:
raise BzrCommandError(
"Branch doesn't have linked bugs and doesn't have no-qa "
"option set. Use --no-qa, or link the related bugs to the "
"branch.")
except MissingBugsIncrementalError:
raise BzrCommandError(
"--incremental option requires bugs linked to the branch. "
"Link the bugs or remove the --incremental option.")
register_command(cmd_tarmac_land)
def test_suite():
from bzrlib.tests import TestLoader
from unittest import TestSuite
from tests import test_tarmac_land
loader = TestLoader()
return TestSuite([
loader.loadTestsFromModule(test_tarmac_land),
])
|