~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-01-09 05:29:09 UTC
  • mfrom: (3928.3.4 stacking_tweaks)
  • Revision ID: pqm@pqm.ubuntu.com-20090109052909-3jh4taiu906vin4p
(jam) Some fixes to stacked branches to avoid opening multiple
        connections.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2902
2902
        else:
2903
2903
            return urlutils.join(self._stack_on_pwd, self._stack_on)
2904
2904
 
2905
 
    def _add_fallback(self, repository):
 
2905
    def _add_fallback(self, repository, possible_transports=None):
2906
2906
        """Add a fallback to the supplied repository, if stacking is set."""
2907
2907
        stack_on = self._get_full_stack_on()
2908
2908
        if stack_on is None:
2909
2909
            return
2910
 
        stacked_dir = BzrDir.open(stack_on)
 
2910
        stacked_dir = BzrDir.open(stack_on,
 
2911
                                  possible_transports=possible_transports)
2911
2912
        try:
2912
2913
            stacked_repo = stacked_dir.open_branch().repository
2913
2914
        except errors.NotBranchError:
2955
2956
        Creates the desired repository in the bzrdir we already have.
2956
2957
        """
2957
2958
        repository = self._bzrdir.create_repository(shared=shared)
2958
 
        self._add_fallback(repository)
 
2959
        self._add_fallback(repository,
 
2960
                           possible_transports=[self._bzrdir.transport])
2959
2961
        if make_working_trees is not None:
2960
2962
            repository.set_make_working_trees(make_working_trees)
2961
2963
        return repository
2982
2984
 
2983
2985
        Returns an existing repository to use
2984
2986
        """
2985
 
        self._add_fallback(self._repository)
 
2987
        self._add_fallback(self._repository,
 
2988
                       possible_transports=[self._repository.bzrdir.transport])
2986
2989
        return self._repository
2987
2990
 
2988
2991