359
class TestBranchSetLastRevisionInfo(tests.TestCase):
361
def test_set_empty(self):
362
# set_last_revision_info(num, 'rev-id') is translated to calling
363
# Branch.set_last_revision_info(num, 'rev-id') on the wire.
364
client = FakeClient([
366
(('ok', 'branch token', 'repo token'), ),
367
# set_last_revision_info
371
transport = MemoryTransport()
372
transport.mkdir('branch')
373
transport = transport.clone('branch')
375
bzrdir = RemoteBzrDir(transport, _client=False)
376
branch = RemoteBranch(bzrdir, None, _client=client)
377
# This is a hack to work around the problem that RemoteBranch currently
378
# unnecessarily invokes _ensure_real upon a call to lock_write.
379
branch._ensure_real = lambda: None
380
# Lock the branch, reset the record of remote calls.
383
result = branch.set_last_revision_info(1234, 'a-revision-id')
385
[('call', 'Branch.set_last_revision_info',
386
('///branch/', 'branch token', 'repo token',
387
'1234', 'a-revision-id'))],
389
self.assertEqual(None, result)
391
def test_no_such_revision(self):
392
# A response of 'NoSuchRevision' is translated into an exception.
393
client = FakeClient([
395
(('ok', 'branch token', 'repo token'), ),
396
# set_last_revision_info
397
(('NoSuchRevision', 'revid'), ),
401
transport = MemoryTransport()
402
transport.mkdir('branch')
403
transport = transport.clone('branch')
405
bzrdir = RemoteBzrDir(transport, _client=False)
406
branch = RemoteBranch(bzrdir, None, _client=client)
407
# This is a hack to work around the problem that RemoteBranch currently
408
# unnecessarily invokes _ensure_real upon a call to lock_write.
409
branch._ensure_real = lambda: None
410
# Lock the branch, reset the record of remote calls.
415
errors.NoSuchRevision, branch.set_last_revision_info, 123, 'revid')
359
419
class TestBranchControlGetBranchConf(tests.TestCaseWithMemoryTransport):
360
420
"""Test branch.control_files api munging...