22
22
from bzrlib import errors
23
23
from bzrlib.bundle.serializer import (BundleSerializer,
26
26
from bzrlib.bundle.serializer import binary_diff
27
27
from bzrlib.bundle.bundle_data import (RevisionInfo, BundleInfo, BundleTree)
29
29
from bzrlib.osutils import pathjoin
30
30
from bzrlib.progress import DummyProgress
31
31
from bzrlib.revision import NULL_REVISION
32
from bzrlib.rio import RioWriter, read_stanzas
33
34
from bzrlib.testament import StrictTestament
34
35
from bzrlib.timestamp import (
131
def write_bundle(self, repository, target, base, fileobj):
132
return self._write_bundle(repository, target, base, fileobj)
134
132
def _write_main_header(self):
135
133
"""Write the header for the changes"""
137
f.write(_get_bundle_header('0.8'))
135
f.write(BUNDLE_HEADER)
140
def _write(self, key, value, indent=1, trailing_space_when_empty=False):
141
"""Write out meta information, with proper indenting, etc.
143
:param trailing_space_when_empty: To work around a bug in earlier
144
bundle readers, when writing an empty property, we use "prop: \n"
145
rather than writing "prop:\n".
146
If this parameter is True, and value is the empty string, we will
147
write an extra space.
139
def _write(self, key, value, indent=1):
140
"""Write out meta information, with proper indenting, etc"""
149
141
assert indent > 0, 'indentation must be greater than 0'
151
143
f.write('#' + (' ' * indent))
152
144
f.write(key.encode('utf-8'))
154
if trailing_space_when_empty and value == '':
158
147
elif isinstance(value, str):
237
226
w('base id', base_rev)
238
227
if rev.properties:
239
228
self._write('properties', None, indent=1)
240
for name, value in sorted(rev.properties.items()):
241
self._write(name, value, indent=3,
242
trailing_space_when_empty=True)
229
for name, value in rev.properties.items():
230
self._write(name, value, indent=3)
244
232
# Add an extra blank space at the end
245
233
self.to_file.write('\n')