~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_branch.py

  • Committer: Aaron Bentley
  • Date: 2007-01-27 18:28:27 UTC
  • mto: (2255.6.1 dirstate)
  • mto: This revision was merged to the branch mainline in revision 2322.
  • Revision ID: aaron.bentley@utoronto.ca-20070127182827-4b8dg34lxi8ipuwe
checkout type is maintained for subtrees

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
from StringIO import StringIO
26
26
 
 
27
from bzrlib import branch
 
28
from bzrlib import bzrdir
27
29
import bzrlib.branch
28
30
from bzrlib.branch import (BzrBranch5, 
29
31
                           BzrBranchFormat5)
30
 
import bzrlib.bzrdir as bzrdir
31
32
from bzrlib.bzrdir import (BzrDirMetaFormat1, BzrDirMeta1, 
32
33
                           BzrDir, BzrDirFormat)
33
34
from bzrlib.errors import (NotBranchError,
145
146
        # unregister the format
146
147
        bzrlib.branch.BranchFormat.unregister_format(format)
147
148
 
148
 
    def test_checkout_with_references(self):
 
149
    def do_checkout_test(self, lightweight=False):
149
150
        tree = self.make_branch_and_tree('source', format='experimental-knit3')
150
151
        subtree = self.make_branch_and_tree('source/subtree', 
151
152
                                            format='experimental-knit3')
160
161
        tree.commit('a revision')
161
162
        subtree.commit('a subtree file')
162
163
        subsubtree.commit('a subsubtree file')
163
 
        tree.branch.create_checkout('target')
 
164
        tree.branch.create_checkout('target', lightweight=lightweight)
164
165
        self.failUnlessExists('target')
165
166
        self.failUnlessExists('target/subtree')
166
167
        self.failUnlessExists('target/subtree/file')
167
168
        self.failUnlessExists('target/subtree/subsubtree/file')
168
 
 
 
169
        subbranch = branch.Branch.open('target/subtree/subsubtree')
 
170
        if lightweight:
 
171
            self.assertEndsWith(subbranch.base, 'source/subtree/subsubtree/')
 
172
        else:
 
173
            self.assertEndsWith(subbranch.base, 'target/subtree/subsubtree/')
 
174
 
 
175
 
 
176
    def test_checkout_with_references(self):
 
177
        self.do_checkout_test()
 
178
 
 
179
    def test_light_checkout_with_references(self):
 
180
        self.do_checkout_test(lightweight=True)
169
181
 
170
182
class TestBranchReference(TestCaseWithTransport):
171
183
    """Tests for the branch reference facility."""