686
687
# done on this format anyway. So - acceptable wart.
687
688
result = self.open_workingtree()
688
689
if revision_id is not None:
689
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])
692
696
def get_branch_transport(self, branch_format):
1749
1753
for entry in branch_files:
1750
1754
self.move_entry('branch', entry)
1752
self.step('Upgrading working tree')
1753
self.bzrdir.transport.mkdir('checkout', mode=self.dir_mode)
1754
self.make_lock('checkout')
1755
self.put_format('checkout', bzrlib.workingtree.WorkingTreeFormat3())
1756
self.bzrdir.transport.delete_multi(self.garbage_inventories, self.pb)
1757
1756
checkout_files = [('pending-merges', True),
1758
1757
('inventory', True),
1759
1758
('stat-cache', False)]
1760
for entry in checkout_files:
1761
self.move_entry('checkout', entry)
1762
if last_revision is not None:
1763
self.bzrdir._control_files.put_utf8('checkout/last-revision',
1765
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())
1766
1789
return BzrDir.open(self.bzrdir.root_transport.base)
1768
1791
def make_lock(self, name):