~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/branch_implementations/test_branch.py

  • Committer: Aaron Bentley
  • Date: 2006-08-16 19:13:00 UTC
  • mfrom: (1934 +trunk)
  • mto: (1910.2.43 format-bumps)
  • mto: This revision was merged to the branch mainline in revision 1935.
  • Revision ID: abentley@panoramicfeedback.com-20060816191300-045772b26b975d1c
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
181
181
        br_b = wt_a.bzrdir.open_branch().sprout(repo_b.bzrdir, revision_id='1')
182
182
        self.assertEqual(br_b.last_revision(), '1')
183
183
 
 
184
    def get_parented_branch(self):
 
185
        wt_a = self.make_branch_and_tree('a')
 
186
        self.build_tree(['a/one'])
 
187
        wt_a.add(['one'])
 
188
        wt_a.commit('commit one', rev_id='1')
 
189
 
 
190
        branch_b = wt_a.bzrdir.sprout('b', revision_id='1').open_branch()
 
191
        self.assertEqual(wt_a.branch.base, branch_b.get_parent())
 
192
        return branch_b
 
193
 
184
194
    def test_clone_branch_nickname(self):
185
195
        # test the nick name is preserved always
186
196
        raise TestSkipped('XXX branch cloning is not yet tested..')
187
197
 
188
198
    def test_clone_branch_parent(self):
189
199
        # test the parent is preserved always
190
 
        raise TestSkipped('XXX branch cloning is not yet tested..')
191
 
        
 
200
        branch_b = self.get_parented_branch()
 
201
        repo_c = self.make_repository('c')
 
202
        branch_b.repository.copy_content_into(repo_c)
 
203
        branch_c = branch_b.clone(repo_c.bzrdir)
 
204
        self.assertNotEqual(None, branch_c.get_parent())
 
205
        self.assertEqual(branch_b.get_parent(), branch_c.get_parent())
 
206
 
 
207
        # We can also set a specific parent, and it should be honored
 
208
        random_parent = 'http://bazaar-vcs.org/path/to/branch'
 
209
        branch_b.set_parent(random_parent)
 
210
        repo_d = self.make_repository('d')
 
211
        branch_b.repository.copy_content_into(repo_d)
 
212
        branch_d = branch_b.clone(repo_d.bzrdir)
 
213
        self.assertEqual(random_parent, branch_d.get_parent())
 
214
 
192
215
    def test_sprout_branch_nickname(self):
193
216
        # test the nick name is reset always
194
217
        raise TestSkipped('XXX branch sprouting is not yet tested..')
373
396
        tree.branch.generate_revision_history(bzrlib.revision.NULL_REVISION)
374
397
        self.assertEqual([], tree.branch.revision_history())
375
398
 
 
399
    def test_create_checkout(self):
 
400
        tree_a = self.make_branch_and_tree('a')
 
401
        branch_a = tree_a.branch
 
402
        checkout_b = branch_a.create_checkout('b')
 
403
        checkout_b.commit('rev1', rev_id='rev1')
 
404
        self.assertEqual('rev1', branch_a.last_revision())
 
405
        self.assertNotEqual(checkout_b.branch.base, branch_a.base)
 
406
 
 
407
        checkout_c = branch_a.create_checkout('c', lightweight=True)
 
408
        checkout_c.commit('rev2', rev_id='rev2')
 
409
        self.assertEqual('rev2', branch_a.last_revision())
 
410
        self.assertEqual(checkout_c.branch.base, branch_a.base)
 
411
 
 
412
        os.mkdir('d')
 
413
        checkout_d = branch_a.create_checkout('d', lightweight=True)
 
414
        os.mkdir('e')
 
415
        checkout_e = branch_a.create_checkout('e')
 
416
 
376
417
 
377
418
class ChrootedTests(TestCaseWithBranch):
378
419
    """A support class that provides readonly urls outside the local namespace.