/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/branch.py

  • Committer: Jelmer Vernooij
  • Date: 2017-06-10 16:40:42 UTC
  • mfrom: (6653.6.7 rename-controldir)
  • mto: This revision was merged to the branch mainline in revision 6690.
  • Revision ID: jelmer@jelmer.uk-20170610164042-zrxqgy2htyduvke2
MergeĀ rename-controldirĀ branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
 
80
80
    @property
81
81
    def user_transport(self):
82
 
        return self.bzrdir.user_transport
 
82
        return self.controldir.user_transport
83
83
 
84
84
    def __init__(self, possible_transports=None):
85
85
        self.tags = self._format.make_tags(self)
830
830
            self._unstack()
831
831
        else:
832
832
            self._activate_fallback_location(url,
833
 
                possible_transports=[self.bzrdir.root_transport])
 
833
                possible_transports=[self.controldir.root_transport])
834
834
        # write this out after the repository is stacked to avoid setting a
835
835
        # stacked config that doesn't work.
836
836
        self._set_config_location('stacked_on_location', url)
863
863
            # separate SSH connection setup, but unstacking is not a
864
864
            # common operation so it's tolerable.
865
865
            new_bzrdir = controldir.ControlDir.open(
866
 
                self.bzrdir.root_transport.base)
 
866
                self.controldir.root_transport.base)
867
867
            new_repository = new_bzrdir.find_repository()
868
868
            if new_repository._fallback_repositories:
869
869
                raise AssertionError("didn't expect %r to have "
1229
1229
            raise errors.InvalidRevisionNumber(revno)
1230
1230
 
1231
1231
    @needs_read_lock
1232
 
    def clone(self, to_bzrdir, revision_id=None, repository_policy=None):
1233
 
        """Clone this branch into to_bzrdir preserving all semantic values.
 
1232
    def clone(self, to_controldir, revision_id=None, repository_policy=None):
 
1233
        """Clone this branch into to_controldir preserving all semantic values.
1234
1234
 
1235
1235
        Most API users will want 'create_clone_on_transport', which creates a
1236
1236
        new bzrdir and branch on the fly.
1238
1238
        revision_id: if not None, the revision history in the new branch will
1239
1239
                     be truncated to end with revision_id.
1240
1240
        """
1241
 
        result = to_bzrdir.create_branch()
 
1241
        result = to_controldir.create_branch()
1242
1242
        result.lock_write()
1243
1243
        try:
1244
1244
            if repository_policy is not None:
1249
1249
        return result
1250
1250
 
1251
1251
    @needs_read_lock
1252
 
    def sprout(self, to_bzrdir, revision_id=None, repository_policy=None,
 
1252
    def sprout(self, to_controldir, revision_id=None, repository_policy=None,
1253
1253
            repository=None):
1254
 
        """Create a new line of development from the branch, into to_bzrdir.
 
1254
        """Create a new line of development from the branch, into to_controldir.
1255
1255
 
1256
 
        to_bzrdir controls the branch format.
 
1256
        to_controldir controls the branch format.
1257
1257
 
1258
1258
        revision_id: if not None, the revision history in the new branch will
1259
1259
                     be truncated to end with revision_id.
1260
1260
        """
1261
1261
        if (repository_policy is not None and
1262
1262
            repository_policy.requires_stacking()):
1263
 
            to_bzrdir._format.require_stacking(_skip_repo=True)
1264
 
        result = to_bzrdir.create_branch(repository=repository)
 
1263
            to_controldir._format.require_stacking(_skip_repo=True)
 
1264
        result = to_controldir.create_branch(repository=repository)
1265
1265
        result.lock_write()
1266
1266
        try:
1267
1267
            if repository_policy is not None:
1269
1269
            self.copy_content_into(result, revision_id=revision_id)
1270
1270
            master_url = self.get_bound_location()
1271
1271
            if master_url is None:
1272
 
                result.set_parent(self.bzrdir.root_transport.base)
 
1272
                result.set_parent(self.controldir.root_transport.base)
1273
1273
            else:
1274
1274
                result.set_parent(master_url)
1275
1275
        finally:
1358
1358
        """Return the most suitable metadir for a checkout of this branch.
1359
1359
        Weaves are used if this branch's repository uses weaves.
1360
1360
        """
1361
 
        format = self.repository.bzrdir.checkout_metadir()
 
1361
        format = self.repository.controldir.checkout_metadir()
1362
1362
        format.set_branch_format(self._format)
1363
1363
        return format
1364
1364
 
1381
1381
        # rather than just the default branch? 20100319 JRV
1382
1382
        if revision_id is None:
1383
1383
            revision_id = self.last_revision()
1384
 
        dir_to = self.bzrdir.clone_on_transport(to_transport,
 
1384
        dir_to = self.controldir.clone_on_transport(to_transport,
1385
1385
            revision_id=revision_id, stacked_on=stacked_on,
1386
1386
            create_prefix=create_prefix, use_existing_dir=use_existing_dir,
1387
1387
            no_tree=no_tree)
1419
1419
                pass
1420
1420
            else:
1421
1421
                raise errors.AlreadyControlDirError(t.base)
1422
 
            if checkout.control_transport.base == self.bzrdir.control_transport.base:
 
1422
            if checkout.control_transport.base == self.controldir.control_transport.base:
1423
1423
                # When checking out to the same control directory,
1424
1424
                # always create a lightweight checkout
1425
1425
                lightweight = True
1467
1467
        :return: A branch associated with the file_id
1468
1468
        """
1469
1469
        # FIXME should provide multiple branches, based on config
1470
 
        return Branch.open(self.bzrdir.root_transport.clone(path).base,
 
1470
        return Branch.open(self.controldir.root_transport.clone(path).base,
1471
1471
                           possible_transports=possible_transports)
1472
1472
 
1473
1473
    def supports_tags(self):
1846
1846
        in branch, which refer to the original branch.
1847
1847
        """
1848
1848
        self.format = format
1849
 
        self.bzrdir = controldir
 
1849
        self.controldir = controldir
1850
1850
        self.name = name
1851
1851
        self.branch = branch
1852
1852