~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_smart.py

  • Committer: Andrew Bennetts
  • Date: 2008-04-08 06:38:34 UTC
  • mfrom: (2892.2.1 smart-set-last-revision)
  • mto: This revision was merged to the branch mainline in revision 3355.
  • Revision ID: andrew.bennetts@canonical.com-20080408063834-o4mid7woclibs6yj
Merge 'Add Branch.set_last_revision_info smart method'.

Show diffs side-by-side

added added

removed removed

Lines of Context:
476
476
            tree.branch.unlock()
477
477
 
478
478
 
 
479
class TestSmartServerBranchRequestSetLastRevisionInfo(tests.TestCaseWithTransport):
 
480
 
 
481
    def test_revision_id_present(self):
 
482
        backing = self.get_transport()
 
483
        request = smart.branch.SmartServerBranchRequestSetLastRevision(backing)
 
484
        tree = self.make_branch_and_memory_tree('.')
 
485
        tree.lock_write()
 
486
        tree.add('')
 
487
        rev_id_utf8 = u'\xc8'.encode('utf-8')
 
488
        r1 = tree.commit('1st commit', rev_id=rev_id_utf8)
 
489
        r2 = tree.commit('2nd commit')
 
490
        tree.unlock()
 
491
        branch_token = tree.branch.lock_write()
 
492
        repo_token = tree.branch.repository.lock_write()
 
493
        tree.branch.repository.unlock()
 
494
        try:
 
495
            self.assertEqual(
 
496
                SmartServerResponse(('ok',)),
 
497
                request.execute(
 
498
                    '', branch_token, repo_token,
 
499
                    rev_id_utf8))
 
500
            self.assertEqual([rev_id_utf8], tree.branch.revision_history())
 
501
        finally:
 
502
            tree.branch.unlock()
 
503
 
 
504
 
479
505
class TestSmartServerBranchRequestLockWrite(tests.TestCaseWithMemoryTransport):
480
506
 
481
507
    def setUp(self):
1014
1040
            smart.request.request_handlers.get('Branch.set_last_revision'),
1015
1041
            smart.branch.SmartServerBranchRequestSetLastRevision)
1016
1042
        self.assertEqual(
 
1043
            smart.request.request_handlers.get('Branch.set_last_revision_info'),
 
1044
            smart.branch.SmartServerBranchRequestSetLastRevisionInfo)
 
1045
        self.assertEqual(
1017
1046
            smart.request.request_handlers.get('Branch.unlock'),
1018
1047
            smart.branch.SmartServerBranchRequestUnlock)
1019
1048
        self.assertEqual(