460
461
_unsupported is a private parameter to the BzrDir class.
462
463
t = get_transport(base)
463
mutter("trying to open %r with transport %r", base, t)
464
# mutter("trying to open %r with transport %r", base, t)
464
465
format = BzrDirFormat.find_format(t)
465
466
BzrDir._check_supported(format, _unsupported)
466
467
return format.open(t, _found=True)
615
616
# XXX FIXME RBC 20060214 need tests for this when the basis
617
618
result_repo.fetch(basis_repo, revision_id=revision_id)
618
result_repo.fetch(source_repository, revision_id=revision_id)
619
if source_repository is not None:
620
result_repo.fetch(source_repository, revision_id=revision_id)
619
621
if source_branch is not None:
620
622
source_branch.sprout(result, revision_id=revision_id)
685
687
# done on this format anyway. So - acceptable wart.
686
688
result = self.open_workingtree()
687
689
if revision_id is not None:
688
result.set_last_revision(revision_id)
690
if revision_id == bzrlib.revision.NULL_REVISION:
691
result.set_parent_ids([])
693
result.set_parent_ids([revision_id])
691
696
def get_branch_transport(self, branch_format):
733
738
self._check_supported(format, unsupported)
734
739
return format.open(self, _found=True)
736
def sprout(self, url, revision_id=None, basis=None):
741
def sprout(self, url, revision_id=None, basis=None, force_new_repo=False):
737
742
"""See BzrDir.sprout()."""
738
743
from bzrlib.workingtree import WorkingTreeFormat2
739
744
self._make_tail(url)
1217
1222
result = (super(BzrDirFormat5, self).initialize_on_transport(transport))
1218
1223
RepositoryFormat5().initialize(result, _internal=True)
1219
1224
if not _cloning:
1220
BzrBranchFormat4().initialize(result)
1221
WorkingTreeFormat2().initialize(result)
1225
branch = BzrBranchFormat4().initialize(result)
1227
WorkingTreeFormat2().initialize(result)
1228
except errors.NotLocalUrl:
1229
# Even though we can't access the working tree, we need to
1230
# create its control files.
1231
WorkingTreeFormat2().stub_initialize_remote(branch.control_files)
1224
1234
def _open(self, transport):
1271
1281
result = super(BzrDirFormat6, self).initialize_on_transport(transport)
1272
1282
RepositoryFormat6().initialize(result, _internal=True)
1273
1283
if not _cloning:
1274
BzrBranchFormat4().initialize(result)
1284
branch = BzrBranchFormat4().initialize(result)
1276
1286
WorkingTreeFormat2().initialize(result)
1277
1287
except errors.NotLocalUrl:
1278
# emulate pre-check behaviour for working tree and silently
1288
# Even though we can't access the working tree, we need to
1289
# create its control files.
1290
WorkingTreeFormat2().stub_initialize_remote(branch.control_files)
1283
1293
def _open(self, transport):
1743
1753
for entry in branch_files:
1744
1754
self.move_entry('branch', entry)
1746
self.step('Upgrading working tree')
1747
self.bzrdir.transport.mkdir('checkout', mode=self.dir_mode)
1748
self.make_lock('checkout')
1749
self.put_format('checkout', bzrlib.workingtree.WorkingTreeFormat3())
1750
self.bzrdir.transport.delete_multi(self.garbage_inventories, self.pb)
1751
1756
checkout_files = [('pending-merges', True),
1752
1757
('inventory', True),
1753
1758
('stat-cache', False)]
1754
for entry in checkout_files:
1755
self.move_entry('checkout', entry)
1756
if last_revision is not None:
1757
self.bzrdir._control_files.put_utf8('checkout/last-revision',
1759
self.bzrdir._control_files.put_utf8('branch-format', BzrDirMetaFormat1().get_format_string())
1759
# If a mandatory checkout file is not present, the branch does not have
1760
# a functional checkout. Do not create a checkout in the converted
1762
for name, mandatory in checkout_files:
1763
if mandatory and name not in bzrcontents:
1764
has_checkout = False
1768
if not has_checkout:
1769
self.pb.note('No working tree.')
1770
# If some checkout files are there, we may as well get rid of them.
1771
for name, mandatory in checkout_files:
1772
if name in bzrcontents:
1773
self.bzrdir.transport.delete(name)
1775
self.step('Upgrading working tree')
1776
self.bzrdir.transport.mkdir('checkout', mode=self.dir_mode)
1777
self.make_lock('checkout')
1779
'checkout', bzrlib.workingtree.WorkingTreeFormat3())
1780
self.bzrdir.transport.delete_multi(
1781
self.garbage_inventories, self.pb)
1782
for entry in checkout_files:
1783
self.move_entry('checkout', entry)
1784
if last_revision is not None:
1785
self.bzrdir._control_files.put_utf8(
1786
'checkout/last-revision', last_revision)
1787
self.bzrdir._control_files.put_utf8(
1788
'branch-format', BzrDirMetaFormat1().get_format_string())
1760
1789
return BzrDir.open(self.bzrdir.root_transport.base)
1762
1791
def make_lock(self, name):