~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_branch.py

Merge from by-reference-trees

Show diffs side-by-side

added added

removed removed

Lines of Context:
250
250
        finally:
251
251
            tree.unlock()
252
252
 
 
253
    def do_checkout_test(self, lightweight=False):
 
254
        tree = self.make_branch_and_tree('source', format='experimental-knit3')
 
255
        subtree = self.make_branch_and_tree('source/subtree', 
 
256
                                            format='experimental-knit3')
 
257
        subsubtree = self.make_branch_and_tree('source/subtree/subsubtree',
 
258
                                               format='experimental-knit3')
 
259
        self.build_tree(['source/subtree/file',
 
260
                         'source/subtree/subsubtree/file'])
 
261
        subsubtree.add('file')
 
262
        subtree.add('file')
 
263
        subtree.add_reference(subsubtree)
 
264
        tree.add_reference(subtree)
 
265
        tree.commit('a revision')
 
266
        subtree.commit('a subtree file')
 
267
        subsubtree.commit('a subsubtree file')
 
268
        tree.branch.create_checkout('target', lightweight=lightweight)
 
269
        self.failUnlessExists('target')
 
270
        self.failUnlessExists('target/subtree')
 
271
        self.failUnlessExists('target/subtree/file')
 
272
        self.failUnlessExists('target/subtree/subsubtree/file')
 
273
        subbranch = _mod_branch.Branch.open('target/subtree/subsubtree')
 
274
        if lightweight:
 
275
            self.assertEndsWith(subbranch.base, 'source/subtree/subsubtree/')
 
276
        else:
 
277
            self.assertEndsWith(subbranch.base, 'target/subtree/subsubtree/')
 
278
 
 
279
 
 
280
    def test_checkout_with_references(self):
 
281
        self.do_checkout_test()
 
282
 
 
283
    def test_light_checkout_with_references(self):
 
284
        self.do_checkout_test(lightweight=True)
253
285
 
254
286
class TestBranchReference(TestCaseWithTransport):
255
287
    """Tests for the branch reference facility."""