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