74
74
self.assertIsDirectory('.bzr/branch/lock/held', t)
77
class TestBranchEscaping(TestCaseWithTransport):
78
"""Test a branch can be correctly stored and used on a vfat-like transport
80
Makes sure we have proper escaping of invalid characters, etc.
82
It'd be better to test all operations on the FakeVFATTransportDecorator,
83
but working trees go straight to the os not through the Transport layer.
84
Therefore we build some history first in the regular way and then
85
check it's safe to access for vfat.
92
super(TestBranchEscaping, self).setUp()
93
from bzrlib.repository import RepositoryFormatKnit1
94
bzrdir = BzrDirMetaFormat1().initialize(self.get_url())
95
repo = RepositoryFormatKnit1().initialize(bzrdir)
96
branch = bzrdir.create_branch()
97
wt = bzrdir.create_workingtree()
98
self.build_tree_contents([("foo", "contents of foo")])
99
# add file with id containing wierd characters
100
wt.add(['foo'], [self.FOO_ID])
101
wt.commit('this is my new commit', rev_id=self.REV_ID)
103
def test_branch_on_vfat(self):
104
from bzrlib.transport.fakevfat import FakeVFATTransportDecorator
105
# now access over vfat; should be safe
106
transport = FakeVFATTransportDecorator('vfat+' + self.get_url())
107
bzrdir, junk = BzrDir.open_containing_from_transport(transport)
108
branch = bzrdir.open_branch()
109
revtree = branch.repository.revision_tree(self.REV_ID)
110
contents = revtree.get_file_text(self.FOO_ID)
111
self.assertEqual(contents, 'contents of foo')
77
114
class SampleBranchFormat(bzrlib.branch.BranchFormat):
78
115
"""A sample format