30
29
__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.
32
class cmd_pqm_submit(Command):
33
"""Submit the parent tree to the pqm.
36
$ echo "star-merge $PARENT $TARGET"
38
| mail pqm@somewhere -s "merge text"
40
But it pays attention to who the local committer is
41
(using their e-mail address), and uses the local
42
gpg signing configuration. (As well as target pqm
45
The reason we use 'parent' instead of the local branch
46
is that most likely the local branch is not a public
47
branch. And the branch must be available to the pqm.
49
This can be configured at the branch level using ~/.bazaar/locations.conf.
52
pqm_email = PQM <pqm@example.com>
53
pqm_user_email = User Name <user@example.com>
54
submit_branch = http://code.example.com/code/project/devel
55
# Set public_branch appropriately for all branches in repository:
56
public_branch = http://code.example.com/code/emurphy/project
57
public_branch:policy = appendpath
58
[/home/emurphy/repo/branch]
59
# Override public_branch for this repository:
60
public_branch = http://alternate.host.example.com/other/public/branch
62
smtp_server = host:port
66
If you don't specify the smtp server, the message will be sent via localhost.
41
69
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]).")),
72
help='Message to use on merge to pqm. '
73
'Currently must be a single line because of pqm limits.',
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.'),
79
Option('submit-branch', type=str,
80
help='Use this url as the target submission branch.'),
81
Option('ignore-local', help='Do not check the local branch or tree.'),
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)
84
def run(self, location=None, message=None, public_location=None,
85
dry_run=False, submit_branch=None, ignore_local=False):
86
from bzrlib import errors, trace, bzrdir
87
if __name__ != 'bzrlib.plugins.pqm':
88
trace.warning('The bzr-pqm plugin needs to be called'
89
' "bzrlib.plugins.pqm" not "%s"\n'
90
'Please rename the plugin.',
93
from bzrlib.plugins.pqm.pqm_submit import submit
96
tree, b, relpath = None, None, None
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)
100
tree, b, relpath = bzrdir.BzrDir.open_containing_tree_or_branch(
102
if relpath and not tree and location != '.':
103
raise errors.BzrCommandError(
104
'No working tree was found, but we were not given the '
105
'exact path to the branch.\n'
106
'We found a branch at: %s' % (b.base,))
108
raise errors.BzrCommandError(
109
'You must supply a commit message for the pqm to use.')
110
submit(b, message=message, dry_run=dry_run,
111
public_location=public_location,
112
submit_location=submit_branch,
113
tree=tree, ignore_local=ignore_local)
116
register_command(cmd_pqm_submit)
99
120
from bzrlib.tests import TestLoader
100
from unittest import TestSuite
102
from tests import test_tarmac_land
121
import test_pqm_submit
104
123
loader = TestLoader()
106
loader.loadTestsFromModule(test_tarmac_land),
124
return loader.loadTestsFromModule(test_pqm_submit)