~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_repository.py

Merge repository so I dont trample on myself.

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
        """See RepositoryFormat.get_format_string()."""
70
70
        return "Sample .bzr repository format."
71
71
 
72
 
    def initialize(self, a_bzrdir):
 
72
    def initialize(self, a_bzrdir, shared=False):
73
73
        """Initialize a repository in a BzrDir"""
74
74
        t = a_bzrdir.get_repository_transport(self)
75
75
        t.put('format', StringIO(self.get_format_string()))
160
160
                             'w\n'
161
161
                             'W\n',
162
162
                             t.get('inventory.weave').read())
 
163
 
 
164
    def test_shared_disk_layout(self):
 
165
        control = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
 
166
        repo = repository.RepositoryFormat7().initialize(control, shared=True)
 
167
        # we want:
 
168
        # format 'Bazaar-NG Repository format 7'
 
169
        # lock ''
 
170
        # inventory.weave == empty_weave
 
171
        # empty revision-store directory
 
172
        # empty weaves directory
 
173
        # a 'shared-storage' marker file.
 
174
        t = control.get_repository_transport(None)
 
175
        self.assertEqualDiff('Bazaar-NG Repository format 7',
 
176
                             t.get('format').read())
 
177
        self.assertEqualDiff('', t.get('lock').read())
 
178
        self.assertEqualDiff('', t.get('shared-storage').read())
 
179
        self.assertTrue(S_ISDIR(t.stat('revision-store').st_mode))
 
180
        self.assertTrue(S_ISDIR(t.stat('weaves').st_mode))
 
181
        self.assertEqualDiff('# bzr weave file v5\n'
 
182
                             'w\n'
 
183
                             'W\n',
 
184
                             t.get('inventory.weave').read())
 
185
 
 
186
    def test_shared_no_tree_disk_layout(self):
 
187
        control = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
 
188
        repo = repository.RepositoryFormat7().initialize(control, shared=True)
 
189
        repo.set_make_working_trees(False)
 
190
        # we want:
 
191
        # format 'Bazaar-NG Repository format 7'
 
192
        # lock ''
 
193
        # inventory.weave == empty_weave
 
194
        # empty revision-store directory
 
195
        # empty weaves directory
 
196
        # a 'shared-storage' marker file.
 
197
        t = control.get_repository_transport(None)
 
198
        self.assertEqualDiff('Bazaar-NG Repository format 7',
 
199
                             t.get('format').read())
 
200
        self.assertEqualDiff('', t.get('lock').read())
 
201
        self.assertEqualDiff('', t.get('shared-storage').read())
 
202
        self.assertEqualDiff('', t.get('no-working-trees').read())
 
203
        repo.set_make_working_trees(True)
 
204
        self.assertFalse(t.has('no-working-trees'))
 
205
        self.assertTrue(S_ISDIR(t.stat('revision-store').st_mode))
 
206
        self.assertTrue(S_ISDIR(t.stat('weaves').st_mode))
 
207
        self.assertEqualDiff('# bzr weave file v5\n'
 
208
                             'w\n'
 
209
                             'W\n',
 
210
                             t.get('inventory.weave').read())