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

Fix handling of fallback repositories some more.

Show diffs side-by-side

added added

removed removed

Lines of Context:
917
917
        if isinstance(repository, RemoteRepository):
918
918
            raise AssertionError()
919
919
        self._real_repository = repository
920
 
        if (len(self._real_repository._fallback_repositories) !=
 
920
        # three code paths happen here:
 
921
        # 1) old servers, RemoteBranch.open() calls _ensure_real before setting
 
922
        # up stacking. In this case self._fallback_repositories is [], and the
 
923
        # real repo is already setup. Preserve the real repo and
 
924
        # RemoteRepository.add_fallback_repository will avoid adding
 
925
        # duplicates.
 
926
        # 2) new servers, RemoteBranch.open() sets up stacking, and when
 
927
        # ensure_real is triggered from a branch, the real repository to
 
928
        # set already has a matching list with separate instances, but
 
929
        # as they are also RemoteRepositories we don't worry about making the
 
930
        # lists be identical.
 
931
        # 3) new servers, RemoteRepository.ensure_real is triggered before
 
932
        # RemoteBranch.ensure real, in this case we get a repo with no fallbacks
 
933
        # and need to populate it.
 
934
        if (self._fallback_repositories and
 
935
            len(self._real_repository._fallback_repositories) !=
921
936
            len(self._fallback_repositories)):
922
937
            if len(self._real_repository._fallback_repositories):
923
938
                raise AssertionError(
1056
1071
        # _real_branch had its get_stacked_on_url method called), then the
1057
1072
        # repository to be added may already be in the _real_repositories list.
1058
1073
        if self._real_repository is not None:
1059
 
            if repository not in self._real_repository._fallback_repositories:
 
1074
            fallback_locations = [repo.bzrdir.root_transport.base for repo in
 
1075
                self._real_repository._fallback_repositories]
 
1076
            if repository.bzrdir.root_transport.base not in fallback_locations:
1060
1077
                self._real_repository.add_fallback_repository(repository)
1061
1078
 
1062
1079
    def add_inventory(self, revid, inv, parents):