~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

 * Two new commands 'bzr checkout' and 'bzr update' allow for CVS/SVN-alike
   behaviour. They use the existing serverless-mode and store no data
   locally. As such they are not suitable for use except in high bandwidth
   low latency environments like LAN's or local disk. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
from stat import *
21
21
import sys
22
22
 
23
 
import bzrlib.branch as branch
 
23
import bzrlib.branch
24
24
import bzrlib.bzrdir as bzrdir
25
25
from bzrlib.branch import Branch, needs_read_lock, needs_write_lock
26
26
from bzrlib.commit import commit
147
147
        dir = source.bzrdir
148
148
        target = dir.clone(self.get_url('target'))
149
149
        self.assertNotEqual(dir.transport.base, target.transport.base)
150
 
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport)
 
150
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
 
151
                                    ['./.bzr/stat-cache', './.bzr/checkout/stat-cache'])
151
152
 
152
153
    def test_clone_bzrdir_branch_reference(self):
153
154
        # cloning should preserve the reference status of the branch in a bzrdir
154
155
        referenced_branch = self.make_branch('referencced')
155
156
        dir = self.make_bzrdir('source')
156
157
        try:
157
 
            reference = branch.BranchReferenceFormat().initialize(dir,
 
158
            reference = bzrlib.branch.BranchReferenceFormat().initialize(dir,
158
159
                referenced_branch)
159
160
        except errors.IncompatibleFormat:
160
161
            # this is ok too, not all formats have to support references.
189
190
        target = dir.clone(self.get_url('target'))
190
191
        self.assertNotEqual(dir.transport.base, target.transport.base)
191
192
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
192
 
                                    ['./.bzr/stat-cache'])
 
193
                                    ['./.bzr/stat-cache', './.bzr/checkout/stat-cache'])
193
194
 
194
195
    def test_clone_bzrdir_tree_branch_reference(self):
195
196
        # a tree with a branch reference (aka a checkout) 
197
198
        referenced_branch = self.make_branch('referencced')
198
199
        dir = self.make_bzrdir('source')
199
200
        try:
200
 
            reference = branch.BranchReferenceFormat().initialize(dir,
 
201
            reference = bzrlib.branch.BranchReferenceFormat().initialize(dir,
201
202
                referenced_branch)
202
203
        except errors.IncompatibleFormat:
203
204
            # this is ok too, not all formats have to support references.
206
207
        target = dir.clone(self.get_url('target'))
207
208
        self.assertNotEqual(dir.transport.base, target.transport.base)
208
209
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
209
 
                                    ['./.bzr/stat-cache'])
 
210
                                    ['./.bzr/stat-cache', './.bzr/checkout/stat-cache'])
210
211
 
211
212
    def test_clone_bzrdir_tree_revision(self):
212
213
        # test for revision limiting, [smoke test, not corner case checks].
300
301
        referenced_branch = self.make_branch('referencced')
301
302
        dir = self.make_bzrdir('source')
302
303
        try:
303
 
            reference = branch.BranchReferenceFormat().initialize(dir,
 
304
            reference = bzrlib.branch.BranchReferenceFormat().initialize(dir,
304
305
                referenced_branch)
305
306
        except errors.IncompatibleFormat:
306
307
            # this is ok too, not all formats have to support references.
340
341
        target = dir.sprout(self.get_url('target'))
341
342
        self.assertNotEqual(dir.transport.base, target.transport.base)
342
343
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
343
 
                                    ['./.bzr/stat-cache'])
 
344
                                    ['./.bzr/stat-cache', './.bzr/checkout/stat-cache'])
344
345
 
345
346
    def test_sprout_bzrdir_tree_branch_reference(self):
346
347
        # sprouting should create a repository if needed and a sprouted branch.
348
349
        referenced_branch = self.make_branch('referencced')
349
350
        dir = self.make_bzrdir('source')
350
351
        try:
351
 
            reference = branch.BranchReferenceFormat().initialize(dir,
 
352
            reference = bzrlib.branch.BranchReferenceFormat().initialize(dir,
352
353
                referenced_branch)
353
354
        except errors.IncompatibleFormat:
354
355
            # this is ok too, not all formats have to support references.
372
373
        referenced_branch = self.make_branch('referencced')
373
374
        dir = self.make_bzrdir('source')
374
375
        try:
375
 
            reference = branch.BranchReferenceFormat().initialize(dir,
 
376
            reference = bzrlib.branch.BranchReferenceFormat().initialize(dir,
376
377
                referenced_branch)
377
378
        except errors.IncompatibleFormat:
378
379
            # this is ok too, not all formats have to support references.
467
468
        made_control = self.bzrdir_format.initialize(t.base)
468
469
        made_repo = made_control.create_repository()
469
470
        made_branch = made_control.create_branch()
470
 
        self.failUnless(isinstance(made_branch, branch.Branch))
 
471
        self.failUnless(isinstance(made_branch, bzrlib.branch.Branch))
471
472
        self.assertEqual(made_control, made_branch.bzrdir)
472
473
        
473
474
    def test_open_branch(self):
529
530
        self.failUnless(isinstance(made_tree, workingtree.WorkingTree))
530
531
        self.assertEqual(made_control, made_tree.bzrdir)
531
532
        
 
533
    def test_create_workingtree_revision(self):
 
534
        # a bzrdir can construct a working tree for itself @ a specific revision.
 
535
        source = self.make_branch_and_tree('source')
 
536
        source.commit('a', rev_id='a', allow_pointless=True)
 
537
        source.commit('b', rev_id='b', allow_pointless=True)
 
538
        self.build_tree(['new/'])
 
539
        made_control = self.bzrdir_format.initialize('new')
 
540
        source.branch.repository.clone(made_control)
 
541
        source.branch.clone(made_control)
 
542
        made_tree = made_control.create_workingtree(revision_id='a')
 
543
        self.assertEqual('a', made_tree.last_revision())
 
544
        
532
545
    def test_open_workingtree(self):
533
546
        if not self.bzrdir_format.is_supported():
534
547
            # unsupported formats are not loopback testable
555
568
                                   transport.Transport))
556
569
        # with a given format, either the bzr dir supports identifiable
557
570
        # branches, or it supports anonymous  branch formats, but not both.
558
 
        anonymous_format = branch.BzrBranchFormat4()
559
 
        identifiable_format = branch.BzrBranchFormat5()
 
571
        anonymous_format = bzrlib.branch.BzrBranchFormat4()
 
572
        identifiable_format = bzrlib.branch.BzrBranchFormat5()
560
573
        try:
561
574
            found_transport = dir.get_branch_transport(anonymous_format)
562
575
            self.assertRaises(errors.IncompatibleFormat,