~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

Merge bzr.dev (and fix NEWS)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1749
1749
        for entry in branch_files:
1750
1750
            self.move_entry('branch', entry)
1751
1751
 
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
1752
        checkout_files = [('pending-merges', True),
1758
1753
                          ('inventory', True),
1759
1754
                          ('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',
1764
 
                                                last_revision)
1765
 
        self.bzrdir._control_files.put_utf8('branch-format', BzrDirMetaFormat1().get_format_string())
 
1755
        # If a mandatory checkout file is not present, the branch does not have
 
1756
        # a functional checkout. Do not create a checkout in the converted
 
1757
        # branch.
 
1758
        for name, mandatory in checkout_files:
 
1759
            if mandatory and name not in bzrcontents:
 
1760
                has_checkout = False
 
1761
                break
 
1762
        else:
 
1763
            has_checkout = True
 
1764
        if not has_checkout:
 
1765
            self.pb.note('No working tree.')
 
1766
            # If some checkout files are there, we may as well get rid of them.
 
1767
            for name, mandatory in checkout_files:
 
1768
                if name in bzrcontents:
 
1769
                    self.bzrdir.transport.delete(name)
 
1770
        else:
 
1771
            self.step('Upgrading working tree')
 
1772
            self.bzrdir.transport.mkdir('checkout', mode=self.dir_mode)
 
1773
            self.make_lock('checkout')
 
1774
            self.put_format(
 
1775
                'checkout', bzrlib.workingtree.WorkingTreeFormat3())
 
1776
            self.bzrdir.transport.delete_multi(
 
1777
                self.garbage_inventories, self.pb)
 
1778
            for entry in checkout_files:
 
1779
                self.move_entry('checkout', entry)
 
1780
            if last_revision is not None:
 
1781
                self.bzrdir._control_files.put_utf8(
 
1782
                    'checkout/last-revision', last_revision)
 
1783
        self.bzrdir._control_files.put_utf8(
 
1784
            'branch-format', BzrDirMetaFormat1().get_format_string())
1766
1785
        return BzrDir.open(self.bzrdir.root_transport.base)
1767
1786
 
1768
1787
    def make_lock(self, name):