~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bundle/serializer/v4.py

  • Committer: Jelmer Vernooij
  • Date: 2009-04-06 02:54:14 UTC
  • mfrom: (4253 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4255.
  • Revision ID: jelmer@samba.org-20090406025414-65tpjwcmjp5wa5oj
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
    pack,
28
28
    revision as _mod_revision,
29
29
    trace,
30
 
    xml_serializer,
 
30
    serializer,
31
31
    )
32
 
from bzrlib.bundle import bundle_data, serializer
 
32
from bzrlib.bundle import bundle_data, serializer as bundle_serializer
33
33
from bzrlib.util import bencode
34
34
 
35
35
 
54
54
 
55
55
    def begin(self):
56
56
        """Start writing the bundle"""
57
 
        self._fileobj.write(serializer._get_bundle_header(
58
 
            serializer.v4_string))
 
57
        self._fileobj.write(bundle_serializer._get_bundle_header(
 
58
            bundle_serializer.v4_string))
59
59
        self._fileobj.write('#\n')
60
60
        self._container.begin()
61
61
 
218
218
            yield (bytes, metadata) + self.decode_name(names[0][0])
219
219
 
220
220
 
221
 
class BundleSerializerV4(serializer.BundleSerializer):
 
221
class BundleSerializerV4(bundle_serializer.BundleSerializer):
222
222
    """Implement the high-level bundle interface"""
223
223
 
224
224
    def write(self, repository, revision_ids, forced_bases, fileobj):
250
250
    @staticmethod
251
251
    def get_source_serializer(info):
252
252
        """Retrieve the serializer for a given info object"""
253
 
        return xml_serializer.format_registry.get(info['serializer'])
 
253
        return serializer.format_registry.get(info['serializer'])
254
254
 
255
255
 
256
256
class BundleWriteOperation(object):
322
322
            revision_order.append(self.target)
323
323
        self._add_mp_records_keys('inventory', inv_vf, [(revid,) for revid in revision_order])
324
324
        parent_map = self.repository.get_parent_map(revision_order)
325
 
        for revision_id in revision_order:
 
325
        revision_to_str = self.repository._serializer.write_revision_to_string
 
326
        revisions = self.repository.get_revisions(revision_order)
 
327
        for revision in revisions:
 
328
            revision_id = revision.revision_id
326
329
            parents = parent_map.get(revision_id, None)
327
 
            revision_text = self.repository.get_revision_xml(revision_id)
 
330
            revision_text = revision_to_str(revision)
328
331
            self.bundle.add_fulltext_record(revision_text, parents,
329
332
                                       'revision', revision_id)
330
333
            try: