~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-09-17 21:19:56 UTC
  • mfrom: (1997.1.6 bind-does-not-push-or-pull)
  • Revision ID: pqm@pqm.ubuntu.com-20060917211956-6e30d07da410fd1a
(Robert Collins) Change the Branch bind method to just bind rather than binding and pushing (fixes #43744 and #39542)

Show diffs side-by-side

added added

removed removed

Lines of Context:
391
391
        tree_a = self.make_branch_and_tree('a')
392
392
        branch_a = tree_a.branch
393
393
        checkout_b = branch_a.create_checkout('b')
 
394
        self.assertEqual(None, checkout_b.last_revision())
394
395
        checkout_b.commit('rev1', rev_id='rev1')
395
396
        self.assertEqual('rev1', branch_a.last_revision())
396
397
        self.assertNotEqual(checkout_b.branch.base, branch_a.base)
397
398
 
398
399
        checkout_c = branch_a.create_checkout('c', lightweight=True)
 
400
        self.assertEqual('rev1', checkout_c.last_revision())
399
401
        checkout_c.commit('rev2', rev_id='rev2')
400
402
        self.assertEqual('rev2', branch_a.last_revision())
401
403
        self.assertEqual(checkout_c.branch.base, branch_a.base)
402
404
 
403
405
        os.mkdir('d')
404
406
        checkout_d = branch_a.create_checkout('d', lightweight=True)
 
407
        self.assertEqual('rev2', checkout_d.last_revision())
405
408
        os.mkdir('e')
406
409
        checkout_e = branch_a.create_checkout('e')
 
410
        self.assertEqual('rev2', checkout_e.last_revision())
407
411
 
408
412
    def test_create_anonymous_lightweight_checkout(self):
409
 
        """A checkout from a readonly branch should succeed."""
 
413
        """A lightweight checkout from a readonly branch should succeed."""
410
414
        tree_a = self.make_branch_and_tree('a')
411
415
        rev_id = tree_a.commit('put some content in the branch')
412
416
        source_branch = bzrlib.branch.Branch.open(
417
421
        checkout = source_branch.create_checkout('c', lightweight=True)
418
422
        self.assertEqual(rev_id, checkout.last_revision())
419
423
 
 
424
    def test_create_anonymous_heavyweight_checkout(self):
 
425
        """A regular checkout from a readonly branch should succeed."""
 
426
        tree_a = self.make_branch_and_tree('a')
 
427
        rev_id = tree_a.commit('put some content in the branch')
 
428
        source_branch = bzrlib.branch.Branch.open(
 
429
            'readonly+' + tree_a.bzrdir.root_transport.base)
 
430
        # sanity check that the test will be valid
 
431
        self.assertRaises((errors.LockError, errors.TransportNotPossible),
 
432
            source_branch.lock_write)
 
433
        checkout = source_branch.create_checkout('c')
 
434
        self.assertEqual(rev_id, checkout.last_revision())
 
435
 
420
436
 
421
437
class ChrootedTests(TestCaseWithBranch):
422
438
    """A support class that provides readonly urls outside the local namespace.