370
370
if revision_id is not None:
371
371
fetch_spec_factory.add_revision_ids([revision_id])
372
372
fetch_spec_factory.source_branch_stop_revision_id = revision_id
373
if possible_transports is None:
374
possible_transports = []
376
possible_transports = list(possible_transports) + [
373
378
target_transport = _mod_transport.get_transport(url,
374
379
possible_transports)
375
380
target_transport.ensure_base()
390
395
stacked_branch_url = None
391
396
repository_policy = result.determine_repository_policy(
392
397
force_new_repo, stacked_branch_url, require_stacking=stacked)
393
result_repo, is_new_repo = repository_policy.acquire_repository()
398
result_repo, is_new_repo = repository_policy.acquire_repository(
399
possible_transports=possible_transports)
394
400
add_cleanup(result_repo.lock_write().unlock)
395
401
fetch_spec_factory.source_repo = source_repository
396
402
fetch_spec_factory.target_repo = result_repo
949
955
def open_branch(self, name=None, unsupported=False,
950
ignore_fallbacks=False):
951
"""See BzrDir.open_branch."""
956
ignore_fallbacks=False, possible_transports=None):
957
"""See ControlDir.open_branch."""
953
959
name = self._get_selected_branch()
954
960
format = self.find_branch_format(name=name)
955
961
format.check_support_status(unsupported)
956
962
return format.open(self, name=name,
957
_found=True, ignore_fallbacks=ignore_fallbacks)
963
_found=True, ignore_fallbacks=ignore_fallbacks,
964
possible_transports=possible_transports)
959
966
def open_repository(self, unsupported=False):
960
967
"""See BzrDir.open_repository."""
1846
1853
self._require_stacking = True
1848
def acquire_repository(self, make_working_trees=None, shared=False):
1855
def acquire_repository(self, make_working_trees=None, shared=False,
1856
possible_transports=None):
1849
1857
"""Acquire a repository for this bzrdir.
1851
1859
Implementations may create a new repository or use a pre-exising
1876
1884
require_stacking)
1877
1885
self._bzrdir = bzrdir
1879
def acquire_repository(self, make_working_trees=None, shared=False):
1887
def acquire_repository(self, make_working_trees=None, shared=False,
1888
possible_transports=None):
1880
1889
"""Implementation of RepositoryAcquisitionPolicy.acquire_repository
1882
1891
Creates the desired repository in the bzrdir we already have.
1893
if possible_transports is None:
1894
possible_transports = []
1896
possible_transports = list(possible_transports)
1897
possible_transports.append(self._bzrdir.root_transport)
1884
1898
stack_on = self._get_full_stack_on()
1886
1900
format = self._bzrdir._format
1887
1901
format.require_stacking(stack_on=stack_on,
1888
possible_transports=[self._bzrdir.root_transport])
1902
possible_transports=possible_transports)
1889
1903
if not self._require_stacking:
1890
1904
# We have picked up automatic stacking somewhere.
1891
1905
note(gettext('Using default stacking branch {0} at {1}').format(
1892
1906
self._stack_on, self._stack_on_pwd))
1893
1907
repository = self._bzrdir.create_repository(shared=shared)
1894
1908
self._add_fallback(repository,
1895
possible_transports=[self._bzrdir.transport])
1909
possible_transports=possible_transports)
1896
1910
if make_working_trees is not None:
1897
1911
repository.set_make_working_trees(make_working_trees)
1898
1912
return repository, True
1914
1928
require_stacking)
1915
1929
self._repository = repository
1917
def acquire_repository(self, make_working_trees=None, shared=False):
1931
def acquire_repository(self, make_working_trees=None, shared=False,
1932
possible_transports=None):
1918
1933
"""Implementation of RepositoryAcquisitionPolicy.acquire_repository
1920
1935
Returns an existing repository to use.
1937
if possible_transports is None:
1938
possible_transports = []
1940
possible_transports = list(possible_transports)
1941
possible_transports.append(self._repository.bzrdir.transport)
1922
1942
self._add_fallback(self._repository,
1923
possible_transports=[self._repository.bzrdir.transport])
1943
possible_transports=possible_transports)
1924
1944
return self._repository, False