~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-03-25 07:21:21 UTC
  • mto: (3297.4.1 smart-set-revision-info)
  • mto: This revision was merged to the branch mainline in revision 3355.
  • Revision ID: andrew.bennetts@canonical.com-20080325072121-67qctpl7mxhr3onc
Add Branch.set_last_revision_info smart method, and make the RemoteBranch client use it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
362
362
            tree.branch.unlock()
363
363
 
364
364
 
 
365
class TestSmartServerBranchRequestSetLastRevisionInfo(tests.TestCaseWithTransport):
 
366
 
 
367
    def test_revision_id_present(self):
 
368
        backing = self.get_transport()
 
369
        request = smart.branch.SmartServerBranchRequestSetLastRevision(backing)
 
370
        tree = self.make_branch_and_memory_tree('.')
 
371
        tree.lock_write()
 
372
        tree.add('')
 
373
        rev_id_utf8 = u'\xc8'.encode('utf-8')
 
374
        r1 = tree.commit('1st commit', rev_id=rev_id_utf8)
 
375
        r2 = tree.commit('2nd commit')
 
376
        tree.unlock()
 
377
        branch_token = tree.branch.lock_write()
 
378
        repo_token = tree.branch.repository.lock_write()
 
379
        tree.branch.repository.unlock()
 
380
        try:
 
381
            self.assertEqual(
 
382
                SmartServerResponse(('ok',)),
 
383
                request.execute(
 
384
                    backing.local_abspath(''), branch_token, repo_token,
 
385
                    rev_id_utf8))
 
386
            self.assertEqual([rev_id_utf8], tree.branch.revision_history())
 
387
        finally:
 
388
            tree.branch.unlock()
 
389
 
 
390
 
365
391
class TestSmartServerBranchRequestLockWrite(tests.TestCaseWithTransport):
366
392
 
367
393
    def setUp(self):
804
830
            smart.request.request_handlers.get('Branch.set_last_revision'),
805
831
            smart.branch.SmartServerBranchRequestSetLastRevision)
806
832
        self.assertEqual(
 
833
            smart.request.request_handlers.get('Branch.set_last_revision_info'),
 
834
            smart.branch.SmartServerBranchRequestSetLastRevisionInfo)
 
835
        self.assertEqual(
807
836
            smart.request.request_handlers.get('Branch.unlock'),
808
837
            smart.branch.SmartServerBranchRequestUnlock)
809
838
        self.assertEqual(