~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_branch.py

  • Committer: Martin Pool
  • Date: 2006-04-12 04:45:32 UTC
  • mfrom: (1608.2.13 bzr.mbp.escape-stores)
  • mto: This revision was merged to the branch mainline in revision 1657.
  • Revision ID: mbp@sourcefrog.net-20060412044532-fc8c5c9408aae88b
[merge][wip] Storage escaping

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
        self.assertIsDirectory('.bzr/branch/lock/held', t)
75
75
 
76
76
 
 
77
class TestBranchEscaping(TestCaseWithTransport):
 
78
    """Test a branch can be correctly stored and used on a vfat-like transport
 
79
    
 
80
    Makes sure we have proper escaping of invalid characters, etc.
 
81
 
 
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.
 
86
    """
 
87
 
 
88
    FOO_ID = 'foo<:>ID'
 
89
    REV_ID = 'revid-1'
 
90
 
 
91
    def setUp(self):
 
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)
 
102
 
 
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')
 
112
 
 
113
 
77
114
class SampleBranchFormat(bzrlib.branch.BranchFormat):
78
115
    """A sample format
79
116