~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_repository.py

  • Committer: John Arbash Meinel
  • Date: 2006-08-14 16:16:53 UTC
  • mto: (1946.2.6 reduce-knit-churn)
  • mto: This revision was merged to the branch mainline in revision 1919.
  • Revision ID: john@arbash-meinel.com-20060814161653-54cdcdadcd4e9003
Remove bogus entry from BRANCH.TODO

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
from bzrlib.transport import get_transport
39
39
from bzrlib.transport.http import HttpServer
40
40
from bzrlib.transport.memory import MemoryServer
41
 
from bzrlib import upgrade, workingtree
42
41
 
43
42
 
44
43
class TestDefaultFormat(TestCase):
45
44
 
46
45
    def test_get_set_default_format(self):
47
 
        private_default = repository._default_format.__class__
48
46
        old_format = repository.RepositoryFormat.get_default_format()
49
 
        self.assertTrue(isinstance(old_format, private_default))
 
47
        self.assertTrue(isinstance(old_format, repository.RepositoryFormatKnit1))
50
48
        repository.RepositoryFormat.set_default_format(SampleRepositoryFormat())
51
49
        # creating a repository should now create an instrumented dir.
52
50
        try:
74
72
    def initialize(self, a_bzrdir, shared=False):
75
73
        """Initialize a repository in a BzrDir"""
76
74
        t = a_bzrdir.get_repository_transport(self)
77
 
        t.put_bytes('format', self.get_format_string())
 
75
        t.put('format', StringIO(self.get_format_string()))
78
76
        return 'A bzr repository dir'
79
77
 
80
78
    def is_supported(self):
437
435
    def test_unescape_xml(self):
438
436
        """We get some kind of error when malformed entities are passed"""
439
437
        self.assertRaises(KeyError, repository._unescape_xml, 'foo&bar;') 
440
 
 
441
 
 
442
 
class TestRepositoryFormatKnit2(TestCaseWithTransport):
443
 
 
444
 
    def test_convert(self):
445
 
        """Ensure the upgrade adds weaves for roots"""
446
 
        format = bzrdir.BzrDirMetaFormat1()
447
 
        format.repository_format = repository.RepositoryFormatKnit1()
448
 
        tree = self.make_branch_and_tree('.', format)
449
 
        tree.commit("Dull commit", rev_id="dull")
450
 
        revision_tree = tree.branch.repository.revision_tree('dull')
451
 
        self.assertRaises(errors.NoSuchFile, revision_tree.get_file_lines,
452
 
            revision_tree.inventory.root.file_id)
453
 
        format = bzrdir.BzrDirMetaFormat1()
454
 
        format.repository_format = repository.RepositoryFormatKnit2()
455
 
        upgrade.Convert('.', format)
456
 
        tree = workingtree.WorkingTree.open('.')
457
 
        revision_tree = tree.branch.repository.revision_tree('dull')
458
 
        revision_tree.get_file_lines(revision_tree.inventory.root.file_id)
459
 
        tree.commit("Another dull commit", rev_id='dull2')
460
 
        revision_tree = tree.branch.repository.revision_tree('dull2')
461
 
        self.assertEqual('dull', revision_tree.inventory.root.revision)