~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_remote.py

  • Committer: John Arbash Meinel
  • Date: 2011-04-22 14:12:22 UTC
  • mfrom: (5809 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5836.
  • Revision ID: john@arbash-meinel.com-20110422141222-nx2j0hbkihcb8j16
Merge newer bzr.dev and resolve conflicts.
Try to write some documentation about how the _dirblock_state works.
Fix up the tests so that they pass again.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1377
1377
class TestBranchSetLastRevision(RemoteBranchTestCase):
1378
1378
 
1379
1379
    def test_set_empty(self):
1380
 
        # set_revision_history([]) is translated to calling
 
1380
        # _set_last_revision_info('null:') is translated to calling
1381
1381
        # Branch.set_last_revision(path, '') on the wire.
1382
1382
        transport = MemoryTransport()
1383
1383
        transport.mkdir('branch')
1405
1405
        # unnecessarily invokes _ensure_real upon a call to lock_write.
1406
1406
        branch._ensure_real = lambda: None
1407
1407
        branch.lock_write()
1408
 
        result = branch.set_revision_history([])
 
1408
        result = branch._set_last_revision(NULL_REVISION)
1409
1409
        branch.unlock()
1410
1410
        self.assertEqual(None, result)
1411
1411
        self.assertFinished(client)
1412
1412
 
1413
1413
    def test_set_nonempty(self):
1414
 
        # set_revision_history([rev-id1, ..., rev-idN]) is translated to calling
 
1414
        # set_last_revision_info(N, rev-idN) is translated to calling
1415
1415
        # Branch.set_last_revision(path, rev-idN) on the wire.
1416
1416
        transport = MemoryTransport()
1417
1417
        transport.mkdir('branch')
1443
1443
        branch._ensure_real = lambda: None
1444
1444
        # Lock the branch, reset the record of remote calls.
1445
1445
        branch.lock_write()
1446
 
        result = branch.set_revision_history(['rev-id1', 'rev-id2'])
 
1446
        result = branch._set_last_revision('rev-id2')
1447
1447
        branch.unlock()
1448
1448
        self.assertEqual(None, result)
1449
1449
        self.assertFinished(client)
1479
1479
        branch = self.make_remote_branch(transport, client)
1480
1480
        branch.lock_write()
1481
1481
        self.assertRaises(
1482
 
            errors.NoSuchRevision, branch.set_revision_history, ['rev-id'])
 
1482
            errors.NoSuchRevision, branch._set_last_revision, 'rev-id')
1483
1483
        branch.unlock()
1484
1484
        self.assertFinished(client)
1485
1485
 
1516
1516
        branch._ensure_real = lambda: None
1517
1517
        branch.lock_write()
1518
1518
        # The 'TipChangeRejected' error response triggered by calling
1519
 
        # set_revision_history causes a TipChangeRejected exception.
 
1519
        # set_last_revision_info causes a TipChangeRejected exception.
1520
1520
        err = self.assertRaises(
1521
 
            errors.TipChangeRejected, branch.set_revision_history, ['rev-id'])
 
1521
            errors.TipChangeRejected,
 
1522
            branch._set_last_revision, 'rev-id')
1522
1523
        # The UTF-8 message from the response has been decoded into a unicode
1523
1524
        # object.
1524
1525
        self.assertIsInstance(err.msg, unicode)