~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_remote.py

Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
    RemoteRepository,
57
57
    RemoteRepositoryFormat,
58
58
    )
59
 
from bzrlib.repofmt import groupcompress_repo, pack_repo
 
59
from bzrlib.repofmt import groupcompress_repo, knitpack_repo
60
60
from bzrlib.revision import NULL_REVISION
61
61
from bzrlib.smart import medium, request
62
62
from bzrlib.smart.client import _SmartClient
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)
1966
1967
        true_format = RemoteRepositoryFormat()
1967
1968
        true_format._network_name = true_name
1968
1969
        self.assertEqual(True, true_format.fast_deltas)
1969
 
        false_name = pack_repo.RepositoryFormatKnitPack1().network_name()
 
1970
        false_name = knitpack_repo.RepositoryFormatKnitPack1().network_name()
1970
1971
        false_format = RemoteRepositoryFormat()
1971
1972
        false_format._network_name = false_name
1972
1973
        self.assertEqual(False, false_format.fast_deltas)