/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
93
93
        """Return true if this bzrdir is one whose format we can convert from."""
94
94
        return True
95
95
 
 
96
    def check_conversion_target(self, target_format):
 
97
        target_repo_format = target_format.repository_format
 
98
        source_repo_format = self._format.repository_format
 
99
        source_repo_format.check_conversion_target(target_repo_format)
 
100
 
96
101
    @staticmethod
97
102
    def _check_supported(format, allow_unsupported):
98
103
        """Check whether format is a supported format.
570
575
        except errors.NoWorkingTree:
571
576
            return False
572
577
 
 
578
    def cloning_metadir(self, basis=None):
 
579
        """Produce a metadir suitable for cloning with"""
 
580
        def related_repository(bzrdir):
 
581
            try:
 
582
                branch = bzrdir.open_branch()
 
583
                return branch.repository
 
584
            except errors.NotBranchError:
 
585
                source_branch = None
 
586
                return bzrdir.open_repository()
 
587
        result_format = self._format.__class__()
 
588
        try:
 
589
            try:
 
590
                source_repository = related_repository(self)
 
591
            except errors.NoRepositoryPresent:
 
592
                if basis is None:
 
593
                    raise
 
594
                source_repository = related_repository(self)
 
595
            result_format.repository_format = source_repository._format
 
596
        except errors.NoRepositoryPresent:
 
597
            pass
 
598
        return result_format
 
599
 
573
600
    def sprout(self, url, revision_id=None, basis=None, force_new_repo=False):
574
601
        """Create a copy of this bzrdir prepared for use as a new line of
575
602
        development.
585
612
            itself to download less data.
586
613
        """
587
614
        self._make_tail(url)
588
 
        result = self._format.initialize(url)
 
615
        cloning_format = self.cloning_metadir(basis)
 
616
        result = cloning_format.initialize(url)
589
617
        basis_repo, basis_branch, basis_tree = self._get_basis_components(basis)
590
618
        try:
591
619
            source_branch = self.open_branch()
1063
1091
        """
1064
1092
        return True
1065
1093
 
 
1094
    def same_model(self, target_format):
 
1095
        return (self.repository_format.rich_root_data == 
 
1096
            target_format.rich_root_data)
 
1097
 
1066
1098
    @classmethod
1067
1099
    def known_formats(klass):
1068
1100
        """Return all the known formats.
1184
1216
    def __return_repository_format(self):
1185
1217
        """Circular import protection."""
1186
1218
        from bzrlib.repository import RepositoryFormat4
1187
 
        return RepositoryFormat4(self)
 
1219
        return RepositoryFormat4()
1188
1220
    repository_format = property(__return_repository_format)
1189
1221
 
1190
1222
 
1244
1276
    def __return_repository_format(self):
1245
1277
        """Circular import protection."""
1246
1278
        from bzrlib.repository import RepositoryFormat5
1247
 
        return RepositoryFormat5(self)
 
1279
        return RepositoryFormat5()
1248
1280
    repository_format = property(__return_repository_format)
1249
1281
 
1250
1282
 
1303
1335
    def __return_repository_format(self):
1304
1336
        """Circular import protection."""
1305
1337
        from bzrlib.repository import RepositoryFormat6
1306
 
        return RepositoryFormat6(self)
 
1338
        return RepositoryFormat6()
1307
1339
    repository_format = property(__return_repository_format)
1308
1340
 
1309
1341
 
1548
1580
        assert rev_id not in self.converted_revs
1549
1581
        old_inv_xml = self.branch.repository.inventory_store.get(rev_id).read()
1550
1582
        inv = serializer_v4.read_inventory_from_string(old_inv_xml)
 
1583
        inv.revision_id = rev_id
1551
1584
        rev = self.revisions[rev_id]
1552
1585
        if rev.inventory_sha1:
1553
1586
            assert rev.inventory_sha1 == sha_string(old_inv_xml), \