127
56
self.assertNotEqual(None,
128
57
SmartServerResponse(('ok', )))
130
def test__str__(self):
131
"""SmartServerResponses can be stringified."""
133
"<SuccessfulSmartServerResponse args=('args',) body='body'>",
134
str(SuccessfulSmartServerResponse(('args',), 'body')))
136
"<FailedSmartServerResponse args=('args',) body='body'>",
137
str(FailedSmartServerResponse(('args',), 'body')))
140
class TestSmartServerRequest(tests.TestCaseWithMemoryTransport):
142
def test_translate_client_path(self):
143
transport = self.get_transport()
144
request = SmartServerRequest(transport, 'foo/')
145
self.assertEqual('./', request.translate_client_path('foo/'))
147
errors.InvalidURLJoin, request.translate_client_path, 'foo/..')
149
errors.PathNotChild, request.translate_client_path, '/')
151
errors.PathNotChild, request.translate_client_path, 'bar/')
152
self.assertEqual('./baz', request.translate_client_path('foo/baz'))
154
def test_transport_from_client_path(self):
155
transport = self.get_transport()
156
request = SmartServerRequest(transport, 'foo/')
159
request.transport_from_client_path('foo/').base)
162
class TestSmartServerBzrDirRequestCloningMetaDir(
163
tests.TestCaseWithMemoryTransport):
164
"""Tests for BzrDir.cloning_metadir."""
166
def test_cloning_metadir(self):
167
"""When there is a bzrdir present, the call succeeds."""
168
backing = self.get_transport()
169
dir = self.make_bzrdir('.')
170
local_result = dir.cloning_metadir()
171
request_class = smart_dir.SmartServerBzrDirRequestCloningMetaDir
172
request = request_class(backing)
173
expected = SuccessfulSmartServerResponse(
174
(local_result.network_name(),
175
local_result.repository_format.network_name(),
176
('branch', local_result.get_branch_format().network_name())))
177
self.assertEqual(expected, request.execute('', 'False'))
179
def test_cloning_metadir_reference(self):
180
"""The request fails when bzrdir contains a branch reference."""
181
backing = self.get_transport()
182
referenced_branch = self.make_branch('referenced')
183
dir = self.make_bzrdir('.')
184
local_result = dir.cloning_metadir()
185
reference = BranchReferenceFormat().initialize(dir, referenced_branch)
186
reference_url = BranchReferenceFormat().get_reference(dir)
187
# The server shouldn't try to follow the branch reference, so it's fine
188
# if the referenced branch isn't reachable.
189
backing.rename('referenced', 'moved')
190
request_class = smart_dir.SmartServerBzrDirRequestCloningMetaDir
191
request = request_class(backing)
192
expected = FailedSmartServerResponse(('BranchReference',))
193
self.assertEqual(expected, request.execute('', 'False'))
196
class TestSmartServerRequestCreateRepository(tests.TestCaseWithMemoryTransport):
197
"""Tests for BzrDir.create_repository."""
199
def test_makes_repository(self):
200
"""When there is a bzrdir present, the call succeeds."""
201
backing = self.get_transport()
202
self.make_bzrdir('.')
203
request_class = bzrlib.smart.bzrdir.SmartServerRequestCreateRepository
204
request = request_class(backing)
205
reference_bzrdir_format = bzrdir.format_registry.get('default')()
206
reference_format = reference_bzrdir_format.repository_format
207
network_name = reference_format.network_name()
208
expected = SuccessfulSmartServerResponse(
209
('ok', 'no', 'no', 'no', network_name))
210
self.assertEqual(expected, request.execute('', network_name, 'True'))
213
class TestSmartServerRequestFindRepository(tests.TestCaseWithMemoryTransport):
60
class TestSmartServerRequestFindRepository(tests.TestCaseWithTransport):
214
61
"""Tests for BzrDir.find_repository."""
216
63
def test_no_repository(self):
217
64
"""When there is no repository to be found, ('norepository', ) is returned."""
218
65
backing = self.get_transport()
219
request = self._request_class(backing)
66
request = smart.bzrdir.SmartServerRequestFindRepository(backing)
220
67
self.make_bzrdir('.')
221
68
self.assertEqual(SmartServerResponse(('norepository', )),
69
request.execute(backing.local_abspath('')))
224
71
def test_nonshared_repository(self):
225
# nonshared repositorys only allow 'find' to return a handle when the
226
# path the repository is being searched on is the same as that that
72
# nonshared repositorys only allow 'find' to return a handle when the
73
# path the repository is being searched on is the same as that that
227
74
# the repository is at.
228
75
backing = self.get_transport()
229
request = self._request_class(backing)
76
request = smart.bzrdir.SmartServerRequestFindRepository(backing)
230
77
result = self._make_repository_and_result()
231
self.assertEqual(result, request.execute(''))
78
self.assertEqual(result, request.execute(backing.local_abspath('')))
232
79
self.make_bzrdir('subdir')
233
80
self.assertEqual(SmartServerResponse(('norepository', )),
234
request.execute('subdir'))
81
request.execute(backing.local_abspath('subdir')))
236
83
def _make_repository_and_result(self, shared=False, format=None):
237
84
"""Convenience function to setup a repository.
250
if (smart.bzrdir.SmartServerRequestFindRepositoryV3 ==
251
self._request_class):
252
return SuccessfulSmartServerResponse(
253
('ok', '', rich_root, subtrees, 'no',
254
repo._format.network_name()))
255
elif (smart.bzrdir.SmartServerRequestFindRepositoryV2 ==
256
self._request_class):
257
# All tests so far are on formats, and for non-external
259
return SuccessfulSmartServerResponse(
260
('ok', '', rich_root, subtrees, 'no'))
262
return SuccessfulSmartServerResponse(('ok', '', rich_root, subtrees))
97
return SmartServerResponse(('ok', '', rich_root, subtrees))
264
99
def test_shared_repository(self):
265
100
"""When there is a shared repository, we get 'ok', 'relpath-to-repo'."""
266
101
backing = self.get_transport()
267
request = self._request_class(backing)
102
request = smart.bzrdir.SmartServerRequestFindRepository(backing)
268
103
result = self._make_repository_and_result(shared=True)
269
self.assertEqual(result, request.execute(''))
104
self.assertEqual(result, request.execute(backing.local_abspath('')))
270
105
self.make_bzrdir('subdir')
271
106
result2 = SmartServerResponse(result.args[0:1] + ('..', ) + result.args[2:])
272
107
self.assertEqual(result2,
273
request.execute('subdir'))
108
request.execute(backing.local_abspath('subdir')))
274
109
self.make_bzrdir('subdir/deeper')
275
110
result3 = SmartServerResponse(result.args[0:1] + ('../..', ) + result.args[2:])
276
111
self.assertEqual(result3,
277
request.execute('subdir/deeper'))
112
request.execute(backing.local_abspath('subdir/deeper')))
279
114
def test_rich_root_and_subtree_encoding(self):
280
115
"""Test for the format attributes for rich root and subtree support."""
281
116
backing = self.get_transport()
282
request = self._request_class(backing)
117
request = smart.bzrdir.SmartServerRequestFindRepository(backing)
283
118
result = self._make_repository_and_result(format='dirstate-with-subtree')
284
119
# check the test will be valid
285
120
self.assertEqual('yes', result.args[2])
286
121
self.assertEqual('yes', result.args[3])
287
self.assertEqual(result, request.execute(''))
289
def test_supports_external_lookups_no_v2(self):
290
"""Test for the supports_external_lookups attribute."""
291
backing = self.get_transport()
292
request = self._request_class(backing)
293
result = self._make_repository_and_result(format='dirstate-with-subtree')
294
# check the test will be valid
295
self.assertEqual('no', result.args[4])
296
self.assertEqual(result, request.execute(''))
299
class TestSmartServerBzrDirRequestGetConfigFile(
300
tests.TestCaseWithMemoryTransport):
301
"""Tests for BzrDir.get_config_file."""
303
def test_present(self):
304
backing = self.get_transport()
305
dir = self.make_bzrdir('.')
306
dir.get_config().set_default_stack_on("/")
307
local_result = dir._get_config()._get_config_file().read()
308
request_class = smart_dir.SmartServerBzrDirRequestConfigFile
309
request = request_class(backing)
310
expected = SuccessfulSmartServerResponse((), local_result)
311
self.assertEqual(expected, request.execute(''))
313
def test_missing(self):
314
backing = self.get_transport()
315
dir = self.make_bzrdir('.')
316
request_class = smart_dir.SmartServerBzrDirRequestConfigFile
317
request = request_class(backing)
318
expected = SuccessfulSmartServerResponse((), '')
319
self.assertEqual(expected, request.execute(''))
322
class TestSmartServerRequestInitializeBzrDir(tests.TestCaseWithMemoryTransport):
122
self.assertEqual(result, request.execute(backing.local_abspath('')))
125
class TestSmartServerRequestInitializeBzrDir(tests.TestCaseWithTransport):
324
127
def test_empty_dir(self):
325
128
"""Initializing an empty dir should succeed and do it."""
326
129
backing = self.get_transport()
327
130
request = smart.bzrdir.SmartServerRequestInitializeBzrDir(backing)
328
131
self.assertEqual(SmartServerResponse(('ok', )),
132
request.execute(backing.local_abspath('.')))
330
133
made_dir = bzrdir.BzrDir.open_from_transport(backing)
331
# no branch, tree or repository is expected with the current
134
# no branch, tree or repository is expected with the current
332
135
# default formart.
333
136
self.assertRaises(errors.NoWorkingTree, made_dir.open_workingtree)
334
137
self.assertRaises(errors.NotBranchError, made_dir.open_branch)
551
266
# there should be no file by default
553
268
self.assertEqual(SmartServerResponse(('ok', ), content),
269
request.execute(backing.local_abspath('')))
556
271
def test_with_content(self):
557
272
# SmartServerBranchGetConfigFile should return the content from
558
273
# branch.control_files.get('branch.conf') for now - in the future it may
559
# perform more complex processing.
274
# perform more complex processing.
560
275
backing = self.get_transport()
561
276
request = smart.branch.SmartServerBranchGetConfigFile(backing)
562
277
branch = self.make_branch('.')
563
branch._transport.put_bytes('branch.conf', 'foo bar baz')
278
branch.control_files.put_utf8('branch.conf', 'foo bar baz')
564
279
self.assertEqual(SmartServerResponse(('ok', ), 'foo bar baz'),
568
class TestLockedBranch(tests.TestCaseWithMemoryTransport):
570
def get_lock_tokens(self, branch):
571
branch_token = branch.lock_write()
572
repo_token = branch.repository.lock_write()
573
branch.repository.unlock()
574
return branch_token, repo_token
577
class TestSmartServerBranchRequestSetConfigOption(TestLockedBranch):
579
def test_value_name(self):
580
branch = self.make_branch('.')
581
request = smart.branch.SmartServerBranchRequestSetConfigOption(
582
branch.bzrdir.root_transport)
583
branch_token, repo_token = self.get_lock_tokens(branch)
584
config = branch._get_config()
585
result = request.execute('', branch_token, repo_token, 'bar', 'foo',
587
self.assertEqual(SuccessfulSmartServerResponse(()), result)
588
self.assertEqual('bar', config.get_option('foo'))
592
def test_value_name_section(self):
593
branch = self.make_branch('.')
594
request = smart.branch.SmartServerBranchRequestSetConfigOption(
595
branch.bzrdir.root_transport)
596
branch_token, repo_token = self.get_lock_tokens(branch)
597
config = branch._get_config()
598
result = request.execute('', branch_token, repo_token, 'bar', 'foo',
600
self.assertEqual(SuccessfulSmartServerResponse(()), result)
601
self.assertEqual('bar', config.get_option('foo', 'gam'))
606
class TestSmartServerBranchRequestSetTagsBytes(TestLockedBranch):
607
# Only called when the branch format and tags match [yay factory
608
# methods] so only need to test straight forward cases.
610
def test_set_bytes(self):
611
base_branch = self.make_branch('base')
612
tag_bytes = base_branch._get_tags_bytes()
613
# get_lock_tokens takes out a lock.
614
branch_token, repo_token = self.get_lock_tokens(base_branch)
615
request = smart.branch.SmartServerBranchSetTagsBytes(
616
self.get_transport())
617
response = request.execute('base', branch_token, repo_token)
618
self.assertEqual(None, response)
619
response = request.do_chunk(tag_bytes)
620
self.assertEqual(None, response)
621
response = request.do_end()
623
SuccessfulSmartServerResponse(()), response)
626
def test_lock_failed(self):
627
base_branch = self.make_branch('base')
628
base_branch.lock_write()
629
tag_bytes = base_branch._get_tags_bytes()
630
request = smart.branch.SmartServerBranchSetTagsBytes(
631
self.get_transport())
632
self.assertRaises(errors.TokenMismatch, request.execute,
633
'base', 'wrong token', 'wrong token')
634
# The request handler will keep processing the message parts, so even
635
# if the request fails immediately do_chunk and do_end are still
637
request.do_chunk(tag_bytes)
643
class SetLastRevisionTestBase(TestLockedBranch):
644
"""Base test case for verbs that implement set_last_revision."""
647
tests.TestCaseWithMemoryTransport.setUp(self)
648
backing_transport = self.get_transport()
649
self.request = self.request_class(backing_transport)
650
self.tree = self.make_branch_and_memory_tree('.')
652
def lock_branch(self):
653
return self.get_lock_tokens(self.tree.branch)
655
def unlock_branch(self):
656
self.tree.branch.unlock()
658
def set_last_revision(self, revision_id, revno):
659
branch_token, repo_token = self.lock_branch()
660
response = self._set_last_revision(
661
revision_id, revno, branch_token, repo_token)
665
def assertRequestSucceeds(self, revision_id, revno):
666
response = self.set_last_revision(revision_id, revno)
667
self.assertEqual(SuccessfulSmartServerResponse(('ok',)), response)
670
class TestSetLastRevisionVerbMixin(object):
671
"""Mixin test case for verbs that implement set_last_revision."""
673
def test_set_null_to_null(self):
674
"""An empty branch can have its last revision set to 'null:'."""
675
self.assertRequestSucceeds('null:', 0)
677
def test_NoSuchRevision(self):
678
"""If the revision_id is not present, the verb returns NoSuchRevision.
680
revision_id = 'non-existent revision'
682
FailedSmartServerResponse(('NoSuchRevision', revision_id)),
683
self.set_last_revision(revision_id, 1))
685
def make_tree_with_two_commits(self):
686
self.tree.lock_write()
688
rev_id_utf8 = u'\xc8'.encode('utf-8')
689
r1 = self.tree.commit('1st commit', rev_id=rev_id_utf8)
690
r2 = self.tree.commit('2nd commit', rev_id='rev-2')
693
def test_branch_last_revision_info_is_updated(self):
694
"""A branch's tip can be set to a revision that is present in its
697
# Make a branch with an empty revision history, but two revisions in
699
self.make_tree_with_two_commits()
700
rev_id_utf8 = u'\xc8'.encode('utf-8')
701
self.tree.branch.set_revision_history([])
703
(0, 'null:'), self.tree.branch.last_revision_info())
704
# We can update the branch to a revision that is present in the
706
self.assertRequestSucceeds(rev_id_utf8, 1)
708
(1, rev_id_utf8), self.tree.branch.last_revision_info())
710
def test_branch_last_revision_info_rewind(self):
711
"""A branch's tip can be set to a revision that is an ancestor of the
714
self.make_tree_with_two_commits()
715
rev_id_utf8 = u'\xc8'.encode('utf-8')
717
(2, 'rev-2'), self.tree.branch.last_revision_info())
718
self.assertRequestSucceeds(rev_id_utf8, 1)
720
(1, rev_id_utf8), self.tree.branch.last_revision_info())
722
def test_TipChangeRejected(self):
723
"""If a pre_change_branch_tip hook raises TipChangeRejected, the verb
724
returns TipChangeRejected.
726
rejection_message = u'rejection message\N{INTERROBANG}'
727
def hook_that_rejects(params):
728
raise errors.TipChangeRejected(rejection_message)
729
Branch.hooks.install_named_hook(
730
'pre_change_branch_tip', hook_that_rejects, None)
732
FailedSmartServerResponse(
733
('TipChangeRejected', rejection_message.encode('utf-8'))),
734
self.set_last_revision('null:', 0))
737
class TestSmartServerBranchRequestSetLastRevision(
738
SetLastRevisionTestBase, TestSetLastRevisionVerbMixin):
739
"""Tests for Branch.set_last_revision verb."""
741
request_class = smart.branch.SmartServerBranchRequestSetLastRevision
743
def _set_last_revision(self, revision_id, revno, branch_token, repo_token):
744
return self.request.execute(
745
'', branch_token, repo_token, revision_id)
748
class TestSmartServerBranchRequestSetLastRevisionInfo(
749
SetLastRevisionTestBase, TestSetLastRevisionVerbMixin):
750
"""Tests for Branch.set_last_revision_info verb."""
752
request_class = smart.branch.SmartServerBranchRequestSetLastRevisionInfo
754
def _set_last_revision(self, revision_id, revno, branch_token, repo_token):
755
return self.request.execute(
756
'', branch_token, repo_token, revno, revision_id)
758
def test_NoSuchRevision(self):
759
"""Branch.set_last_revision_info does not have to return
760
NoSuchRevision if the revision_id is absent.
762
raise tests.TestNotApplicable()
765
class TestSmartServerBranchRequestSetLastRevisionEx(
766
SetLastRevisionTestBase, TestSetLastRevisionVerbMixin):
767
"""Tests for Branch.set_last_revision_ex verb."""
769
request_class = smart.branch.SmartServerBranchRequestSetLastRevisionEx
771
def _set_last_revision(self, revision_id, revno, branch_token, repo_token):
772
return self.request.execute(
773
'', branch_token, repo_token, revision_id, 0, 0)
775
def assertRequestSucceeds(self, revision_id, revno):
776
response = self.set_last_revision(revision_id, revno)
778
SuccessfulSmartServerResponse(('ok', revno, revision_id)),
781
def test_branch_last_revision_info_rewind(self):
782
"""A branch's tip can be set to a revision that is an ancestor of the
783
current tip, but only if allow_overwrite_descendant is passed.
785
self.make_tree_with_two_commits()
786
rev_id_utf8 = u'\xc8'.encode('utf-8')
788
(2, 'rev-2'), self.tree.branch.last_revision_info())
789
# If allow_overwrite_descendant flag is 0, then trying to set the tip
790
# to an older revision ID has no effect.
791
branch_token, repo_token = self.lock_branch()
792
response = self.request.execute(
793
'', branch_token, repo_token, rev_id_utf8, 0, 0)
795
SuccessfulSmartServerResponse(('ok', 2, 'rev-2')),
798
(2, 'rev-2'), self.tree.branch.last_revision_info())
800
# If allow_overwrite_descendant flag is 1, then setting the tip to an
802
response = self.request.execute(
803
'', branch_token, repo_token, rev_id_utf8, 0, 1)
805
SuccessfulSmartServerResponse(('ok', 1, rev_id_utf8)),
809
(1, rev_id_utf8), self.tree.branch.last_revision_info())
811
def make_branch_with_divergent_history(self):
812
"""Make a branch with divergent history in its repo.
814
The branch's tip will be 'child-2', and the repo will also contain
815
'child-1', which diverges from a common base revision.
817
self.tree.lock_write()
819
r1 = self.tree.commit('1st commit')
820
revno_1, revid_1 = self.tree.branch.last_revision_info()
821
r2 = self.tree.commit('2nd commit', rev_id='child-1')
822
# Undo the second commit
823
self.tree.branch.set_last_revision_info(revno_1, revid_1)
824
self.tree.set_parent_ids([revid_1])
825
# Make a new second commit, child-2. child-2 has diverged from
827
new_r2 = self.tree.commit('2nd commit', rev_id='child-2')
830
def test_not_allow_diverged(self):
831
"""If allow_diverged is not passed, then setting a divergent history
832
returns a Diverged error.
834
self.make_branch_with_divergent_history()
836
FailedSmartServerResponse(('Diverged',)),
837
self.set_last_revision('child-1', 2))
838
# The branch tip was not changed.
839
self.assertEqual('child-2', self.tree.branch.last_revision())
841
def test_allow_diverged(self):
842
"""If allow_diverged is passed, then setting a divergent history
845
self.make_branch_with_divergent_history()
846
branch_token, repo_token = self.lock_branch()
847
response = self.request.execute(
848
'', branch_token, repo_token, 'child-1', 1, 0)
850
SuccessfulSmartServerResponse(('ok', 2, 'child-1')),
853
# The branch tip was changed.
854
self.assertEqual('child-1', self.tree.branch.last_revision())
857
class TestSmartServerBranchRequestGetParent(tests.TestCaseWithMemoryTransport):
859
def test_get_parent_none(self):
860
base_branch = self.make_branch('base')
861
request = smart.branch.SmartServerBranchGetParent(self.get_transport())
862
response = request.execute('base')
864
SuccessfulSmartServerResponse(('',)), response)
866
def test_get_parent_something(self):
867
base_branch = self.make_branch('base')
868
base_branch.set_parent(self.get_url('foo'))
869
request = smart.branch.SmartServerBranchGetParent(self.get_transport())
870
response = request.execute('base')
872
SuccessfulSmartServerResponse(("../foo",)),
876
class TestSmartServerBranchRequestSetParent(tests.TestCaseWithMemoryTransport):
878
def test_set_parent_none(self):
879
branch = self.make_branch('base', format="1.9")
881
branch._set_parent_location('foo')
883
request = smart.branch.SmartServerBranchRequestSetParentLocation(
884
self.get_transport())
885
branch_token = branch.lock_write()
886
repo_token = branch.repository.lock_write()
888
response = request.execute('base', branch_token, repo_token, '')
890
branch.repository.unlock()
892
self.assertEqual(SuccessfulSmartServerResponse(()), response)
893
self.assertEqual(None, branch.get_parent())
895
def test_set_parent_something(self):
896
branch = self.make_branch('base', format="1.9")
897
request = smart.branch.SmartServerBranchRequestSetParentLocation(
898
self.get_transport())
899
branch_token = branch.lock_write()
900
repo_token = branch.repository.lock_write()
902
response = request.execute('base', branch_token, repo_token,
905
branch.repository.unlock()
907
self.assertEqual(SuccessfulSmartServerResponse(()), response)
908
self.assertEqual('http://bar/', branch.get_parent())
911
class TestSmartServerBranchRequestGetTagsBytes(tests.TestCaseWithMemoryTransport):
912
# Only called when the branch format and tags match [yay factory
913
# methods] so only need to test straight forward cases.
915
def test_get_bytes(self):
916
base_branch = self.make_branch('base')
917
request = smart.branch.SmartServerBranchGetTagsBytes(
918
self.get_transport())
919
response = request.execute('base')
921
SuccessfulSmartServerResponse(('',)), response)
924
class TestSmartServerBranchRequestGetStackedOnURL(tests.TestCaseWithMemoryTransport):
926
def test_get_stacked_on_url(self):
927
base_branch = self.make_branch('base', format='1.6')
928
stacked_branch = self.make_branch('stacked', format='1.6')
929
# typically should be relative
930
stacked_branch.set_stacked_on_url('../base')
931
request = smart.branch.SmartServerBranchRequestGetStackedOnURL(
932
self.get_transport())
933
response = request.execute('stacked')
935
SmartServerResponse(('ok', '../base')),
939
class TestSmartServerBranchRequestLockWrite(tests.TestCaseWithMemoryTransport):
942
tests.TestCaseWithMemoryTransport.setUp(self)
280
request.execute(backing.local_abspath('')))
283
class TestSmartServerBranchRequestSetLastRevision(tests.TestCaseWithTransport):
285
def test_empty(self):
286
backing = self.get_transport()
287
request = smart.branch.SmartServerBranchRequestSetLastRevision(backing)
288
b = self.make_branch('.')
289
branch_token = b.lock_write()
290
repo_token = b.repository.lock_write()
291
b.repository.unlock()
293
self.assertEqual(SmartServerResponse(('ok',)),
295
backing.local_abspath(''), branch_token, repo_token,
300
def test_not_present_revision_id(self):
301
backing = self.get_transport()
302
request = smart.branch.SmartServerBranchRequestSetLastRevision(backing)
303
b = self.make_branch('.')
304
branch_token = b.lock_write()
305
repo_token = b.repository.lock_write()
306
b.repository.unlock()
308
revision_id = 'non-existent revision'
310
SmartServerResponse(('NoSuchRevision', revision_id)),
312
backing.local_abspath(''), branch_token, repo_token,
317
def test_revision_id_present(self):
318
backing = self.get_transport()
319
request = smart.branch.SmartServerBranchRequestSetLastRevision(backing)
320
tree = self.make_branch_and_memory_tree('.')
323
rev_id_utf8 = u'\xc8'.encode('utf-8')
324
r1 = tree.commit('1st commit', rev_id=rev_id_utf8)
325
r2 = tree.commit('2nd commit')
327
branch_token = tree.branch.lock_write()
328
repo_token = tree.branch.repository.lock_write()
329
tree.branch.repository.unlock()
332
SmartServerResponse(('ok',)),
334
backing.local_abspath(''), branch_token, repo_token,
336
self.assertEqual([rev_id_utf8], tree.branch.revision_history())
340
def test_revision_id_present2(self):
341
backing = self.get_transport()
342
request = smart.branch.SmartServerBranchRequestSetLastRevision(backing)
343
tree = self.make_branch_and_memory_tree('.')
346
rev_id_utf8 = u'\xc8'.encode('utf-8')
347
r1 = tree.commit('1st commit', rev_id=rev_id_utf8)
348
r2 = tree.commit('2nd commit')
350
tree.branch.set_revision_history([])
351
branch_token = tree.branch.lock_write()
352
repo_token = tree.branch.repository.lock_write()
353
tree.branch.repository.unlock()
356
SmartServerResponse(('ok',)),
358
backing.local_abspath(''), branch_token, repo_token,
360
self.assertEqual([rev_id_utf8], tree.branch.revision_history())
365
class TestSmartServerBranchRequestLockWrite(tests.TestCaseWithTransport):
368
tests.TestCaseWithTransport.setUp(self)
369
self.reduceLockdirTimeout()
944
371
def test_lock_write_on_unlocked_branch(self):
945
372
backing = self.get_transport()
946
373
request = smart.branch.SmartServerBranchRequestLockWrite(backing)
947
branch = self.make_branch('.', format='knit')
374
branch = self.make_branch('.')
948
375
repository = branch.repository
949
response = request.execute('')
376
response = request.execute(backing.local_abspath(''))
950
377
branch_nonce = branch.control_files._lock.peek().get('nonce')
951
378
repository_nonce = repository.control_files._lock.peek().get('nonce')
952
379
self.assertEqual(
956
383
# with a new branch object.
957
384
new_branch = repository.bzrdir.open_branch()
958
385
self.assertRaises(errors.LockContention, new_branch.lock_write)
960
request = smart.branch.SmartServerBranchRequestUnlock(backing)
961
response = request.execute('', branch_nonce, repository_nonce)
963
387
def test_lock_write_on_locked_branch(self):
964
388
backing = self.get_transport()
965
389
request = smart.branch.SmartServerBranchRequestLockWrite(backing)
966
390
branch = self.make_branch('.')
967
branch_token = branch.lock_write()
968
392
branch.leave_lock_in_place()
970
response = request.execute('')
394
response = request.execute(backing.local_abspath(''))
971
395
self.assertEqual(
972
396
SmartServerResponse(('LockContention',)), response)
974
branch.lock_write(branch_token)
975
branch.dont_leave_lock_in_place()
978
398
def test_lock_write_with_tokens_on_locked_branch(self):
979
399
backing = self.get_transport()
980
400
request = smart.branch.SmartServerBranchRequestLockWrite(backing)
981
branch = self.make_branch('.', format='knit')
401
branch = self.make_branch('.')
982
402
branch_token = branch.lock_write()
983
403
repo_token = branch.repository.lock_write()
984
404
branch.repository.unlock()
985
405
branch.leave_lock_in_place()
986
406
branch.repository.leave_lock_in_place()
988
response = request.execute('',
408
response = request.execute(backing.local_abspath(''),
989
409
branch_token, repo_token)
990
410
self.assertEqual(
991
411
SmartServerResponse(('ok', branch_token, repo_token)), response)
993
branch.repository.lock_write(repo_token)
994
branch.repository.dont_leave_lock_in_place()
995
branch.repository.unlock()
996
branch.lock_write(branch_token)
997
branch.dont_leave_lock_in_place()
1000
413
def test_lock_write_with_mismatched_tokens_on_locked_branch(self):
1001
414
backing = self.get_transport()
1002
415
request = smart.branch.SmartServerBranchRequestLockWrite(backing)
1003
branch = self.make_branch('.', format='knit')
416
branch = self.make_branch('.')
1004
417
branch_token = branch.lock_write()
1005
418
repo_token = branch.repository.lock_write()
1006
419
branch.repository.unlock()
1007
420
branch.leave_lock_in_place()
1008
421
branch.repository.leave_lock_in_place()
1010
response = request.execute('',
423
response = request.execute(backing.local_abspath(''),
1011
424
branch_token+'xxx', repo_token)
1012
425
self.assertEqual(
1013
426
SmartServerResponse(('TokenMismatch',)), response)
1015
branch.repository.lock_write(repo_token)
1016
branch.repository.dont_leave_lock_in_place()
1017
branch.repository.unlock()
1018
branch.lock_write(branch_token)
1019
branch.dont_leave_lock_in_place()
1022
428
def test_lock_write_on_locked_repo(self):
1023
429
backing = self.get_transport()
1024
430
request = smart.branch.SmartServerBranchRequestLockWrite(backing)
1025
branch = self.make_branch('.', format='knit')
1026
repo = branch.repository
1027
repo_token = repo.lock_write()
1028
repo.leave_lock_in_place()
1030
response = request.execute('')
431
branch = self.make_branch('.')
432
branch.repository.lock_write()
433
branch.repository.leave_lock_in_place()
434
branch.repository.unlock()
435
response = request.execute(backing.local_abspath(''))
1031
436
self.assertEqual(
1032
437
SmartServerResponse(('LockContention',)), response)
1034
repo.lock_write(repo_token)
1035
repo.dont_leave_lock_in_place()
1038
439
def test_lock_write_on_readonly_transport(self):
1039
440
backing = self.get_readonly_transport()
1040
441
request = smart.branch.SmartServerBranchRequestLockWrite(backing)
1041
442
branch = self.make_branch('.')
1042
root = self.get_transport().clone('/')
1043
path = urlutils.relative_url(root.base, self.get_transport().base)
1044
response = request.execute(path)
1045
error_name, lock_str, why_str = response.args
1046
self.assertFalse(response.is_successful())
1047
self.assertEqual('LockFailed', error_name)
1050
class TestSmartServerBranchRequestUnlock(tests.TestCaseWithMemoryTransport):
443
response = request.execute('')
445
SmartServerResponse(('UnlockableTransport',)), response)
448
class TestSmartServerBranchRequestUnlock(tests.TestCaseWithTransport):
1052
450
def setUp(self):
1053
tests.TestCaseWithMemoryTransport.setUp(self)
451
tests.TestCaseWithTransport.setUp(self)
452
self.reduceLockdirTimeout()
1055
454
def test_unlock_on_locked_branch_and_repo(self):
1056
455
backing = self.get_transport()
1057
456
request = smart.branch.SmartServerBranchRequestUnlock(backing)
1058
branch = self.make_branch('.', format='knit')
457
branch = self.make_branch('.')
1059
458
# Lock the branch
1060
459
branch_token = branch.lock_write()
1061
460
repo_token = branch.repository.lock_write()
1195
562
# Note that it still returns body (of zero bytes).
1196
563
self.assertEqual(
1197
564
SmartServerResponse(('nosuchrevision', 'missingrevision', ), ''),
1198
request.execute('', 'missingrevision'))
1201
class TestSmartServerRepositoryGetRevIdForRevno(tests.TestCaseWithMemoryTransport):
1203
def test_revno_found(self):
1204
backing = self.get_transport()
1205
request = smart.repository.SmartServerRepositoryGetRevIdForRevno(backing)
1206
tree = self.make_branch_and_memory_tree('.')
1209
rev1_id_utf8 = u'\xc8'.encode('utf-8')
1210
rev2_id_utf8 = u'\xc9'.encode('utf-8')
1211
tree.commit('1st commit', rev_id=rev1_id_utf8)
1212
tree.commit('2nd commit', rev_id=rev2_id_utf8)
1215
self.assertEqual(SmartServerResponse(('ok', rev1_id_utf8)),
1216
request.execute('', 1, (2, rev2_id_utf8)))
1218
def test_known_revid_missing(self):
1219
backing = self.get_transport()
1220
request = smart.repository.SmartServerRepositoryGetRevIdForRevno(backing)
1221
repo = self.make_repository('.')
1223
FailedSmartServerResponse(('nosuchrevision', 'ghost')),
1224
request.execute('', 1, (2, 'ghost')))
1226
def test_history_incomplete(self):
1227
backing = self.get_transport()
1228
request = smart.repository.SmartServerRepositoryGetRevIdForRevno(backing)
1229
parent = self.make_branch_and_memory_tree('parent', format='1.9')
1231
parent.add([''], ['TREE_ROOT'])
1232
r1 = parent.commit(message='first commit')
1233
r2 = parent.commit(message='second commit')
1235
local = self.make_branch_and_memory_tree('local', format='1.9')
1236
local.branch.pull(parent.branch)
1237
local.set_parent_ids([r2])
1238
r3 = local.commit(message='local commit')
1239
local.branch.create_clone_on_transport(
1240
self.get_transport('stacked'), stacked_on=self.get_url('parent'))
1242
SmartServerResponse(('history-incomplete', 2, r2)),
1243
request.execute('stacked', 1, (3, r3)))
1245
class TestSmartServerRepositoryGetStream(tests.TestCaseWithMemoryTransport):
1247
def make_two_commit_repo(self):
1248
tree = self.make_branch_and_memory_tree('.')
1251
r1 = tree.commit('1st commit')
1252
r2 = tree.commit('2nd commit', rev_id=u'\xc8'.encode('utf-8'))
1254
repo = tree.branch.repository
1257
def test_ancestry_of(self):
1258
"""The search argument may be a 'ancestry-of' some heads'."""
1259
backing = self.get_transport()
1260
request = smart.repository.SmartServerRepositoryGetStream(backing)
1261
repo, r1, r2 = self.make_two_commit_repo()
1262
fetch_spec = ['ancestry-of', r2]
1263
lines = '\n'.join(fetch_spec)
1264
request.execute('', repo._format.network_name())
1265
response = request.do_body(lines)
1266
self.assertEqual(('ok',), response.args)
1267
stream_bytes = ''.join(response.body_stream)
1268
self.assertStartsWith(stream_bytes, 'Bazaar pack format 1')
1270
def test_search(self):
1271
"""The search argument may be a 'search' of some explicit keys."""
1272
backing = self.get_transport()
1273
request = smart.repository.SmartServerRepositoryGetStream(backing)
1274
repo, r1, r2 = self.make_two_commit_repo()
1275
fetch_spec = ['search', '%s %s' % (r1, r2), 'null:', '2']
1276
lines = '\n'.join(fetch_spec)
1277
request.execute('', repo._format.network_name())
1278
response = request.do_body(lines)
1279
self.assertEqual(('ok',), response.args)
1280
stream_bytes = ''.join(response.body_stream)
1281
self.assertStartsWith(stream_bytes, 'Bazaar pack format 1')
1284
class TestSmartServerRequestHasRevision(tests.TestCaseWithMemoryTransport):
565
request.execute(backing.local_abspath(''), 'missingrevision'))
568
class TestSmartServerRequestHasRevision(tests.TestCaseWithTransport):
1286
570
def test_missing_revision(self):
1287
571
"""For a missing revision, ('no', ) is returned."""
1381
670
request = smart.repository.SmartServerRepositoryIsShared(backing)
1382
671
self.make_repository('.', shared=False)
1383
672
self.assertEqual(SmartServerResponse(('no', )),
1384
request.execute('', ))
1387
class TestSmartServerRepositoryLockWrite(tests.TestCaseWithMemoryTransport):
673
request.execute(backing.local_abspath(''), ))
676
class TestSmartServerRepositoryLockWrite(tests.TestCaseWithTransport):
679
tests.TestCaseWithTransport.setUp(self)
680
self.reduceLockdirTimeout()
1389
682
def test_lock_write_on_unlocked_repo(self):
1390
683
backing = self.get_transport()
1391
684
request = smart.repository.SmartServerRepositoryLockWrite(backing)
1392
repository = self.make_repository('.', format='knit')
1393
response = request.execute('')
685
repository = self.make_repository('.')
686
response = request.execute(backing.local_abspath(''))
1394
687
nonce = repository.control_files._lock.peek().get('nonce')
1395
688
self.assertEqual(SmartServerResponse(('ok', nonce)), response)
1396
689
# The repository is now locked. Verify that with a new repository
1398
691
new_repo = repository.bzrdir.open_repository()
1399
692
self.assertRaises(errors.LockContention, new_repo.lock_write)
1401
request = smart.repository.SmartServerRepositoryUnlock(backing)
1402
response = request.execute('', nonce)
1404
694
def test_lock_write_on_locked_repo(self):
1405
695
backing = self.get_transport()
1406
696
request = smart.repository.SmartServerRepositoryLockWrite(backing)
1407
repository = self.make_repository('.', format='knit')
1408
repo_token = repository.lock_write()
697
repository = self.make_repository('.')
698
repository.lock_write()
1409
699
repository.leave_lock_in_place()
1410
700
repository.unlock()
1411
response = request.execute('')
701
response = request.execute(backing.local_abspath(''))
1412
702
self.assertEqual(
1413
703
SmartServerResponse(('LockContention',)), response)
1415
repository.lock_write(repo_token)
1416
repository.dont_leave_lock_in_place()
1419
705
def test_lock_write_on_readonly_transport(self):
1420
706
backing = self.get_readonly_transport()
1421
707
request = smart.repository.SmartServerRepositoryLockWrite(backing)
1422
repository = self.make_repository('.', format='knit')
708
repository = self.make_repository('.')
1423
709
response = request.execute('')
1424
self.assertFalse(response.is_successful())
1425
self.assertEqual('LockFailed', response.args[0])
1428
class TestInsertStreamBase(tests.TestCaseWithMemoryTransport):
1430
def make_empty_byte_stream(self, repo):
1431
byte_stream = smart.repository._stream_to_byte_stream([], repo._format)
1432
return ''.join(byte_stream)
1435
class TestSmartServerRepositoryInsertStream(TestInsertStreamBase):
1437
def test_insert_stream_empty(self):
1438
backing = self.get_transport()
1439
request = smart.repository.SmartServerRepositoryInsertStream(backing)
1440
repository = self.make_repository('.')
1441
response = request.execute('', '')
1442
self.assertEqual(None, response)
1443
response = request.do_chunk(self.make_empty_byte_stream(repository))
1444
self.assertEqual(None, response)
1445
response = request.do_end()
1446
self.assertEqual(SmartServerResponse(('ok', )), response)
1449
class TestSmartServerRepositoryInsertStreamLocked(TestInsertStreamBase):
1451
def test_insert_stream_empty(self):
1452
backing = self.get_transport()
1453
request = smart.repository.SmartServerRepositoryInsertStreamLocked(
1455
repository = self.make_repository('.', format='knit')
1456
lock_token = repository.lock_write()
1457
response = request.execute('', '', lock_token)
1458
self.assertEqual(None, response)
1459
response = request.do_chunk(self.make_empty_byte_stream(repository))
1460
self.assertEqual(None, response)
1461
response = request.do_end()
1462
self.assertEqual(SmartServerResponse(('ok', )), response)
1465
def test_insert_stream_with_wrong_lock_token(self):
1466
backing = self.get_transport()
1467
request = smart.repository.SmartServerRepositoryInsertStreamLocked(
1469
repository = self.make_repository('.', format='knit')
1470
lock_token = repository.lock_write()
1472
errors.TokenMismatch, request.execute, '', '', 'wrong-token')
1476
class TestSmartServerRepositoryUnlock(tests.TestCaseWithMemoryTransport):
711
SmartServerResponse(('UnlockableTransport',)), response)
714
class TestSmartServerRepositoryUnlock(tests.TestCaseWithTransport):
1478
716
def setUp(self):
1479
tests.TestCaseWithMemoryTransport.setUp(self)
717
tests.TestCaseWithTransport.setUp(self)
718
self.reduceLockdirTimeout()
1481
720
def test_unlock_on_locked_repo(self):
1482
721
backing = self.get_transport()
1483
722
request = smart.repository.SmartServerRepositoryUnlock(backing)
1484
repository = self.make_repository('.', format='knit')
723
repository = self.make_repository('.')
1485
724
token = repository.lock_write()
1486
725
repository.leave_lock_in_place()
1487
726
repository.unlock()
1488
response = request.execute('', token)
727
response = request.execute(backing.local_abspath(''), token)
1489
728
self.assertEqual(
1490
729
SmartServerResponse(('ok',)), response)
1491
730
# The repository is now unlocked. Verify that with a new repository
1520
783
SmartServerResponse(('yes',)), response)
1523
class TestSmartServerRepositorySetMakeWorkingTrees(tests.TestCaseWithMemoryTransport):
1525
def test_set_false(self):
1526
backing = self.get_transport()
1527
repo = self.make_repository('.', shared=True)
1528
repo.set_make_working_trees(True)
1529
request_class = smart.repository.SmartServerRepositorySetMakeWorkingTrees
1530
request = request_class(backing)
1531
self.assertEqual(SuccessfulSmartServerResponse(('ok',)),
1532
request.execute('', 'False'))
1533
repo = repo.bzrdir.open_repository()
1534
self.assertFalse(repo.make_working_trees())
1536
def test_set_true(self):
1537
backing = self.get_transport()
1538
repo = self.make_repository('.', shared=True)
1539
repo.set_make_working_trees(False)
1540
request_class = smart.repository.SmartServerRepositorySetMakeWorkingTrees
1541
request = request_class(backing)
1542
self.assertEqual(SuccessfulSmartServerResponse(('ok',)),
1543
request.execute('', 'True'))
1544
repo = repo.bzrdir.open_repository()
1545
self.assertTrue(repo.make_working_trees())
1548
class TestSmartServerPackRepositoryAutopack(tests.TestCaseWithTransport):
1550
def make_repo_needing_autopacking(self, path='.'):
1551
# Make a repo in need of autopacking.
1552
tree = self.make_branch_and_tree('.', format='pack-0.92')
1553
repo = tree.branch.repository
1554
# monkey-patch the pack collection to disable autopacking
1555
repo._pack_collection._max_pack_count = lambda count: count
1557
tree.commit('commit %s' % x)
1558
self.assertEqual(10, len(repo._pack_collection.names()))
1559
del repo._pack_collection._max_pack_count
1562
def test_autopack_needed(self):
1563
repo = self.make_repo_needing_autopacking()
1565
self.addCleanup(repo.unlock)
1566
backing = self.get_transport()
1567
request = smart.packrepository.SmartServerPackRepositoryAutopack(
1569
response = request.execute('')
1570
self.assertEqual(SmartServerResponse(('ok',)), response)
1571
repo._pack_collection.reload_pack_names()
1572
self.assertEqual(1, len(repo._pack_collection.names()))
1574
def test_autopack_not_needed(self):
1575
tree = self.make_branch_and_tree('.', format='pack-0.92')
1576
repo = tree.branch.repository
1578
self.addCleanup(repo.unlock)
1580
tree.commit('commit %s' % x)
1581
backing = self.get_transport()
1582
request = smart.packrepository.SmartServerPackRepositoryAutopack(
1584
response = request.execute('')
1585
self.assertEqual(SmartServerResponse(('ok',)), response)
1586
repo._pack_collection.reload_pack_names()
1587
self.assertEqual(9, len(repo._pack_collection.names()))
1589
def test_autopack_on_nonpack_format(self):
1590
"""A request to autopack a non-pack repo is a no-op."""
1591
repo = self.make_repository('.', format='knit')
1592
backing = self.get_transport()
1593
request = smart.packrepository.SmartServerPackRepositoryAutopack(
1595
response = request.execute('')
1596
self.assertEqual(SmartServerResponse(('ok',)), response)
1599
786
class TestHandlers(tests.TestCase):
1600
787
"""Tests for the request.request_handlers object."""
1602
def test_all_registrations_exist(self):
1603
"""All registered request_handlers can be found."""
1604
# If there's a typo in a register_lazy call, this loop will fail with
1605
# an AttributeError.
1606
for key, item in smart.request.request_handlers.iteritems():
1609
def assertHandlerEqual(self, verb, handler):
1610
self.assertEqual(smart.request.request_handlers.get(verb), handler)
1612
789
def test_registered_methods(self):
1613
790
"""Test that known methods are registered to the correct object."""
1614
self.assertHandlerEqual('Branch.get_config_file',
792
smart.request.request_handlers.get('Branch.get_config_file'),
1615
793
smart.branch.SmartServerBranchGetConfigFile)
1616
self.assertHandlerEqual('Branch.get_parent',
1617
smart.branch.SmartServerBranchGetParent)
1618
self.assertHandlerEqual('Branch.get_tags_bytes',
1619
smart.branch.SmartServerBranchGetTagsBytes)
1620
self.assertHandlerEqual('Branch.lock_write',
795
smart.request.request_handlers.get('Branch.lock_write'),
1621
796
smart.branch.SmartServerBranchRequestLockWrite)
1622
self.assertHandlerEqual('Branch.last_revision_info',
798
smart.request.request_handlers.get('Branch.last_revision_info'),
1623
799
smart.branch.SmartServerBranchRequestLastRevisionInfo)
1624
self.assertHandlerEqual('Branch.revision_history',
801
smart.request.request_handlers.get('Branch.revision_history'),
1625
802
smart.branch.SmartServerRequestRevisionHistory)
1626
self.assertHandlerEqual('Branch.set_config_option',
1627
smart.branch.SmartServerBranchRequestSetConfigOption)
1628
self.assertHandlerEqual('Branch.set_last_revision',
804
smart.request.request_handlers.get('Branch.set_last_revision'),
1629
805
smart.branch.SmartServerBranchRequestSetLastRevision)
1630
self.assertHandlerEqual('Branch.set_last_revision_info',
1631
smart.branch.SmartServerBranchRequestSetLastRevisionInfo)
1632
self.assertHandlerEqual('Branch.set_last_revision_ex',
1633
smart.branch.SmartServerBranchRequestSetLastRevisionEx)
1634
self.assertHandlerEqual('Branch.set_parent_location',
1635
smart.branch.SmartServerBranchRequestSetParentLocation)
1636
self.assertHandlerEqual('Branch.unlock',
807
smart.request.request_handlers.get('Branch.unlock'),
1637
808
smart.branch.SmartServerBranchRequestUnlock)
1638
self.assertHandlerEqual('BzrDir.find_repository',
1639
smart.bzrdir.SmartServerRequestFindRepositoryV1)
1640
self.assertHandlerEqual('BzrDir.find_repositoryV2',
1641
smart.bzrdir.SmartServerRequestFindRepositoryV2)
1642
self.assertHandlerEqual('BzrDirFormat.initialize',
810
smart.request.request_handlers.get('BzrDir.find_repository'),
811
smart.bzrdir.SmartServerRequestFindRepository)
813
smart.request.request_handlers.get('BzrDirFormat.initialize'),
1643
814
smart.bzrdir.SmartServerRequestInitializeBzrDir)
1644
self.assertHandlerEqual('BzrDirFormat.initialize_ex_1.16',
1645
smart.bzrdir.SmartServerRequestBzrDirInitializeEx)
1646
self.assertHandlerEqual('BzrDir.cloning_metadir',
1647
smart.bzrdir.SmartServerBzrDirRequestCloningMetaDir)
1648
self.assertHandlerEqual('BzrDir.get_config_file',
1649
smart.bzrdir.SmartServerBzrDirRequestConfigFile)
1650
self.assertHandlerEqual('BzrDir.open_branch',
816
smart.request.request_handlers.get('BzrDir.open_branch'),
1651
817
smart.bzrdir.SmartServerRequestOpenBranch)
1652
self.assertHandlerEqual('BzrDir.open_branchV2',
1653
smart.bzrdir.SmartServerRequestOpenBranchV2)
1654
self.assertHandlerEqual('PackRepository.autopack',
1655
smart.packrepository.SmartServerPackRepositoryAutopack)
1656
self.assertHandlerEqual('Repository.gather_stats',
819
smart.request.request_handlers.get('Repository.gather_stats'),
1657
820
smart.repository.SmartServerRepositoryGatherStats)
1658
self.assertHandlerEqual('Repository.get_parent_map',
1659
smart.repository.SmartServerRepositoryGetParentMap)
1660
self.assertHandlerEqual('Repository.get_rev_id_for_revno',
1661
smart.repository.SmartServerRepositoryGetRevIdForRevno)
1662
self.assertHandlerEqual('Repository.get_revision_graph',
822
smart.request.request_handlers.get('Repository.get_revision_graph'),
1663
823
smart.repository.SmartServerRepositoryGetRevisionGraph)
1664
self.assertHandlerEqual('Repository.get_stream',
1665
smart.repository.SmartServerRepositoryGetStream)
1666
self.assertHandlerEqual('Repository.has_revision',
825
smart.request.request_handlers.get('Repository.has_revision'),
1667
826
smart.repository.SmartServerRequestHasRevision)
1668
self.assertHandlerEqual('Repository.insert_stream',
1669
smart.repository.SmartServerRepositoryInsertStream)
1670
self.assertHandlerEqual('Repository.insert_stream_locked',
1671
smart.repository.SmartServerRepositoryInsertStreamLocked)
1672
self.assertHandlerEqual('Repository.is_shared',
828
smart.request.request_handlers.get('Repository.is_shared'),
1673
829
smart.repository.SmartServerRepositoryIsShared)
1674
self.assertHandlerEqual('Repository.lock_write',
831
smart.request.request_handlers.get('Repository.lock_write'),
1675
832
smart.repository.SmartServerRepositoryLockWrite)
1676
self.assertHandlerEqual('Repository.tarball',
834
smart.request.request_handlers.get('Repository.unlock'),
835
smart.repository.SmartServerRepositoryUnlock)
837
smart.request.request_handlers.get('Repository.tarball'),
1677
838
smart.repository.SmartServerRepositoryTarball)
1678
self.assertHandlerEqual('Repository.unlock',
1679
smart.repository.SmartServerRepositoryUnlock)
1680
self.assertHandlerEqual('Transport.is_readonly',
840
smart.request.request_handlers.get('Transport.is_readonly'),
1681
841
smart.request.SmartServerIsReadonly)