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

  • Committer: Martin Pool
  • Date: 2010-04-21 04:40:18 UTC
  • mto: This revision was merged to the branch mainline in revision 5189.
  • Revision ID: mbp@canonical.com-20100421044018-lbushg9tt7cjcptd
Update some Branch calls to use ControlComponent style.
May give some better error messages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
104
104
        """Activate the branch/repository from url as a fallback repository."""
105
105
        repo = self._get_fallback_repository(url)
106
106
        if repo.has_same_location(self.repository):
107
 
            raise errors.UnstackableLocationError(self.base, url)
 
107
            raise errors.UnstackableLocationError(self.user_url, url)
108
108
        self.repository.add_fallback_repository(repo)
109
109
 
110
110
    def break_lock(self):
591
591
        :param other: The branch to bind to
592
592
        :type other: Branch
593
593
        """
594
 
        raise errors.UpgradeRequired(self.base)
 
594
        raise errors.UpgradeRequired(self.user_url)
595
595
 
596
596
    def set_append_revisions_only(self, enabled):
597
597
        if not self._format.supports_set_append_revisions_only():
598
 
            raise errors.UpgradeRequired(self.base)
 
598
            raise errors.UpgradeRequired(self.user_url)
599
599
        if enabled:
600
600
            value = 'True'
601
601
        else:
621
621
        :param pb: An optional progress bar to use.
622
622
        :return: None
623
623
        """
624
 
        if self.base == from_branch.base:
 
624
        if self.control_url == from_branch.control_url:
625
625
            return (0, [])
626
626
        if pb is not None:
