~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/groupcompress_repo.py

  • Committer: Tarmac
  • Author(s): Vincent Ladeuil
  • Date: 2017-01-30 14:42:05 UTC
  • mfrom: (6620.1.1 trunk)
  • Revision ID: tarmac-20170130144205-r8fh2xpmiuxyozpv
Merge  2.7 into trunk including fix for bug #1657238 [r=vila]

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Repository formats using CHK inventories and groupcompress compression."""
18
18
 
 
19
from __future__ import absolute_import
 
20
 
19
21
import time
20
22
 
21
23
from bzrlib import (
22
 
    bzrdir,
 
24
    controldir,
23
25
    chk_map,
24
26
    chk_serializer,
25
27
    debug,
756
758
            expected_chk_roots)
757
759
        missing_chk_roots = expected_chk_roots.difference(present_chk_roots)
758
760
        if missing_chk_roots:
759
 
            problems.append("missing referenced chk root keys: %s"
 
761
            problems.append(
 
762
                "missing referenced chk root keys: %s."
 
763
                "Run 'bzr reconcile --canonicalize-chks' on the affected "
 
764
                "repository."
760
765
                % (sorted(missing_chk_roots),))
761
766
            # Don't bother checking any further.
762
767
            return problems
952
957
            else:
953
958
                basis_tree = self.revision_tree(basis_revision_id)
954
959
                basis_tree.lock_read()
955
 
                basis_inv = basis_tree.inventory
 
960
                basis_inv = basis_tree.root_inventory
956
961
        try:
957
962
            result = basis_inv.create_by_apply_delta(delta, new_revision_id,
958
963
                propagate_caches=propagate_caches)
978
983
            if record.storage_kind != 'absent':
979
984
                texts[record.key] = record.get_bytes_as('fulltext')
980
985
            else:
981
 
                raise errors.NoSuchRevision(self, record.key)
 
986
                texts[record.key] = None
982
987
        for key in keys:
983
 
            yield inventory.CHKInventory.deserialise(self.chk_bytes, texts[key], key)
 
988
            bytes = texts[key]
 
989
            if bytes is None:
 
990
                yield (None, key[-1])
 
991
            else:
 
992
                yield (inventory.CHKInventory.deserialise(
 
993
                    self.chk_bytes, bytes, key), key[-1])
984
994
 
985
 
    def _iter_inventory_xmls(self, revision_ids, ordering):
 
995
    def _get_inventory_xml(self, revision_id):
 
996
        """Get serialized inventory as a string."""
986
997
        # Without a native 'xml' inventory, this method doesn't make sense.
987
998
        # However older working trees, and older bundles want it - so we supply
988
999
        # it allowing _get_inventory_xml to work. Bundles currently use the
989
1000
        # serializer directly; this also isn't ideal, but there isn't an xml
990
 
        # iteration interface offered at all for repositories. We could make
991
 
        # _iter_inventory_xmls be part of the contract, even if kept private.
992
 
        inv_to_str = self._serializer.write_inventory_to_string
993
 
        for inv in self.iter_inventories(revision_ids, ordering=ordering):
994
 
            yield inv_to_str(inv), inv.revision_id
 
1001
        # iteration interface offered at all for repositories.
 
1002
        return self._serializer.write_inventory_to_string(
 
1003
            self.get_inventory(revision_id))
995
1004
 
996
1005
    def _find_present_inventory_keys(self, revision_keys):
997
1006
        parent_map = self.inventories.get_parent_map(revision_keys)
1377
1386
    pack_compresses = True
1378
1387
 
1379
1388
    def _get_matching_bzrdir(self):
1380
 
        return bzrdir.format_registry.make_bzrdir('2a')
 
1389
        return controldir.format_registry.make_bzrdir('2a')
1381
1390
 
1382
1391
    def _ignore_setting_bzrdir(self, format):
1383
1392
        pass
1384
1393
 
1385
1394
    _matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
1386
1395
 
1387
 
    def get_format_string(self):
 
1396
    @classmethod
 
1397
    def get_format_string(cls):
1388
1398
        return ('Bazaar repository format 2a (needs bzr 1.16 or later)\n')
1389
1399
 
1390
1400
    def get_format_description(self):
1399
1409
    """
1400
1410
 
1401
1411
    def _get_matching_bzrdir(self):
1402
 
        return bzrdir.format_registry.make_bzrdir('development-subtree')
 
1412
        return controldir.format_registry.make_bzrdir('development-subtree')
1403
1413
 
1404
1414
    def _ignore_setting_bzrdir(self, format):
1405
1415
        pass
1406
1416
 
1407
1417
    _matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
1408
1418
 
1409
 
    def get_format_string(self):
 
1419
    @classmethod
 
1420
    def get_format_string(cls):
1410
1421
        return ('Bazaar development format 8\n')
1411
1422
 
1412
1423
    def get_format_description(self):