Rev 65: Allow passing in a branch argument to submit_bundle (useful for testing). in file:///home/jelmer/bzr-submit/trunk/
Jelmer Vernooij
jelmer at samba.org
Wed Apr 11 15:34:26 BST 2007
At file:///home/jelmer/bzr-submit/trunk/
------------------------------------------------------------
revno: 65
revision-id: jelmer at samba.org-20070411143422-wxjop3d3u006dyw5
parent: jelmer at samba.org-20070409153408-w669pmw6slksneh5
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Wed 2007-04-11 16:34:22 +0200
message:
Allow passing in a branch argument to submit_bundle (useful for testing).
modified:
__init__.py __init__.py-20060624164558-9aabyghnw7kxeuwg-1
submit_helpers.py submit_helpers.py-20060624164558-9aabyghnw7kxeuwg-2
=== modified file '__init__.py'
--- a/__init__.py 2007-04-07 20:42:19 +0000
+++ b/__init__.py 2007-04-11 14:34:22 +0000
@@ -57,6 +57,9 @@
def run(self, branch=None, from_address=None, **parameters):
from submit_helpers import submit_bundle
+ from bzrlib.branch import Branch
+
+ branch = Branch.open_containing('.')[0]
return submit_bundle(branch, mail_from=from_address, **parameters)
=== modified file 'submit_helpers.py'
--- a/submit_helpers.py 2007-04-09 15:34:08 +0000
+++ b/submit_helpers.py 2007-04-11 14:34:22 +0000
@@ -128,7 +128,6 @@
return (mail_to, multipart, pqm)
-
# Taken from pqm-submit plugin.
# http://bazaar.launchpad.net/~bzr-pqm-devel/bzr-pqm/devel/
def public_branch(branch, config):
@@ -183,7 +182,7 @@
rev = branch.repository.get_revision(branch.last_revision())
return '[PATCH] ' + rev.message.replace('\n', ' ')
-def get_bundle_text(base, revision, remember):
+def get_bundle_text(branch, revision, remember):
"""Handle tempfile etc. during bundle creation"""
if base is not None:
bundle_remember = remember
@@ -265,13 +264,13 @@
msg.attach(part)
return msg.as_string()
-def submit_bundle(base=None, revision=None, subject=None, dry_run=False,
+def submit_bundle(branch=None, revision=None, subject=None, dry_run=False,
message_file=None, address=None, remember=False, target='default',
mail_from=None, output_file=None):
"""Submit a bundle via email.
Parameters:
- base, revision: Same as the parameter to the bundle command
+ branch, revision: Same as the parameter to the bundle command
subject: Message subject (defaults to [PATCH] + commit_message)
dry_run: Print the message to stdout
message_file: Read message from this file
@@ -283,8 +282,6 @@
(forces dry_run = True)
"""
- from bzrlib.bzrdir import BzrDir
- branch = BzrDir.open_containing('.')[0].open_branch()
config = BranchConfigSubmitBundle(branch)
if output_file:
@@ -295,16 +292,16 @@
mail_from = config.username()
try:
- mail_to, multipart, pqm = get_mailto(address, target,
+ mail_to, multipart, pqm = get_mailto(config, address, target,
remember, dry_run)
except BzrCommandError:
#Ugly hack
import __init__
__init__.read_options(branch)
- mail_to, multipart, pqm = get_mailto(address, target,
+ mail_to, multipart, pqm = get_mailto(config, address, target,
remember, dry_run)
- bundle_text = get_bundle_text(base, revision, remember)
+ bundle_text = get_bundle_text(branch, revision, remember)
if not pqm:
message_text = get_message_text(mail_to, bundle_text, message_file)
@@ -342,9 +339,8 @@
f.close()
else:
print msg
- return
-
- send_message(config, mail_from, mail_to, msg)
+ else:
+ send_message(config, mail_from, mail_to, msg)
return 0 # Everything OK
More information about the bazaar-commits
mailing list