9
9
import bzrlib, bzrlib.commands
11
class cmd_send_changeset(bzrlib.commands.Command):
12
"""Send a bundled up changset via mail.
14
If no revision has been specified, the last commited change will
17
Subject of the mail can be specified by the --subject option,
18
otherwise information from the changeset log will be used.
20
takes_options = ['revision', 'subject', 'diff-options']
23
def run(self, to=None, subject=None, revision=None, diff_options=None):
24
from tempfile import TemporaryFile
25
from bzrlib import find_branch
26
from bzrlib.commands import BzrCommandError
31
if isinstance(revision, (list, tuple)):
33
raise BzrCommandError('We do not support rollup-changesets yet.')
34
revision = revision[0]
40
to = b.controlfile('x-send-address', 'rb').read().strip('\n')
42
raise BzrCommandError('destination address is not known')
47
rev = b.get_revision(b.lookup_revision(revision))
49
subject = rev.message.split('\n')[0]
51
info = "Changset for revision %d by %s\n" % (revision, rev.committer)
52
info += "with the following message:\n"
53
for line in rev.message.split('\n'):
54
info += " " + line + "\n"
56
message = bzrlib.osutils.get_text_message(info)
58
# FIXME: StringIO instead of temporary file
59
changeset_fp = TemporaryFile()
60
gen_changeset.show_changeset(b, revision,
61
external_diff_options=diff_options,
65
send_changeset.send_changeset(to, bzrlib.osutils._get_user_id(),
66
subject, changeset_fp, message)
11
69
class cmd_changeset(bzrlib.commands.Command):
12
70
"""Generate a bundled up changeset.
87
145
auto_commit=auto_commit)
90
if hasattr(bzrlib.commands, 'register_plugin_command'):
91
bzrlib.commands.register_plugin_command(cmd_changeset)
92
bzrlib.commands.register_plugin_command(cmd_verify_changeset)
93
bzrlib.commands.register_plugin_command(cmd_apply_changeset)
95
bzrlib.commands.OPTIONS['reverse'] = None
96
bzrlib.commands.OPTIONS['auto-commit'] = None
97
cmd_apply_changeset.takes_options.append('reverse')
98
cmd_apply_changeset.takes_options.append('auto-commit')
99
elif hasattr(bzrlib.commands, 'register_command'):
100
bzrlib.commands.register_command(cmd_changeset)
101
bzrlib.commands.register_command(cmd_verify_changeset)
102
bzrlib.commands.register_command(cmd_apply_changeset)
104
bzrlib.commands.OPTIONS['reverse'] = None
105
bzrlib.commands.OPTIONS['auto-commit'] = None
106
cmd_apply_changeset.takes_options.append('reverse')
107
cmd_apply_changeset.takes_options.append('auto-commit')
148
bzrlib.commands.register_command(cmd_changeset)
149
bzrlib.commands.register_command(cmd_verify_changeset)
150
bzrlib.commands.register_command(cmd_apply_changeset)
151
bzrlib.commands.register_command(cmd_send_changeset)
153
bzrlib.commands.OPTIONS['subject'] = str
154
bzrlib.commands.OPTIONS['reverse'] = None
155
bzrlib.commands.OPTIONS['auto-commit'] = None
156
cmd_apply_changeset.takes_options.append('reverse')
157
cmd_apply_changeset.takes_options.append('auto-commit')