~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

[merge] bzr.dev 2294

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
51
51
from bzrlib.trace import mutter
52
52
from bzrlib.transport import get_transport
53
53
from bzrlib.upgrade import upgrade
 
54
from bzrlib.repofmt import weaverepo
54
55
 
55
56
 
56
57
class TestCaseWithBzrDir(TestCaseWithTransport):
96
97
        directories = ['.']
97
98
        while directories:
98
99
            dir = directories.pop()
99
 
            for path in source.list_dir(dir):
 
100
            for path in set(source.list_dir(dir) + target.list_dir(dir)):
100
101
                path = dir + '/' + path
101
102
                if path in ignore_list:
102
103
                    continue
103
 
                stat = source.stat(path)
 
104
                try:
 
105
                    stat = source.stat(path)
 
106
                except errors.NoSuchFile:
 
107
                    self.fail('%s not in source' % path)
104
108
                if S_ISDIR(stat.st_mode):
105
109
                    self.assertTrue(S_ISDIR(target.stat(path).st_mode))
106
110
                    directories.append(path)
176
180
        dir = self.make_bzrdir('source')
177
181
        target = dir.clone(self.get_url('target'))
178
182
        self.assertNotEqual(dir.transport.base, target.transport.base)
179
 
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport)
 
183
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
 
184
                                    ['./.bzr/merge-hashes'])
180
185
    
181
186
    def test_clone_bzrdir_empty_force_new_ignored(self):
182
187
        # the force_new_repo parameter should have no effect on an empty
184
189
        dir = self.make_bzrdir('source')
185
190
        target = dir.clone(self.get_url('target'), force_new_repo=True)
186
191
        self.assertNotEqual(dir.transport.base, target.transport.base)
187
 
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport)
 
192
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
 
193
                                    ['./.bzr/merge-hashes'])
188
194
    
189
195
    def test_clone_bzrdir_repository(self):
190
196
        tree = self.make_branch_and_tree('commit_tree')
198
204
        target = dir.clone(self.get_url('target'))
199
205
        self.assertNotEqual(dir.transport.base, target.transport.base)
200
206
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
201
 
                                    ['./.bzr/repository/inventory.knit',
 
207
                                    [
 
208
                                     './.bzr/merge-hashes',
 
209
                                     './.bzr/repository/inventory.knit',
202
210
                                     ])
203
211
 
204
212
 
314
322
        target = dir.clone(self.get_url('target'))
315
323
        self.assertNotEqual(dir.transport.base, target.transport.base)
316
324
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
317
 
                                    ['./.bzr/stat-cache',
 
325
                                    [
 
326
                                     './.bzr/basis-inventory-cache',
318
327
                                     './.bzr/checkout/stat-cache',
 
328
                                     './.bzr/merge-hashes',
319
329
                                     './.bzr/repository/inventory.knit',
320
 
                                     ])
 
330
                                     './.bzr/stat-cache',
 
331
                                    ])
321
332
 
322
333
    def test_clone_bzrdir_branch_and_repo_into_shared_repo(self):
323
334
        # by default cloning into a shared repo uses the shared repo.
405
416
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
406
417
                                    ['./.bzr/stat-cache',
407
418
                                     './.bzr/checkout/stat-cache',
 
419
                                     './.bzr/checkout/merge-hashes',
 
420
                                     './.bzr/merge-hashes',
408
421
                                     './.bzr/repository/inventory.knit',
409
422
                                     ])
410
423
 
421
434
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
422
435
                                    ['./.bzr/stat-cache',
423
436
                                     './.bzr/checkout/stat-cache',
 
437
                                     './.bzr/checkout/merge-hashes',
 
438
                                     './.bzr/merge-hashes',
424
439
                                     './.bzr/repository/inventory.knit',
425
440
                                     ])
426
441
 
