/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 breezy/bzr/bzrdir.py

  • Committer: Breezy landing bot
  • Author(s): Gustav Hartvigsson
  • Date: 2021-01-10 18:46:30 UTC
  • mfrom: (7526.1.1 brz-removed-api-doc)
  • mto: This revision was merged to the branch mainline in revision 7532.
  • Revision ID: breezy.the.bot@gmail.com-20210110184630-dxu0g9dqq020uiw6
Drop documentation for removed API API.

Merged from https://code.launchpad.net/~gustav-hartvigsson/brz/removed-api-doc/+merge/396033

Show diffs side-by-side

added added

removed removed

Lines of Context:
141
141
 
142
142
    def clone_on_transport(self, transport, revision_id=None,
143
143
                           force_new_repo=False, preserve_stacking=False, stacked_on=None,
144
 
                           create_prefix=False, use_existing_dir=True, no_tree=False):
 
144
                           create_prefix=False, use_existing_dir=True, no_tree=False,
 
145
                           tag_selector=None):
145
146
        """Clone this bzrdir and its contents to transport verbatim.
146
147
 
147
148
        :param transport: The transport for the location to produce the clone
171
172
            local_repo = self.find_repository()
172
173
        except errors.NoRepositoryPresent:
173
174
            local_repo = None
 
175
        local_branches = self.get_branches()
174
176
        try:
175
 
            local_branch = self.open_branch()
176
 
        except errors.NotBranchError:
177
 
            local_branch = None
 
177
            local_active_branch = local_branches['']
 
178
        except KeyError:
 
179
            pass
178
180
        else:
179
181
            # enable fallbacks when branch is not a branch reference
180
 
            if local_branch.repository.has_same_location(local_repo):
181
 
                local_repo = local_branch.repository
 
182
            if local_active_branch.repository.has_same_location(local_repo):
 
183
                local_repo = local_active_branch.repository
182
184
            if preserve_stacking:
183
185
                try:
184
 
                    stacked_on = local_branch.get_stacked_on_url()
 
186
                    stacked_on = local_active_branch.get_stacked_on_url()
185
187
                except (_mod_branch.UnstackableBranchFormat,
186
188
                        errors.UnstackableRepositoryFormat,
187
189
                        errors.NotStacked):
230
232
        # 1 if there is a branch present
231
233
        #   make sure its content is available in the target repository
232
234
        #   clone it.
233
 
        if local_branch is not None:
 
235
        for name, local_branch in local_branches.items():
234
236
            local_branch.clone(
235
 
                result, revision_id=revision_id,
236
 
                repository_policy=repository_policy)
 
237
                result, revision_id=(None if name != '' else revision_id),
 
238
                repository_policy=repository_policy,
 
239
                name=name, tag_selector=tag_selector)
237
240
        try:
238
241
            # Cheaper to check if the target is not local, than to try making
239
242
            # the tree and fail.
427
430
                # actually useful?
428
431
                # Not especially, but it's part of the contract.
429
432
                result_branch = result.create_branch()
 
433
                if revision_id is not None:
 
434
                    result_branch.generate_revision_history(revision_id)
430
435
            else:
431
436
                result_branch = source_branch.sprout(
432
437
                    result, revision_id=revision_id,
1012
1017
            pass
1013
1018
        return self.transport.clone('checkout')
1014
1019
 
 
1020
    def branch_names(self):
 
1021
        """See ControlDir.branch_names."""
 
1022
        ret = []
 
1023
        try:
 
1024
            self.get_branch_reference()
 
1025
        except errors.NotBranchError:
 
1026
            pass
 
1027
        else:
 
1028
            ret.append("")
 
1029
        ret.extend(self._read_branch_list())
 
1030
        return ret
 
1031
 
1015
1032
    def get_branches(self):
1016
1033
        """See ControlDir.get_branches."""
1017
1034
        ret = {}
1310
1327
                remote_dir_format = RemoteBzrDirFormat()
1311
1328
                remote_dir_format._network_name = self.network_name()
1312
1329
                self._supply_sub_formats_to(remote_dir_format)
1313
 
                return remote_dir_format.initialize_on_transport_ex(transport,
1314
 
                                                                    use_existing_dir=use_existing_dir, create_prefix=create_prefix,
1315
 
                                                                    force_new_repo=force_new_repo, stacked_on=stacked_on,
1316
 
                                                                    stack_on_pwd=stack_on_pwd, repo_format_name=repo_format_name,
1317
 
                                                                    make_working_trees=make_working_trees, shared_repo=shared_repo)
 
1330
                return remote_dir_format.initialize_on_transport_ex(
 
1331
                    transport, use_existing_dir=use_existing_dir,
 
1332
                    create_prefix=create_prefix, force_new_repo=force_new_repo,
 
1333
                    stacked_on=stacked_on, stack_on_pwd=stack_on_pwd,
 
1334
                    repo_format_name=repo_format_name,
 
1335
                    make_working_trees=make_working_trees,
 
1336
                    shared_repo=shared_repo)
1318
1337
        # XXX: Refactor the create_prefix/no_create_prefix code into a
1319
1338
        #      common helper function
1320
1339
        # The destination may not exist - if so make it according to policy.
1474
1493
        # implementation, please add new tests for it to the appropriate place.
1475
1494
        return filename == '.bzr' or filename.startswith('.bzr/')
1476
1495
 
 
1496
    @classmethod
 
1497
    def get_default_format(klass):
 
1498
        """Return the current default format."""
 
1499
        return controldir.format_registry.get('bzr')()
 
1500
 
1477
1501
 
1478
1502
class BzrDirMetaFormat1(BzrDirFormat):
1479
1503
    """Bzr meta control format 1