~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_remote.py

  • Committer: Robert Collins
  • Date: 2009-04-15 02:07:35 UTC
  • mto: This revision was merged to the branch mainline in revision 4292.
  • Revision ID: robertc@robertcollins.net-20090415020735-poizrhi1b98mtdgk
Add new remote server verb Branch.set_parent_location, dropping roundtrips further on push operations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
844
844
        branch = self.make_remote_branch(transport, client)
845
845
        result = branch.get_parent()
846
846
        self.assertEqual('http://foo/', result)
 
847
        client.finished_test()
 
848
 
 
849
 
 
850
class TestBranchSetParentLocation(RemoteBranchTestCase):
 
851
 
 
852
    def test_no_parent(self):
 
853
        # We call the verb when setting parent to None
 
854
        transport = MemoryTransport()
 
855
        client = FakeClient(transport.base)
 
856
        client.add_expected_call(
 
857
            'Branch.get_stacked_on_url', ('quack/',),
 
858
            'error', ('NotStacked',))
 
859
        client.add_expected_call(
 
860
            'Branch.set_parent_location', ('quack/', 'b', 'r', ''),
 
861
            'success', ())
 
862
        transport.mkdir('quack')
 
863
        transport = transport.clone('quack')
 
864
        branch = self.make_remote_branch(transport, client)
 
865
        branch._lock_token = 'b'
 
866
        branch._repo_lock_token = 'r'
 
867
        branch._set_parent_location(None)
 
868
        client.finished_test()
 
869
 
 
870
    def test_parent(self):
 
871
        transport = MemoryTransport()
 
872
        client = FakeClient(transport.base)
 
873
        client.add_expected_call(
 
874
            'Branch.get_stacked_on_url', ('kwaak/',),
 
875
            'error', ('NotStacked',))
 
876
        client.add_expected_call(
 
877
            'Branch.set_parent_location', ('kwaak/', 'b', 'r', 'foo'),
 
878
            'success', ())
 
879
        transport.mkdir('kwaak')
 
880
        transport = transport.clone('kwaak')
 
881
        branch = self.make_remote_branch(transport, client)
 
882
        branch._lock_token = 'b'
 
883
        branch._repo_lock_token = 'r'
 
884
        branch._set_parent_location('foo')
 
885
        client.finished_test()
 
886
 
 
887
    def test_backwards_compat(self):
 
888
        self.setup_smart_server_with_call_log()
 
889
        branch = self.make_branch('.')
 
890
        self.reset_smart_call_log()
 
891
        verb = 'Branch.set_parent_location'
 
892
        self.disable_verb(verb)
 
893
        branch.set_parent('http://foo/')
 
894
        self.assertLength(12, self.hpss_calls)
847
895
 
848
896
 
849
897
class TestBranchGetTagsBytes(RemoteBranchTestCase):