~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/bzrdir_implementations/test_bzrdir.py

  • Committer: abentley
  • Date: 2006-04-20 23:47:53 UTC
  • mfrom: (1681 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1683.
  • Revision ID: abentley@lappy-20060420234753-6a6874b76f09f86d
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
            self.bzrdir = self.make_bzrdir(None)
60
60
        return self.bzrdir
61
61
 
62
 
    def make_bzrdir(self, relpath):
63
 
        try:
64
 
            url = self.get_url(relpath)
65
 
            segments = url.split('/')
66
 
            if segments and segments[-1] not in ('', '.'):
67
 
                parent = '/'.join(segments[:-1])
68
 
                t = get_transport(parent)
69
 
                try:
70
 
                    t.mkdir(segments[-1])
71
 
                except FileExists:
72
 
                    pass
73
 
            return self.bzrdir_format.initialize(url)
74
 
        except UninitializableFormat:
75
 
            raise TestSkipped("Format %s is not initializable.")
 
62
    def make_bzrdir(self, relpath, format=None):
 
63
        return super(TestCaseWithBzrDir, self).make_bzrdir(
 
64
            relpath, format=self.bzrdir_format)
 
65
 
76
66
 
77
67
 
78
68
class TestBzrDir(TestCaseWithBzrDir):
88
78
        """Assert that the content of source and target are identical.
89
79
 
90
80
        paths in ignore list will be completely ignored.
 
81
        
 
82
        We ignore paths that represent data which is allowed to change during
 
83
        a clone or sprout: for instance, inventory.knit contains gzip fragements
 
84
        which have timestamps in them, and as we have read the inventory from 
 
85
        the source knit, the already-read data is recompressed rather than
 
86
        reading it again, which leads to changed timestamps. This is ok though,
 
87
        because the inventory.kndx file is not ignored, and the integrity of
 
88
        knit joins is tested by test_knit and test_versionedfile.
91
89
        """
92
90
        files = []
93
91
        directories = ['.']
131
129
        self.assertTrue(repo.has_revision('1'))
132
130
        target = dir.clone(self.get_url('target'))
133
131
        self.assertNotEqual(dir.transport.base, target.transport.base)
134
 
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport)
 
132
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
 
133
                                    ['./.bzr/repository/inventory.knit',
 
134
                                     ])
 
135
 
135
136
 
136
137
    def test_clone_bzrdir_repository_under_shared(self):
137
138
        tree = self.make_branch_and_tree('commit_tree')
185
186
            return
186
187
        target = dir.clone(self.get_url('target/child'), force_new_repo=True)
187
188
        self.assertNotEqual(dir.transport.base, target.transport.base)
188
 
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport)
 
189
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
 
190
                                    ['./.bzr/repository/inventory.knit',
 
191
                                     ])
189
192
 
190
193
    def test_clone_bzrdir_repository_revision(self):
191
194
        # test for revision limiting, [smoke test, not corner case checks].
217
220
        target = dir.clone(self.get_url('target'))
218
221
        self.assertNotEqual(dir.transport.base, target.transport.base)
219
222
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
220
 
                                    ['./.bzr/stat-cache', './.bzr/checkout/stat-cache'])
 
223
                                    ['./.bzr/stat-cache',
 
224
                                     './.bzr/checkout/stat-cache',
 
225
                                     './.bzr/repository/inventory.knit',
 
226
                                     ])
221
227
 
222
228
    def test_clone_bzrdir_branch_and_repo_into_shared_repo(self):
223
229
        # by default cloning into a shared repo uses the shared repo.
256
262
        target = dir.clone(self.get_url('target/child'), force_new_repo=True)
257
263
        self.assertNotEqual(dir.transport.base, target.transport.base)
258
264
        target.open_repository()
259
 
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport)
 
265
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
 
266
                                    ['./.bzr/repository/inventory.knit',
 
267
                                     ])
260
268
 
261
269
    def test_clone_bzrdir_branch_reference(self):
262
270
        # cloning should preserve the reference status of the branch in a bzrdir
270
278
            return
271
279
        target = dir.clone(self.get_url('target'))