627
627
            symbol_versioning.warn(
649
649
    def get_old_bound_location(self):
650
650
        """Return the URL of the branch we used to be bound to
651
651
        """
652
 
        raise errors.UpgradeRequired(self.base)
 
652
        raise errors.UpgradeRequired(self.user_url)
653
653
 
654
654
    def get_commit_builder(self, parents, config=None, timestamp=None,
655
655
                           timezone=None, committer=None, revprops=None,
733
733
            stacking.
734
734
        """
735
735
        if not self._format.supports_stacking():
736
 
            raise errors.UnstackableBranchFormat(self._format, self.base)
 
736
            raise errors.UnstackableBranchFormat(self._format, self.user_url)
737
737
        # XXX: Changing from one fallback repository to another does not check
738
738
        # that all the data you need is present in the new fallback.
739
739
        # Possibly it should.
780
780
                # stream from one of them to the other.  This does mean doing
781
781
                # separate SSH connection setup, but unstacking is not a
782
782
                # common operation so it's tolerable.
783
 
                new_bzrdir = bzrdir.BzrDir.open(self.bzrdir.root_transport.base)
 
783
                new_bzrdir = bzrdir.BzrDir.open_from_transport(
 
784
                    self.bzrdir.user_transport)
784
785
                new_repository = new_bzrdir.find_repository()
785
786
                self.repository = new_repository
786
787
                if self.repository._fallback_repositories:
890
891
 
891
892
    def unbind(self):
892
893
        """Older format branches cannot bind or unbind."""
893
 
        raise errors.UpgradeRequired(self.base)
 
894
        raise errors.UpgradeRequired(self.user_url)
894
895
 
895
896
    def last_revision(self):
896
897
        """Return last revision id, or NULL_REVISION."""
1056
1057
        try:
1057
1058
            return urlutils.join(self.base[:-1], parent)
1058
1059
        except errors.InvalidURLJoin, e:
1059
 
            raise errors.InaccessibleParent(parent, self.base)
 
1060
            raise errors.InaccessibleParent(parent, self.user_url)
1060
1061
 
1061
1062
    def _get_parent_location(self):
1062
1063
        raise NotImplementedError(self._get_parent_location)
1211
1212
            if repository_policy is not None:
1212
1213
                repository_policy.configure_branch(result)
1213
1214
            self.copy_content_into(result, revision_id=revision_id)
1214
 
            result.set_parent(self.bzrdir.root_transport.base)
 
1215
            result.set_parent(self.bzrdir.user_url)
1215
1216
        finally:
1216
1217
            result.unlock()
1217
1218
        return result
1404
1405
        :return: A branch associated with the file_id
1405
1406
        """
1406
1407
        # FIXME should provide multiple branches, based on config
1407
 
        return Branch.open(self.bzrdir.root_transport.clone(path).base,
1408
 
                           possible_transports=possible_transports)
 
1408
        return Branch.open_from_transport(
 
1409
            self.bzrdir.root_transport.clone(path),
 
1410
            possible_transports=possible_transports)
1409
1411
 
1410
1412
    def supports_tags(self):
1411
1413
        return self._format.supports_tags()
1553
1555
            elsewhere)
1554
1556
        :return: a branch in this format
1555
1557
        """
1556
 
        mutter('creating branch %r in %s', self, a_bzrdir.transport.base)
 
1558
        mutter('creating branch %r in %s', self, a_bzrdir.user_url)
1557
1559
        branch_transport = a_bzrdir.get_branch_transport(self, name=name)
1558
1560
        lock_map = {
1559
1561
            'metadir': ('lock', lockdir.LockDir),
1856
1858
            if format.__class__ != self.__class__:
1857
1859
                raise AssertionError("wrong format %r found for %r" %
1858
1860
                    (format, self))
 
1861
        transport = a_bzrdir.get_branch_transport(None, name=name)
1859
1862
        try:
1860
 
            transport = a_bzrdir.get_branch_transport(None, name=name)
1861
1863
            control_files = lockable_files.LockableFiles(transport, 'lock',
1862
1864
                                                         lockdir.LockDir)
1863
1865
            return self._branch_class()(_format=self,
2061
2063
            # this format does not implement branch itself, thus the implicit
2062
2064
            # creation contract must see it as uninitializable
2063
2065
            raise errors.UninitializableFormat(self)
2064
 
        mutter('creating branch reference in %s', a_bzrdir.transport.base)
 
2066
        mutter('creating branch reference in %s', a_bzrdir.user_url)
2065
2067
        branch_transport = a_bzrdir.get_branch_transport(self, name=name)
2066
2068
        branch_transport.put_bytes('location',
2067
 
            target_branch.bzrdir.root_transport.base)
 
2069
            target_branch.bzrdir.user_url)
2068
2070
        branch_transport.put_bytes('format', self.get_format_string())
2069
2071
        return self.open(
2070
2072
            a_bzrdir, name, _found=True,
2190
2192
 
2191
2193
    def __str__(self):
2192
2194
        if self.name is None:
2193
 
            return '%s(%r)' % (self.__class__.__name__, self.base)
 
2195
            return '%s(%s)' % (self.__class__.__name__, self.user_url)
2194
2196
        else:
2195
 
            return '%s(%r,%r)' % (self.__class__.__name__, self.base, self.name)
 
2197
            return '%s(%s,%s)' % (self.__class__.__name__, self.user_url,
 
2198
                self.name)
2196
2199
 
2197
2200
    __repr__ = __str__
2198
2201
 
2413
2416
        return result
2414
2417
 
2415
2418
    def get_stacked_on_url(self):
2416
 
        raise errors.UnstackableBranchFormat(self._format, self.base)
 
2419
        raise errors.UnstackableBranchFormat(self._format, self.user_url)
2417
2420
 
2418
2421
    def set_push_location(self, location):
2419
2422
        """See Branch.set_push_location."""
2609
2612
        if _mod_revision.is_null(last_revision):
2610
2613
            return
2611
2614
        if last_revision not in self._lefthand_history(revision_id):
2612
 
            raise errors.AppendRevisionsOnlyViolation(self.base)
 
2615
            raise errors.AppendRevisionsOnlyViolation(self.user_url)
2613
2616
 
2614
2617
    def _gen_revision_history(self):
2615
2618
        """Generate the revision history from last revision
2715
2718
        if branch_location is None:
2716
2719
            return Branch.reference_parent(self, file_id, path,
2717
2720
                                           possible_transports)
2718
 
        branch_location = urlutils.join(self.base, branch_location)
 
2721
        branch_location = urlutils.join(self.user_url, branch_location)
2719
2722
        return Branch.open(branch_location,
2720
2723
                           possible_transports=possible_transports)
2721
2724
 
2836
2839
    """
2837
2840
 
2838
2841
    def get_stacked_on_url(self):
2839
 
        raise errors.UnstackableBranchFormat(self._format, self.base)
 
2842
        raise errors.UnstackableBranchFormat(self._format, self.user_url)
2840
2843
 
2841
2844
 
2842
2845
######################################################################
2929
2932
        :param verbose: Requests more detailed display of what was checked,
2930
2933
            if any.
2931
2934
        """
2932
 
        note('checked branch %s format %s', self.branch.base,
 
2935
        note('checked branch %s format %s', self.branch.user_url,
2933
2936
            self.branch._format)
2934
2937
        for error in self.errors:
2935
2938
            note('found error:%s', error)