428
443
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
429
444
                                    ['./.bzr/stat-cache',
430
445
                                     './.bzr/checkout/stat-cache',
 
446
                                     './.bzr/checkout/merge-hashes',
 
447
                                     './.bzr/merge-hashes',
431
448
                                     './.bzr/repository/inventory.knit',
432
449
                                     ])
433
450
 
450
467
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
451
468
                                    ['./.bzr/stat-cache',
452
469
                                     './.bzr/checkout/stat-cache',
 
470
                                     './.bzr/checkout/merge-hashes',
 
471
                                     './.bzr/merge-hashes',
453
472
                                     './.bzr/repository/inventory.knit',
454
473
                                     ])
455
474
 
545
564
        self.assertNotEqual(dir.transport.base, target.transport.base)
546
565
        # testing inventory isn't reasonable for repositories
547
566
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
548
 
                                    ['./.bzr/repository/inventory.knit',
549
 
                                     './.bzr/inventory'
 
567
                                    [
 
568
                                     './.bzr/branch',
 
569
                                     './.bzr/checkout',
 
570
                                     './.bzr/inventory',
 
571
                                     './.bzr/parent',
 
572
                                     './.bzr/repository/inventory.knit',
550
573
                                     ])
551
574
        try:
552
575
            # If we happen to have a tree, we'll guarantee everything
675
698
        target = self.sproutOrSkip(dir, self.get_url('target'))
676
699
        self.assertNotEqual(dir.transport.base, target.transport.base)
677
700
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
678
 
                                    ['./.bzr/stat-cache',
 
701
                                    [
 
702
                                     './.bzr/basis-inventory-cache',
 
703
                                     './.bzr/branch/branch.conf',
 
704
                                     './.bzr/branch/parent',
 
705
                                     './.bzr/checkout',
 
706
                                     './.bzr/checkout/inventory',
679
707
                                     './.bzr/checkout/stat-cache',
680
708
                                     './.bzr/inventory',
681
 
                                     './.bzr/checkout/inventory',
 
709
                                     './.bzr/parent',
682
710
                                     './.bzr/repository/inventory.knit',
 
711
                                     './.bzr/stat-cache',
 
712
                                     './foo',
683
713
                                     ])
684
714
 
685
715
    def test_sprout_bzrdir_branch_and_repo_shared(self):
817
847
        target = self.sproutOrSkip(dir, self.get_url('target'))
818
848
        self.assertNotEqual(dir.transport.base, target.transport.base)
819
849
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
820
 
                                    ['./.bzr/stat-cache',
 
850
                                    [
 
851
                                     './.bzr/branch/branch.conf',
 
852
                                     './.bzr/branch/parent',
821
853
                                     './.bzr/checkout/stat-cache',
 
854
                                     './.bzr/checkout/inventory',
822
855
                                     './.bzr/inventory',
823
 
                                     './.bzr/checkout/inventory',
 
856
                                     './.bzr/parent',
824
857
                                     './.bzr/repository/inventory.knit',
 
858
                                     './.bzr/stat-cache',
825
859
                                     ])
826
860
 
827
861
    def test_sprout_bzrdir_tree_branch_reference(self):
1106
1140
        self.assertTrue(isinstance(dir.get_repository_transport(None),
1107
1141
                                   transport.Transport))
1108
1142
        # with a given format, either the bzr dir supports identifiable
1109
 
        # repositoryes, or it supports anonymous  repository formats, but not both.
1110
 
        anonymous_format = repository.RepositoryFormat6()
1111
 
        identifiable_format = repository.RepositoryFormat7()
 
1143
        # repositories, or it supports anonymous  repository formats, but not both.
 
1144
        anonymous_format = weaverepo.RepositoryFormat6()
 
1145
        identifiable_format = weaverepo.RepositoryFormat7()
1112
1146
        try:
1113
1147
            found_transport = dir.get_repository_transport(anonymous_format)
1114
1148
            self.assertRaises(errors.IncompatibleFormat,