~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_upgrade.py

Merge integration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
This file contains canned versions of some old trees, which are instantiated 
20
20
and then upgraded to the new format."""
21
21
 
 
22
# TODO queue for upgrade:
 
23
# test the error message when upgrading an unknown BzrDir format.
 
24
 
22
25
import base64
23
26
import os
24
27
import sys
25
28
 
26
 
import bzrlib.branch as branch
 
29
import bzrlib.branch
27
30
from bzrlib.branch import Branch
 
31
import bzrlib.bzrdir as bzrdir
 
32
import bzrlib.repository as repository
28
33
from bzrlib.revision import is_ancestor
29
34
from bzrlib.tests import TestCase, TestCaseInTempDir
30
35
from bzrlib.transport import get_transport
31
36
from bzrlib.upgrade import upgrade
 
37
import bzrlib.workingtree as workingtree
32
38
 
33
39
 
34
40
class TestUpgrade(TestCaseInTempDir):
44
50
        eq = self.assertEquals
45
51
        self.build_tree_contents(_upgrade1_template)
46
52
        upgrade(u'.')
47
 
        b = Branch.open(u'.')
 
53
        control = bzrdir.BzrDir.open('.')
 
54
        b = control.open_branch()
 
55
        r = control.open_repository()
 
56
        t = control.open_workingtree()
48
57
        # tsk, peeking under the covers.
49
 
        self.failUnless(isinstance(b._branch_format, branch.BzrBranchFormat6))
 
58
        self.failUnless(isinstance(control._format, bzrdir.BzrDirFormat6))
 
59
        self.failUnless(isinstance(b._format, bzrlib.branch.BzrBranchFormat4))
 
60
        self.failUnless(isinstance(r._format, repository.RepositoryFormat6))
 
61
        self.failUnless(isinstance(t._format, workingtree.WorkingTreeFormat2))
50
62
        rh = b.revision_history()
51
63
        eq(rh,
52
64
           ['mbp@sourcefrog.net-20051004035611-176b16534b086b3c',
53
65
            'mbp@sourcefrog.net-20051004035756-235f2b7dcdddd8dd'])
54
 
        t = b.repository.revision_tree(rh[0])
 
66
        rt = b.repository.revision_tree(rh[0])
55
67
        foo_id = 'foo-20051004035605-91e788d1875603ae'
56
 
        eq(t.get_file_text(foo_id), 'initial contents\n')
57
 
        t = b.repository.revision_tree(rh[1])
58
 
        eq(t.get_file_text(foo_id), 'new contents\n')
 
68
        eq(rt.get_file_text(foo_id), 'initial contents\n')
 
69
        rt = b.repository.revision_tree(rh[1])
 
70
        eq(rt.get_file_text(foo_id), 'new contents\n')
59
71
        # check a backup was made:
60
72
        transport = get_transport(b.base)
61
73
        transport.stat('.bzr.backup')