~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Robey Pointer
  • Date: 2006-09-03 00:28:18 UTC
  • mfrom: (1981 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1996.
  • Revision ID: robey@lag.net-20060903002818-71ca5c7bfea93a26
merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
                            sha_strings,
40
40
                            sha_string,
41
41
                            )
 
42
import bzrlib.revision
42
43
from bzrlib.store.revision.text import TextRevisionStore
43
44
from bzrlib.store.text import TextStore
44
45
from bzrlib.store.versioned import WeaveStore
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([])
 
692
            else:
 
693
                result.set_parent_ids([revision_id])
690
694
        return result
691
695
 
692
696
    def get_branch_transport(self, branch_format):
1749
1753
        for entry in branch_files:
1750
1754
            self.move_entry('branch', entry)
1751
1755
 
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',
1764
 
                                                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
 
1761
        # branch.
 
1762
        for name, mandatory in checkout_files:
 
1763
            if mandatory and name not in bzrcontents:
 
1764
                has_checkout = False
 
1765
                break
 
1766
        else:
 
1767
            has_checkout = True
 
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)
 
1774
        else:
 
1775
            self.step('Upgrading working tree')
 
1776
            self.bzrdir.transport.mkdir('checkout', mode=self.dir_mode)
 
1777
            self.make_lock('checkout')
 
1778
            self.put_format(
 
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)
1767
1790
 
1768
1791
    def make_lock(self, name):