/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test_treebuilder.py

  • Committer: Gustav Hartvigsson
  • Date: 2021-01-09 21:36:27 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210109213627-h1xwcutzy9m7a99b
Added 'Case Preserving Working Tree Use Cases' from Canonical Wiki

* Addod a page from the Canonical Bazaar wiki
  with information on the scmeatics of case
  perserving filesystems an a case insensitive
  filesystem works.
  
  * Needs re-work, but this will do as it is the
    same inforamoton as what was on the linked
    page in the currint documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""Tests for the TreeBuilder helper class."""
19
19
 
20
 
from bzrlib import errors, tests
21
 
from bzrlib.memorytree import MemoryTree
22
 
from bzrlib.tests import TestCaseWithTransport
23
 
from bzrlib.treebuilder import TreeBuilder
 
20
from breezy import tests
 
21
from breezy.memorytree import MemoryTree
 
22
from breezy.tests import TestCaseWithTransport
 
23
from breezy.treebuilder import (
 
24
    AlreadyBuilding,
 
25
    NotBuilding,
 
26
    TreeBuilder,
 
27
    )
24
28
 
25
29
 
26
30
class FakeTree(object):
51
55
class TestTreeBuilderMemoryTree(tests.TestCaseWithMemoryTransport):
52
56
 
53
57
    def test_create(self):
54
 
        builder = TreeBuilder()
 
58
        TreeBuilder()
55
59
 
56
60
    def test_start_tree_locks_write(self):
57
61
        builder = TreeBuilder()
63
67
        builder = TreeBuilder()
64
68
        tree = FakeTree()
65
69
        builder.start_tree(tree)
66
 
        self.assertRaises(errors.AlreadyBuilding, builder.start_tree, tree)
 
70
        self.assertRaises(AlreadyBuilding, builder.start_tree, tree)
67
71
 
68
72
    def test_finish_tree_not_started_errors(self):
69
73
        builder = TreeBuilder()
70
 
        self.assertRaises(errors.NotBuilding, builder.finish_tree)
 
74
        self.assertRaises(NotBuilding, builder.finish_tree)
71
75
 
72
76
    def test_finish_tree_unlocks(self):
73
77
        builder = TreeBuilder()
78
82
 
79
83
    def test_build_tree_not_started_errors(self):
80
84
        builder = TreeBuilder()
81
 
        self.assertRaises(errors.NotBuilding, builder.build, "foo")
 
85
        self.assertRaises(NotBuilding, builder.build, "foo")
82
86
 
83
87
    def test_build_tree(self):
84
88
        """Test building works using a MemoryTree."""
87
91
        builder = TreeBuilder()
88
92
        builder.start_tree(tree)
89
93
        builder.build(['foo', "bar/", "bar/file"])
90
 
        self.assertEqual('contents of foo\n',
91
 
            tree.get_file(tree.path2id('foo')).read())
92
 
        self.assertEqual('contents of bar/file\n',
93
 
            tree.get_file(tree.path2id('bar/file')).read())
 
94
        self.assertEqual(
 
95
            b'contents of foo\n',
 
96
            tree.get_file('foo').read())
 
97
        self.assertEqual(
 
98
            b'contents of bar/file\n',
 
99
            tree.get_file('bar/file').read())
94
100
        builder.finish_tree()
95