~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Aaron Bentley
  • Date: 2006-09-10 02:18:31 UTC
  • mto: This revision was merged to the branch mainline in revision 1997.
  • Revision ID: aaron.bentley@utoronto.ca-20060910021831-51f5888a7e62a02d
Update from review comments

Show diffs side-by-side

added added

removed removed

Lines of Context:
206
206
        # TODO: make sure to construct the right store classes, etc, depending
207
207
        # on whether escaping is required.
208
208
        self._warn_if_deprecated()
 
209
        self._serializer = xml5.serializer_v5
209
210
 
210
211
    def __repr__(self):
211
212
        return '%s(%r)' % (self.__class__.__name__, 
410
411
        revision_ids. Each altered file-ids has the exact revision_ids that
411
412
        altered it listed explicitly.
412
413
        """
413
 
        assert self._format.has_unnested_inventory(), \
 
414
        assert self._serializer.support_altered_by_hack, \
414
415
            ("fileids_altered_by_revision_ids only supported for branches " 
415
416
             "which store inventory as unnested xml, not on %r" % self)
416
417
        selected_revision_ids = set(revision_ids)
458
459
        :param revision_id: The expected revision id of the inventory.
459
460
        :param xml: A serialised inventory.
460
461
        """
461
 
        result = xml5.serializer_v5.read_inventory_from_string(xml)
 
462
        result = self._serializer.read_inventory_from_string(xml)
462
463
        result.root.revision = revision_id
463
464
        return result
464
465
 
465
466
    def serialise_inventory(self, inv):
466
 
        return xml5.serializer_v5.write_inventory_to_string(inv)
 
467
        return self._serializer.write_inventory_to_string(inv)
467
468
 
468
469
    @needs_read_lock
469
470
    def get_inventory_xml(self, revision_id):
1002
1003
 
1003
1004
class KnitRepository2(KnitRepository):
1004
1005
    """"""
 
1006
    def __init__(self, _format, a_bzrdir, control_files, _revision_store,
 
1007
                 control_store, text_store):
 
1008
        KnitRepository.__init__(self, _format, a_bzrdir, control_files,
 
1009
                              _revision_store, control_store, text_store)
 
1010
        self._serializer = xml6.serializer_v6
1005
1011
 
1006
1012
    def deserialise_inventory(self, revision_id, xml):
1007
1013
        """Transform the xml into an inventory object. 
1009
1015
        :param revision_id: The expected revision id of the inventory.
1010
1016
        :param xml: A serialised inventory.
1011
1017
        """
1012
 
        result = xml6.serializer_v6.read_inventory_from_string(xml)
 
1018
        result = self._serializer.read_inventory_from_string(xml)
1013
1019
        assert result.root.revision is not None
1014
1020
        return result
1015
1021
 
1021
1027
        """
1022
1028
        assert inv.revision_id is not None
1023
1029
        assert inv.root.revision is not None
1024
 
        return xml6.serializer_v6.write_inventory_to_string(inv)
 
1030
        return KnitRepository.serialise_inventory(self, inv)
1025
1031
 
1026
1032
    def get_commit_builder(self, branch, parents, config, timestamp=None, 
1027
1033
                           timezone=None, committer=None, revprops=None, 
1171
1177
        """
1172
1178
        return True
1173
1179
 
1174
 
    def has_unnested_inventory(self):
1175
 
        raise NotImplementedError(self.has_unnested_inventory)
1176
 
 
1177
1180
    def check_conversion_target(self, target_format):
1178
1181
        raise NotImplementedError(self.check_conversion_target)
1179
1182
 
1296
1299
        """See RepositoryFormat.get_format_description()."""
1297
1300
        return "Repository format 4"
1298
1301
 
1299
 
    def has_unnested_inventory(self):
1300
 
        return True
1301
 
 
1302
1302
    def initialize(self, url, shared=False, _internal=False):
1303
1303
        """Format 4 branches cannot be created."""
1304
1304
        raise errors.UninitializableFormat(self)
1348
1348
        """See RepositoryFormat.get_format_description()."""
1349
1349
        return "Weave repository format 5"
1350
1350
 
1351
 
    def has_unnested_inventory(self):
1352
 
        return True
1353
 
 
1354
1351
    def _get_revision_store(self, repo_transport, control_files):
1355
1352
        """See RepositoryFormat._get_revision_store()."""
1356
1353
        """Return the revision store object for this a_bzrdir."""
1381
1378
        """See RepositoryFormat.get_format_description()."""
1382
1379
        return "Weave repository format 6"
1383
1380
 
1384
 
    def has_unnested_inventory(self):
1385
 
        return True
1386
 
 
1387
1381
    def _get_revision_store(self, repo_transport, control_files):
1388
1382
        """See RepositoryFormat._get_revision_store()."""
1389
1383
        return self._get_text_rev_store(repo_transport,
1459
1453
        """See RepositoryFormat.get_format_description()."""
1460
1454
        return "Weave repository format 7"
1461
1455
 
1462
 
    def has_unnested_inventory(self):
1463
 
        return True
1464
 
 
1465
1456
    def check_conversion_target(self, target_format):
1466
1457
        pass
1467
1458
 
1580
1571
                                              },
1581
1572
                                              escaped=True)
1582
1573
 
1583
 
    def has_unnested_inventory(self):
1584
 
        return True
1585
 
 
1586
1574
    def initialize(self, a_bzrdir, shared=False):
1587
1575
        """Create a knit format 1 repository.
1588
1576
 
1682
1670
 
1683
1671
    def get_format_string(self):
1684
1672
        """See RepositoryFormat.get_format_string()."""
1685
 
        return "Bazaar Knit Repository Format 2"
 
1673
        return "Bazaar Knit Repository Format 2\n"
1686
1674
 
1687
1675
    def get_format_description(self):
1688
1676
        """See RepositoryFormat.get_format_description()."""