10
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
11
# GNU General Public License for more details.
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.
16
"""Functionality for updating merge proposals for Tarmac submission.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
"""Add functionality for controlling a Patch Queue Manager (pqm).
18
This adds a few configuration options. All of these
19
are accessible at the Branch level.
21
# The email address of the Patch Queue Manager
22
pqm_email = pqm@pqm.ubuntu.com
24
# The pqm managed branch to merge these changes into
25
pqm_branch = http://bazaar-ng.org/bzr/bzr.dev/
27
# The branch we will be submitting to the pqm
28
# This is custom because the publically accessible location
29
# is frequently not this or parent, because they usually
30
# need write access, and the public location is readonly
31
# The preferred submission locations are:
38
# This is the smtp server that should be used for
39
# outgoing mail. If not set, or set to the empty
40
# string, then the email will be sent directly to
42
smtp_server = localhost
44
# smtp_server = host:port
19
49
from bzrlib.commands import Command, register_command
20
50
from bzrlib.option import Option
21
from bzrlib.errors import BzrCommandError
24
version_info = (0, 0, 1, 'dev', 0)
26
if version_info[3] == 'final':
27
version_string = '%d.%d.%d' % version_info[:3]
29
version_string = '%d.%d.%d%s%d' % version_info
30
__version__ = version_string
33
class cmd_tarmac_land(Command):
34
"""Set the Merge Proposal to be processed by Tarmac.
36
The branch will be handled by Tarmac according to the merge proposal. If
37
there is more than one one outstanding proposal for the branch, its
38
location must be specified.
51
import bzrlib.errors as errors
53
from bzrlib.bzrdir import BzrDir
56
class cmd_pqm_submit(Command):
57
"""Submit the parent tree to the pqm.
60
$ echo "star-merge $PARENT $TARGET"
62
| mail pqm@somewhere -s "merge text"
64
But it pays attention to who the local committer is
65
(using their e-mail address), and uses the local
66
gpg signing configuration. (As well as target pqm
69
The reason we use 'parent' instead of the local branch
70
is that most likely the local branch is not a public
71
branch. And the branch must be available to the pqm.
41
74
takes_args = ['location?']
44
Option('dry-run', help='Display the commit message instead of sending.'),
47
help="This is a testfix (tags commit with [testfix])."),
50
help="Does not require QA (tags commit with [no-qa])."),
53
help="Incremental to other bug fix (tags commit with [incr])."),
57
"Rollback given revision number. (tags commit with "
58
"[rollback=revno]).")),
61
def run(self, location=None, dry_run=False, testfix=False,
62
no_qa=False, incremental=False, rollback=None):
63
from bzrlib.plugins.tarmac_land.tarmac_land import Submitter
64
from bzrlib import branch as _mod_branch
65
from bzrlib.plugins.tarmac_land.tarmac_land import (
66
MissingReviewError, MissingBugsError, MissingBugsIncrementalError)
75
takes_options = ['message',
76
Option('dry-run', help='Print request instead of sending'),
77
Option('public-location', type=str,
78
help='Use this url as the public location to the pqm.'),
81
def run(self, location=None, message=None, public_location=None, dry_run=False):
82
from pqm_submit import submit
86
# If we are simply specifying '.' then
87
# we want to open the local branch.
88
# all other uses require an exact path
90
bzrdir = BzrDir.open_containing('.')[0]
73
branch = _mod_branch.Branch.open_containing('.')[0]
74
if rollback and (no_qa or incremental):
75
print "--rollback option used. Ignoring --no-qa and --incremental."
77
submitter = Submitter(branch, location, testfix, no_qa,
78
incremental, rollback=rollback).run(outf)
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 "
89
except MissingBugsIncrementalError:
90
raise BzrCommandError(
91
"--incremental option requires bugs linked to the branch. "
92
"Link the bugs or remove the --incremental option.")
95
register_command(cmd_tarmac_land)
92
bzrdir = BzrDir.open(location)
94
b = bzrdir.open_branch()
95
submit(b, message=message, dry_run=dry_run, public_location=public_location)
98
register_command(cmd_pqm_submit)
99
from bzrlib.tests import TestLoader
100
from unittest import TestSuite
102
from tests import test_tarmac_land
102
from bzrlib.tests import TestSuite, TestLoader
103
import test_pqm_submit
104
105
loader = TestLoader()
106
loader.loadTestsFromModule(test_tarmac_land),
106
return loader.loadTestsFromModule(loader)