~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_branch.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-03-07 10:45:44 UTC
  • mfrom: (2321.1.2 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20070307104544-59e3e6358e4bdb29
(robertc) Merge dirstate and subtrees. (Robert Collins, Martin Pool, Aaaron Bentley, John A Meinel, James Westby)

Show diffs side-by-side

added added

removed removed

Lines of Context:
190
190
        format.set_branch_format(_mod_branch.BzrBranchFormat6())
191
191
        branch = self.make_branch('a', format=format)
192
192
        self.assertIsInstance(branch, _mod_branch.BzrBranch6)
193
 
        branch = self.make_branch('b', format='experimental-branch6')
 
193
        branch = self.make_branch('b', format='dirstate-with-subtree')
194
194
        self.assertIsInstance(branch, _mod_branch.BzrBranch6)
195
195
        branch = _mod_branch.Branch.open('a')
196
196
        self.assertIsInstance(branch, _mod_branch.BzrBranch6)
197
197
 
198
198
    def test_layout(self):
199
 
        branch = self.make_branch('a', format='experimental-branch6')
 
199
        branch = self.make_branch('a', format='dirstate-with-subtree')
200
200
        self.failUnlessExists('a/.bzr/branch/last-revision')
201
201
        self.failIfExists('a/.bzr/branch/revision-history')
202
202
 
203
203
    def test_config(self):
204
204
        """Ensure that all configuration data is stored in the branch"""
205
 
        branch = self.make_branch('a', format='experimental-branch6')
 
205
        branch = self.make_branch('a', format='dirstate-with-subtree')
206
206
        branch.set_parent('http://bazaar-vcs.org')
207
207
        self.failIfExists('a/.bzr/branch/parent')
208
208
        self.assertEqual('http://bazaar-vcs.org', branch.get_parent())
216
216
 
217
217
    def test_set_revision_history(self):
218
218
        tree = self.make_branch_and_memory_tree('.',
219
 
            format='experimental-branch6')
 
219
            format='dirstate-with-subtree')
220
220
        tree.lock_write()
221
221
        try:
222
222
            tree.add('.')
231
231
 
232
232
    def test_append_revision(self):
233
233
        tree = self.make_branch_and_tree('branch1',
234
 
            format='experimental-branch6')
 
234
            format='dirstate-with-subtree')
235
235
        tree.lock_write()
236
236
        try:
237
 
            tree.add('.')
238
237
            tree.commit('foo', rev_id='foo')
239
238
            tree.commit('bar', rev_id='bar')
240
239
            tree.commit('baz', rev_id='baz')
256
255
        finally:
257
256
            tree.unlock()
258
257
 
 
258
    def do_checkout_test(self, lightweight=False):
 
259
        tree = self.make_branch_and_tree('source', format='dirstate-with-subtree')
 
260
        subtree = self.make_branch_and_tree('source/subtree',
 
261
            format='dirstate-with-subtree')
 
262
        subsubtree = self.make_branch_and_tree('source/subtree/subsubtree',
 
263
            format='dirstate-with-subtree')
 
264
        self.build_tree(['source/subtree/file',
 
265
                         'source/subtree/subsubtree/file'])
 
266
        subsubtree.add('file')
 
267
        subtree.add('file')
 
268
        subtree.add_reference(subsubtree)
 
269
        tree.add_reference(subtree)
 
270
        tree.commit('a revision')
 
271
        subtree.commit('a subtree file')
 
272
        subsubtree.commit('a subsubtree file')
 
273
        tree.branch.create_checkout('target', lightweight=lightweight)
 
274
        self.failUnlessExists('target')
 
275
        self.failUnlessExists('target/subtree')
 
276
        self.failUnlessExists('target/subtree/file')
 
277
        self.failUnlessExists('target/subtree/subsubtree/file')
 
278
        subbranch = _mod_branch.Branch.open('target/subtree/subsubtree')
 
279
        if lightweight:
 
280
            self.assertEndsWith(subbranch.base, 'source/subtree/subsubtree/')
 
281
        else:
 
282
            self.assertEndsWith(subbranch.base, 'target/subtree/subsubtree/')
 
283
 
 
284
 
 
285
    def test_checkout_with_references(self):
 
286
        self.do_checkout_test()
 
287
 
 
288
    def test_light_checkout_with_references(self):
 
289
        self.do_checkout_test(lightweight=True)
259
290
 
260
291
class TestBranchReference(TestCaseWithTransport):
261
292
    """Tests for the branch reference facility."""