272
280
        self.assertNotEqual(dir.transport.base, target.transport.base)
273
 
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport)
 
281
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
 
282
                                    ['./.bzr/repository/inventory.knit',
 
283
                                     ])
274
284
 
275
285
    def test_clone_bzrdir_branch_revision(self):
276
286
        # test for revision limiting, [smoke test, not corner case checks].
298
308
        target = dir.clone(self.get_url('target'))
299
309
        self.assertNotEqual(dir.transport.base, target.transport.base)
300
310
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
301
 
                                    ['./.bzr/stat-cache', './.bzr/checkout/stat-cache'])
 
311
                                    ['./.bzr/stat-cache',
 
312
                                     './.bzr/checkout/stat-cache',
 
313
                                     './.bzr/repository/inventory.knit',
 
314
                                     ])
 
315
 
302
316
        target.open_workingtree().revert([])
303
317
 
304
318
    def test_revert_inventory(self):
309
323
        dir = tree.bzrdir
310
324
        target = dir.clone(self.get_url('target'))
311
325
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
312
 
                                    ['./.bzr/stat-cache', './.bzr/checkout/stat-cache'])
 
326
                                    ['./.bzr/stat-cache',
 
327
                                     './.bzr/checkout/stat-cache',
 
328
                                     './.bzr/repository/inventory.knit',
 
329
                                     ])
 
330
 
313
331
        target.open_workingtree().revert([])
314
332
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
315
 
                                    ['./.bzr/stat-cache', './.bzr/checkout/stat-cache'])
 
333
                                    ['./.bzr/stat-cache',
 
334
                                     './.bzr/checkout/stat-cache',
 
335
                                     './.bzr/repository/inventory.knit',
 
336
                                     ])
 
337
 
316
338
 
317
339
    def test_clone_bzrdir_tree_branch_reference(self):
318
340
        # a tree with a branch reference (aka a checkout) 
329
351
        target = dir.clone(self.get_url('target'))
330
352
        self.assertNotEqual(dir.transport.base, target.transport.base)
331
353
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
332
 
                                    ['./.bzr/stat-cache', './.bzr/checkout/stat-cache'])
 
354
                                    ['./.bzr/stat-cache',
 
355
                                     './.bzr/checkout/stat-cache',
 
356
                                     './.bzr/repository/inventory.knit',
 
357
                                     ])
 
358
 
333
359
 
334
360
    def test_clone_bzrdir_tree_revision(self):
335
361
        # test for revision limiting, [smoke test, not corner case checks].
410
436
        self.assertTrue(repo.has_revision('1'))
411
437
        target = dir.sprout(self.get_url('target'))
412
438
        self.assertNotEqual(dir.transport.base, target.transport.base)
413
 
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport)
 
439
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
 
440
                                    ['./.bzr/repository/inventory.knit',
 
441
                                     ])
414
442
 
415
443
    def test_sprout_bzrdir_with_repository_to_shared(self):
416
444
        tree = self.make_branch_and_tree('commit_tree')
504
532
                                     './.bzr/checkout/stat-cache',
505
533
                                     './.bzr/inventory',
506
534
                                     './.bzr/checkout/inventory',
 
535
                                     './.bzr/repository/inventory.knit',
507
536
                                     ])
508
537
 
509
538
    def test_sprout_bzrdir_branch_and_repo_shared(self):
643
672
                                     './.bzr/checkout/stat-cache',
644
673
                                     './.bzr/inventory',
645
674
                                     './.bzr/checkout/inventory',
 
675
                                     './.bzr/repository/inventory.knit',
646
676
                                     ])
647
677
 
648
678
    def test_sprout_bzrdir_tree_branch_reference(self):
1080
1110
            # and it should pass 'check' now.
1081
1111
            check(bzrdir.BzrDir.open(self.get_url('.')).open_branch(), False)
1082
1112
 
 
1113
    def test_format_description(self):
 
1114
        dir = self.make_bzrdir('.')
 
1115
        text = dir._format.get_format_description()
 
1116
        self.failUnless(len(text))
 
1117
 
1083
1118
 
1084
1119
class ChrootedBzrDirTests(ChrootedTestCase):
1085
1120