37
38
from bzrlib.trace import note
40
class cmd_send_changeset(Command):
41
"""Send a bundled up changset via mail.
43
If no revision has been specified, the last commited change will
46
Subject of the mail can be specified by the --message option,
47
otherwise information from the changeset log will be used.
49
A editor will be spawned where the user may enter a description
50
of the changeset. The description can be read from a file with
51
the --file FILE option.
53
takes_options = ['revision', 'message', 'file']
56
def run(self, to=None, message=None, revision=None, file=None):
57
from bzrlib.errors import BzrCommandError
58
from send_changeset import send_changeset
60
if isinstance(revision, (list, tuple)):
62
raise BzrCommandError('We do not support rollup-changesets yet.')
63
revision = revision[0]
65
b = branch.Branch.open_containing('.')
69
to = b.controlfile('x-send-address', 'rb').read().strip('\n')
71
raise BzrCommandError('destination address is not known')
73
if not isinstance(revision, (list, tuple)):
76
send_changeset(b, revision, to, message, file)
79
41
class cmd_bundle_revisions(Command):
80
42
"""Generate a revision bundle.
172
134
target_branch.repository.unlock()
175
class cmd_verify_changeset(Command):
176
"""Read a written changeset, and make sure it is valid.
179
takes_args = ['filename?']
181
def run(self, filename=None):
182
from read_changeset import read_changeset
183
#from bzrlib.xml import serializer_v4
185
b, relpath = branch.Branch.open_containing('.')
187
if filename is None or filename == '-':
190
f = open(filename, 'U')
192
cset_info, cset_tree = read_changeset(f, b)
195
#serializer_v4.write(cset_tree.inventory, sys.stdout)
137
class cmd_bundle_info(Command):
138
"""Output interesting info about a bundle"""
141
takes_args = ['location']
142
takes_options = ['verbose']
144
def run(self, location, verbose=False):
145
from bzrlib.bundle.serializer import read_bundle
146
dirname, basename = urlutils.split(location)
147
bundle_file = transport.get_transport(dirname).get(basename)
148
bundle_info = read_bundle(bundle_file)
149
reader_method = getattr(bundle_info, 'get_bundle_reader', None)
150
if reader_method is None:
151
raise errors.BzrCommandError('Bundle format not supported')
155
for bytes, parents, repo_kind, revision_id, file_id\
156
in reader_method().iter_records():
157
by_kind.setdefault(repo_kind, []).append(
158
(bytes, parents, repo_kind, revision_id, file_id))
159
if file_id is not None:
160
file_ids.add(file_id)
161
print >> self.outf, 'Records'
162
for kind, records in sorted(by_kind.iteritems()):
163
multiparent = sum(1 for b, p, k, r, f in records if len(p) > 1)
164
print >> self.outf, '%s: %d (%d multiparent)' % \
165
(kind, len(records), multiparent)
166
print >> self.outf, 'unique files: %d' % len(file_ids)
170
for revision in bundle_info.real_revisions:
171
nicks.add(revision.properties['branch-nick'])
172
committers.add(revision.committer)
174
print >> self.outf, 'Revisions'
175
print >> self.outf, 'nicks: %s' % ', '.join(sorted(nicks))
176
print >> self.outf, 'committers: \n%s' % '\n'.join(sorted(committers))
180
bundle_file.readline()
181
bundle_file.readline()
182
content = bundle_file.read().decode('base-64').decode('bz2')
183
print >> self.outf, "Decoded contents"
184
self.outf.write(content)