56
127
self.assertNotEqual(None,
57
128
SmartServerResponse(('ok', )))
60
class TestSmartServerRequestFindRepository(tests.TestCaseWithTransport):
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('pack-0.92')()
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):
61
214
"""Tests for BzrDir.find_repository."""
63
216
def test_no_repository(self):
64
217
"""When there is no repository to be found, ('norepository', ) is returned."""
65
218
backing = self.get_transport()
66
request = smart.bzrdir.SmartServerRequestFindRepository(backing)
219
request = self._request_class(backing)
67
220
self.make_bzrdir('.')
68
221
self.assertEqual(SmartServerResponse(('norepository', )),
69
request.execute(backing.local_abspath('')))
71
224
def test_nonshared_repository(self):
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
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
74
227
# the repository is at.
75
228
backing = self.get_transport()
76
request = smart.bzrdir.SmartServerRequestFindRepository(backing)
229
request = self._request_class(backing)
77
230
result = self._make_repository_and_result()
78
self.assertEqual(result, request.execute(backing.local_abspath('')))
231
self.assertEqual(result, request.execute(''))
79
232
self.make_bzrdir('subdir')
80
233
self.assertEqual(SmartServerResponse(('norepository', )),
81
request.execute(backing.local_abspath('subdir')))
234
request.execute('subdir'))
83
236
def _make_repository_and_result(self, shared=False, format=None):
84
237
"""Convenience function to setup a repository.
97
return SmartServerResponse(('ok', '', rich_root, subtrees))
250
if repo._format.supports_external_lookups:
254
if (smart.bzrdir.SmartServerRequestFindRepositoryV3 ==
255
self._request_class):
256
return SuccessfulSmartServerResponse(
257
('ok', '', rich_root, subtrees, external,
258
repo._format.network_name()))
259
elif (smart.bzrdir.SmartServerRequestFindRepositoryV2 ==
260
self._request_class):
261
# All tests so far are on formats, and for non-external
263
return SuccessfulSmartServerResponse(
264
('ok', '', rich_root, subtrees, external))
266
return SuccessfulSmartServerResponse(('ok', '', rich_root, subtrees))
99
268
def test_shared_repository(self):
100
269
"""When there is a shared repository, we get 'ok', 'relpath-to-repo'."""
101
270
backing = self.get_transport()
102
request = smart.bzrdir.SmartServerRequestFindRepository(backing)
271
request = self._request_class(backing)
103
272
result = self._make_repository_and_result(shared=True)
104
self.assertEqual(result, request.execute(backing.local_abspath('')))
273
self.assertEqual(result, request.execute(''))
105
274
self.make_bzrdir('subdir')
106
275
result2 = SmartServerResponse(result.args[0:1] + ('..', ) + result.args[2:])
107
276
self.assertEqual(result2,
108
request.execute(backing.local_abspath('subdir')))
277
request.execute('subdir'))
109
278
self.make_bzrdir('subdir/deeper')
110
279
result3 = SmartServerResponse(result.args[0:1] + ('../..', ) + result.args[2:])
111
280
self.assertEqual(result3,
112
request.execute(backing.local_abspath('subdir/deeper')))
281
request.execute('subdir/deeper'))
114
283
def test_rich_root_and_subtree_encoding(self):
115
284
"""Test for the format attributes for rich root and subtree support."""
116
285
backing = self.get_transport()
117
request = smart.bzrdir.SmartServerRequestFindRepository(backing)
286
request = self._request_class(backing)
118
287
result = self._make_repository_and_result(format='dirstate-with-subtree')
119
288
# check the test will be valid
120
289
self.assertEqual('yes', result.args[2])
121
290
self.assertEqual('yes', result.args[3])
122
self.assertEqual(result, request.execute(backing.local_abspath('')))
125
class TestSmartServerRequestInitializeBzrDir(tests.TestCaseWithTransport):
291
self.assertEqual(result, request.execute(''))
293
def test_supports_external_lookups_no_v2(self):
294
"""Test for the supports_external_lookups attribute."""
295
backing = self.get_transport()
296
request = self._request_class(backing)
297
result = self._make_repository_and_result(format='dirstate-with-subtree')
298
# check the test will be valid
299
self.assertEqual('no', result.args[4])
300
self.assertEqual(result, request.execute(''))
303
class TestSmartServerBzrDirRequestGetConfigFile(
304
tests.TestCaseWithMemoryTransport):
305
"""Tests for BzrDir.get_config_file."""
307
def test_present(self):
308
backing = self.get_transport()
309
dir = self.make_bzrdir('.')
310
dir.get_config().set_default_stack_on("/")
311
local_result = dir._get_config()._get_config_file().read()
312
request_class = smart_dir.SmartServerBzrDirRequestConfigFile
313
request = request_class(backing)
314
expected = SuccessfulSmartServerResponse((), local_result)
315
self.assertEqual(expected, request.execute(''))
317
def test_missing(self):
318
backing = self.get_transport()
319
dir = self.make_bzrdir('.')
320
request_class = smart_dir.SmartServerBzrDirRequestConfigFile
321
request = request_class(backing)
322
expected = SuccessfulSmartServerResponse((), '')
323
self.assertEqual(expected, request.execute(''))
326
class TestSmartServerRequestInitializeBzrDir(tests.TestCaseWithMemoryTransport):
127
328
def test_empty_dir(self):
128
329
"""Initializing an empty dir should succeed and do it."""
129
330
backing = self.get_transport()
130
331
request = smart.bzrdir.SmartServerRequestInitializeBzrDir(backing)
131
332
self.assertEqual(SmartServerResponse(('ok', )),
132
request.execute(backing.local_abspath('.')))
133
334
made_dir = bzrdir.BzrDir.open_from_transport(backing)
134
# no branch, tree or repository is expected with the current
335
# no branch, tree or repository is expected with the current
135
336
# default formart.
136
337
self.assertRaises(errors.NoWorkingTree, made_dir.open_workingtree)
137
338
self.assertRaises(errors.NotBranchError, made_dir.open_branch)
266
555
# there should be no file by default
268
557
self.assertEqual(SmartServerResponse(('ok', ), content),
269
request.execute(backing.local_abspath('')))
271
560
def test_with_content(self):
272
561
# SmartServerBranchGetConfigFile should return the content from
273
562
# branch.control_files.get('branch.conf') for now - in the future it may
274
# perform more complex processing.
563
# perform more complex processing.
275
564
backing = self.get_transport()
276
565
request = smart.branch.SmartServerBranchGetConfigFile(backing)
277
566
branch = self.make_branch('.')
278
branch.control_files.put_utf8('branch.conf', 'foo bar baz')
567
branch._transport.put_bytes('branch.conf', 'foo bar baz')
279
568
self.assertEqual(SmartServerResponse(('ok', ), 'foo bar baz'),
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()
572
class TestLockedBranch(tests.TestCaseWithMemoryTransport):
574
def get_lock_tokens(self, branch):
575
branch_token = branch.lock_write()
576
repo_token = branch.repository.lock_write()
577
branch.repository.unlock()
578
return branch_token, repo_token
581
class TestSmartServerBranchRequestSetConfigOption(TestLockedBranch):
583
def test_value_name(self):
584
branch = self.make_branch('.')
585
request = smart.branch.SmartServerBranchRequestSetConfigOption(
586
branch.bzrdir.root_transport)
587
branch_token, repo_token = self.get_lock_tokens(branch)
588
config = branch._get_config()
589
result = request.execute('', branch_token, repo_token, 'bar', 'foo',
591
self.assertEqual(SuccessfulSmartServerResponse(()), result)
592
self.assertEqual('bar', config.get_option('foo'))
596
def test_value_name_section(self):
597
branch = self.make_branch('.')
598
request = smart.branch.SmartServerBranchRequestSetConfigOption(
599
branch.bzrdir.root_transport)
600
branch_token, repo_token = self.get_lock_tokens(branch)
601
config = branch._get_config()
602
result = request.execute('', branch_token, repo_token, 'bar', 'foo',
604
self.assertEqual(SuccessfulSmartServerResponse(()), result)
605
self.assertEqual('bar', config.get_option('foo', 'gam'))
610
class TestSmartServerBranchRequestSetTagsBytes(TestLockedBranch):
611
# Only called when the branch format and tags match [yay factory
612
# methods] so only need to test straight forward cases.
614
def test_set_bytes(self):
615
base_branch = self.make_branch('base')
616
tag_bytes = base_branch._get_tags_bytes()
617
# get_lock_tokens takes out a lock.
618
branch_token, repo_token = self.get_lock_tokens(base_branch)
619
request = smart.branch.SmartServerBranchSetTagsBytes(
620
self.get_transport())
621
response = request.execute('base', branch_token, repo_token)
622
self.assertEqual(None, response)
623
response = request.do_chunk(tag_bytes)
624
self.assertEqual(None, response)
625
response = request.do_end()
627
SuccessfulSmartServerResponse(()), response)
630
def test_lock_failed(self):
631
base_branch = self.make_branch('base')
632
base_branch.lock_write()
633
tag_bytes = base_branch._get_tags_bytes()
634
request = smart.branch.SmartServerBranchSetTagsBytes(
635
self.get_transport())
636
self.assertRaises(errors.TokenMismatch, request.execute,
637
'base', 'wrong token', 'wrong token')
638
# The request handler will keep processing the message parts, so even
639
# if the request fails immediately do_chunk and do_end are still
641
request.do_chunk(tag_bytes)
647
class SetLastRevisionTestBase(TestLockedBranch):
648
"""Base test case for verbs that implement set_last_revision."""
651
tests.TestCaseWithMemoryTransport.setUp(self)
652
backing_transport = self.get_transport()
653
self.request = self.request_class(backing_transport)
654
self.tree = self.make_branch_and_memory_tree('.')
656
def lock_branch(self):
657
return self.get_lock_tokens(self.tree.branch)
659
def unlock_branch(self):
660
self.tree.branch.unlock()
662
def set_last_revision(self, revision_id, revno):
663
branch_token, repo_token = self.lock_branch()
664
response = self._set_last_revision(
665
revision_id, revno, branch_token, repo_token)
669
def assertRequestSucceeds(self, revision_id, revno):
670
response = self.set_last_revision(revision_id, revno)
671
self.assertEqual(SuccessfulSmartServerResponse(('ok',)), response)
674
class TestSetLastRevisionVerbMixin(object):
675
"""Mixin test case for verbs that implement set_last_revision."""
677
def test_set_null_to_null(self):
678
"""An empty branch can have its last revision set to 'null:'."""
679
self.assertRequestSucceeds('null:', 0)
681
def test_NoSuchRevision(self):
682
"""If the revision_id is not present, the verb returns NoSuchRevision.
684
revision_id = 'non-existent revision'
686
FailedSmartServerResponse(('NoSuchRevision', revision_id)),
687
self.set_last_revision(revision_id, 1))
689
def make_tree_with_two_commits(self):
690
self.tree.lock_write()
692
rev_id_utf8 = u'\xc8'.encode('utf-8')
693
r1 = self.tree.commit('1st commit', rev_id=rev_id_utf8)
694
r2 = self.tree.commit('2nd commit', rev_id='rev-2')
697
def test_branch_last_revision_info_is_updated(self):
698
"""A branch's tip can be set to a revision that is present in its
701
# Make a branch with an empty revision history, but two revisions in
703
self.make_tree_with_two_commits()
704
rev_id_utf8 = u'\xc8'.encode('utf-8')
705
self.tree.branch.set_revision_history([])
707
(0, 'null:'), self.tree.branch.last_revision_info())
708
# We can update the branch to a revision that is present in the
710
self.assertRequestSucceeds(rev_id_utf8, 1)
712
(1, rev_id_utf8), self.tree.branch.last_revision_info())
714
def test_branch_last_revision_info_rewind(self):
715
"""A branch's tip can be set to a revision that is an ancestor of the
718
self.make_tree_with_two_commits()
719
rev_id_utf8 = u'\xc8'.encode('utf-8')
721
(2, 'rev-2'), self.tree.branch.last_revision_info())
722
self.assertRequestSucceeds(rev_id_utf8, 1)
724
(1, rev_id_utf8), self.tree.branch.last_revision_info())
726
def test_TipChangeRejected(self):
727
"""If a pre_change_branch_tip hook raises TipChangeRejected, the verb
728
returns TipChangeRejected.
730
rejection_message = u'rejection message\N{INTERROBANG}'
731
def hook_that_rejects(params):
732
raise errors.TipChangeRejected(rejection_message)
733
Branch.hooks.install_named_hook(
734
'pre_change_branch_tip', hook_that_rejects, None)
736
FailedSmartServerResponse(
737
('TipChangeRejected', rejection_message.encode('utf-8'))),
738
self.set_last_revision('null:', 0))
741
class TestSmartServerBranchRequestSetLastRevision(
742
SetLastRevisionTestBase, TestSetLastRevisionVerbMixin):
743
"""Tests for Branch.set_last_revision verb."""
745
request_class = smart.branch.SmartServerBranchRequestSetLastRevision
747
def _set_last_revision(self, revision_id, revno, branch_token, repo_token):
748
return self.request.execute(
749
'', branch_token, repo_token, revision_id)
752
class TestSmartServerBranchRequestSetLastRevisionInfo(
753
SetLastRevisionTestBase, TestSetLastRevisionVerbMixin):
754
"""Tests for Branch.set_last_revision_info verb."""
756
request_class = smart.branch.SmartServerBranchRequestSetLastRevisionInfo
758
def _set_last_revision(self, revision_id, revno, branch_token, repo_token):
759
return self.request.execute(
760
'', branch_token, repo_token, revno, revision_id)
762
def test_NoSuchRevision(self):
763
"""Branch.set_last_revision_info does not have to return
764
NoSuchRevision if the revision_id is absent.
766
raise tests.TestNotApplicable()
769
class TestSmartServerBranchRequestSetLastRevisionEx(
770
SetLastRevisionTestBase, TestSetLastRevisionVerbMixin):
771
"""Tests for Branch.set_last_revision_ex verb."""
773
request_class = smart.branch.SmartServerBranchRequestSetLastRevisionEx
775
def _set_last_revision(self, revision_id, revno, branch_token, repo_token):
776
return self.request.execute(
777
'', branch_token, repo_token, revision_id, 0, 0)
779
def assertRequestSucceeds(self, revision_id, revno):
780
response = self.set_last_revision(revision_id, revno)
782
SuccessfulSmartServerResponse(('ok', revno, revision_id)),
785
def test_branch_last_revision_info_rewind(self):
786
"""A branch's tip can be set to a revision that is an ancestor of the
787
current tip, but only if allow_overwrite_descendant is passed.
789
self.make_tree_with_two_commits()
790
rev_id_utf8 = u'\xc8'.encode('utf-8')
792
(2, 'rev-2'), self.tree.branch.last_revision_info())
793
# If allow_overwrite_descendant flag is 0, then trying to set the tip
794
# to an older revision ID has no effect.
795
branch_token, repo_token = self.lock_branch()
796
response = self.request.execute(
797
'', branch_token, repo_token, rev_id_utf8, 0, 0)
799
SuccessfulSmartServerResponse(('ok', 2, 'rev-2')),
802
(2, 'rev-2'), self.tree.branch.last_revision_info())
804
# If allow_overwrite_descendant flag is 1, then setting the tip to an
806
response = self.request.execute(
807
'', branch_token, repo_token, rev_id_utf8, 0, 1)
809
SuccessfulSmartServerResponse(('ok', 1, rev_id_utf8)),
813
(1, rev_id_utf8), self.tree.branch.last_revision_info())
815
def make_branch_with_divergent_history(self):
816
"""Make a branch with divergent history in its repo.
818
The branch's tip will be 'child-2', and the repo will also contain
819
'child-1', which diverges from a common base revision.
821
self.tree.lock_write()
823
r1 = self.tree.commit('1st commit')
824
revno_1, revid_1 = self.tree.branch.last_revision_info()
825
r2 = self.tree.commit('2nd commit', rev_id='child-1')
826
# Undo the second commit
827
self.tree.branch.set_last_revision_info(revno_1, revid_1)
828
self.tree.set_parent_ids([revid_1])
829
# Make a new second commit, child-2. child-2 has diverged from
831
new_r2 = self.tree.commit('2nd commit', rev_id='child-2')
834
def test_not_allow_diverged(self):
835
"""If allow_diverged is not passed, then setting a divergent history
836
returns a Diverged error.
838
self.make_branch_with_divergent_history()
840
FailedSmartServerResponse(('Diverged',)),
841
self.set_last_revision('child-1', 2))
842
# The branch tip was not changed.
843
self.assertEqual('child-2', self.tree.branch.last_revision())
845
def test_allow_diverged(self):
846
"""If allow_diverged is passed, then setting a divergent history
849
self.make_branch_with_divergent_history()
850
branch_token, repo_token = self.lock_branch()
851
response = self.request.execute(
852
'', branch_token, repo_token, 'child-1', 1, 0)
854
SuccessfulSmartServerResponse(('ok', 2, 'child-1')),
857
# The branch tip was changed.
858
self.assertEqual('child-1', self.tree.branch.last_revision())
861
class TestSmartServerBranchRequestGetParent(tests.TestCaseWithMemoryTransport):
863
def test_get_parent_none(self):
864
base_branch = self.make_branch('base')
865
request = smart.branch.SmartServerBranchGetParent(self.get_transport())
866
response = request.execute('base')
868
SuccessfulSmartServerResponse(('',)), response)
870
def test_get_parent_something(self):
871
base_branch = self.make_branch('base')
872
base_branch.set_parent(self.get_url('foo'))
873
request = smart.branch.SmartServerBranchGetParent(self.get_transport())
874
response = request.execute('base')
876
SuccessfulSmartServerResponse(("../foo",)),
880
class TestSmartServerBranchRequestSetParent(tests.TestCaseWithMemoryTransport):
882
def test_set_parent_none(self):
883
branch = self.make_branch('base', format="1.9")
885
branch._set_parent_location('foo')
887
request = smart.branch.SmartServerBranchRequestSetParentLocation(
888
self.get_transport())
889
branch_token = branch.lock_write()
890
repo_token = branch.repository.lock_write()
892
response = request.execute('base', branch_token, repo_token, '')
894
branch.repository.unlock()
896
self.assertEqual(SuccessfulSmartServerResponse(()), response)
897
self.assertEqual(None, branch.get_parent())
899
def test_set_parent_something(self):
900
branch = self.make_branch('base', format="1.9")
901
request = smart.branch.SmartServerBranchRequestSetParentLocation(
902
self.get_transport())
903
branch_token = branch.lock_write()
904
repo_token = branch.repository.lock_write()
906
response = request.execute('base', branch_token, repo_token,
909
branch.repository.unlock()
911
self.assertEqual(SuccessfulSmartServerResponse(()), response)
912
self.assertEqual('http://bar/', branch.get_parent())
915
class TestSmartServerBranchRequestGetTagsBytes(tests.TestCaseWithMemoryTransport):
916
# Only called when the branch format and tags match [yay factory
917
# methods] so only need to test straight forward cases.
919
def test_get_bytes(self):
920
base_branch = self.make_branch('base')
921
request = smart.branch.SmartServerBranchGetTagsBytes(
922
self.get_transport())
923
response = request.execute('base')
925
SuccessfulSmartServerResponse(('',)), response)
928
class TestSmartServerBranchRequestGetStackedOnURL(tests.TestCaseWithMemoryTransport):
930
def test_get_stacked_on_url(self):
931
base_branch = self.make_branch('base', format='1.6')
932
stacked_branch = self.make_branch('stacked', format='1.6')
933
# typically should be relative
934
stacked_branch.set_stacked_on_url('../base')
935
request = smart.branch.SmartServerBranchRequestGetStackedOnURL(
936
self.get_transport())
937
response = request.execute('stacked')
939
SmartServerResponse(('ok', '../base')),
943
class TestSmartServerBranchRequestLockWrite(tests.TestCaseWithMemoryTransport):
946
tests.TestCaseWithMemoryTransport.setUp(self)
371
948
def test_lock_write_on_unlocked_branch(self):
372
949
backing = self.get_transport()
373
950
request = smart.branch.SmartServerBranchRequestLockWrite(backing)
374
branch = self.make_branch('.')
951
branch = self.make_branch('.', format='knit')
375
952
repository = branch.repository
376
response = request.execute(backing.local_abspath(''))
953
response = request.execute('')
377
954
branch_nonce = branch.control_files._lock.peek().get('nonce')
378
955
repository_nonce = repository.control_files._lock.peek().get('nonce')
379
956
self.assertEqual(
383
960
# with a new branch object.
384
961
new_branch = repository.bzrdir.open_branch()
385
962
self.assertRaises(errors.LockContention, new_branch.lock_write)
964
request = smart.branch.SmartServerBranchRequestUnlock(backing)
965
response = request.execute('', branch_nonce, repository_nonce)
387
967
def test_lock_write_on_locked_branch(self):
388
968
backing = self.get_transport()
389
969
request = smart.branch.SmartServerBranchRequestLockWrite(backing)
390
970
branch = self.make_branch('.')
971
branch_token = branch.lock_write()
392
972
branch.leave_lock_in_place()
394
response = request.execute(backing.local_abspath(''))
974
response = request.execute('')
395
975
self.assertEqual(
396
976
SmartServerResponse(('LockContention',)), response)
978
branch.lock_write(branch_token)
979
branch.dont_leave_lock_in_place()
398
982
def test_lock_write_with_tokens_on_locked_branch(self):
399
983
backing = self.get_transport()
400
984
request = smart.branch.SmartServerBranchRequestLockWrite(backing)
401
branch = self.make_branch('.')
985
branch = self.make_branch('.', format='knit')
402
986
branch_token = branch.lock_write()
403
987
repo_token = branch.repository.lock_write()
404
988
branch.repository.unlock()
405
989
branch.leave_lock_in_place()
406
990
branch.repository.leave_lock_in_place()
408
response = request.execute(backing.local_abspath(''),
992
response = request.execute('',
409
993
branch_token, repo_token)
410
994
self.assertEqual(
411
995
SmartServerResponse(('ok', branch_token, repo_token)), response)
997
branch.repository.lock_write(repo_token)
998
branch.repository.dont_leave_lock_in_place()
999
branch.repository.unlock()
1000
branch.lock_write(branch_token)
1001
branch.dont_leave_lock_in_place()
413
1004
def test_lock_write_with_mismatched_tokens_on_locked_branch(self):
414
1005
backing = self.get_transport()
415
1006
request = smart.branch.SmartServerBranchRequestLockWrite(backing)
416
branch = self.make_branch('.')
1007
branch = self.make_branch('.', format='knit')
417
1008
branch_token = branch.lock_write()
418
1009
repo_token = branch.repository.lock_write()
419
1010
branch.repository.unlock()
420
1011
branch.leave_lock_in_place()
421
1012
branch.repository.leave_lock_in_place()
423
response = request.execute(backing.local_abspath(''),
1014
response = request.execute('',
424
1015
branch_token+'xxx', repo_token)
425
1016
self.assertEqual(
426
1017
SmartServerResponse(('TokenMismatch',)), response)
1019
branch.repository.lock_write(repo_token)
1020
branch.repository.dont_leave_lock_in_place()
1021
branch.repository.unlock()
1022
branch.lock_write(branch_token)
1023
branch.dont_leave_lock_in_place()
428
1026
def test_lock_write_on_locked_repo(self):
429
1027
backing = self.get_transport()
430
1028
request = smart.branch.SmartServerBranchRequestLockWrite(backing)
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(''))
1029
branch = self.make_branch('.', format='knit')
1030
repo = branch.repository
1031
repo_token = repo.lock_write()
1032
repo.leave_lock_in_place()
1034
response = request.execute('')
436
1035
self.assertEqual(
437
1036
SmartServerResponse(('LockContention',)), response)
1038
repo.lock_write(repo_token)
1039
repo.dont_leave_lock_in_place()
439
1042
def test_lock_write_on_readonly_transport(self):
440
1043
backing = self.get_readonly_transport()
441
1044
request = smart.branch.SmartServerBranchRequestLockWrite(backing)
442
1045
branch = self.make_branch('.')
443
response = request.execute('')
445
SmartServerResponse(('UnlockableTransport',)), response)
448
class TestSmartServerBranchRequestUnlock(tests.TestCaseWithTransport):
1046
root = self.get_transport().clone('/')
1047
path = urlutils.relative_url(root.base, self.get_transport().base)
1048
response = request.execute(path)
1049
error_name, lock_str, why_str = response.args
1050
self.assertFalse(response.is_successful())
1051
self.assertEqual('LockFailed', error_name)
1054
class TestSmartServerBranchRequestUnlock(tests.TestCaseWithMemoryTransport):
450
1056
def setUp(self):
451
tests.TestCaseWithTransport.setUp(self)
452
self.reduceLockdirTimeout()
1057
tests.TestCaseWithMemoryTransport.setUp(self)
454
1059
def test_unlock_on_locked_branch_and_repo(self):
455
1060
backing = self.get_transport()
456
1061
request = smart.branch.SmartServerBranchRequestUnlock(backing)
457
branch = self.make_branch('.')
1062
branch = self.make_branch('.', format='knit')
458
1063
# Lock the branch
459
1064
branch_token = branch.lock_write()
460
1065
repo_token = branch.repository.lock_write()
562
1199
# Note that it still returns body (of zero bytes).
563
1200
self.assertEqual(
564
1201
SmartServerResponse(('nosuchrevision', 'missingrevision', ), ''),
565
request.execute(backing.local_abspath(''), 'missingrevision'))
568
class TestSmartServerRequestHasRevision(tests.TestCaseWithTransport):
1202
request.execute('', 'missingrevision'))
1205
class TestSmartServerRepositoryGetRevIdForRevno(tests.TestCaseWithMemoryTransport):
1207
def test_revno_found(self):
1208
backing = self.get_transport()
1209
request = smart.repository.SmartServerRepositoryGetRevIdForRevno(backing)
1210
tree = self.make_branch_and_memory_tree('.')
1213
rev1_id_utf8 = u'\xc8'.encode('utf-8')
1214
rev2_id_utf8 = u'\xc9'.encode('utf-8')
1215
tree.commit('1st commit', rev_id=rev1_id_utf8)
1216
tree.commit('2nd commit', rev_id=rev2_id_utf8)
1219
self.assertEqual(SmartServerResponse(('ok', rev1_id_utf8)),
1220
request.execute('', 1, (2, rev2_id_utf8)))
1222
def test_known_revid_missing(self):
1223
backing = self.get_transport()
1224
request = smart.repository.SmartServerRepositoryGetRevIdForRevno(backing)
1225
repo = self.make_repository('.')
1227
FailedSmartServerResponse(('nosuchrevision', 'ghost')),
1228
request.execute('', 1, (2, 'ghost')))
1230
def test_history_incomplete(self):
1231
backing = self.get_transport()
1232
request = smart.repository.SmartServerRepositoryGetRevIdForRevno(backing)
1233
parent = self.make_branch_and_memory_tree('parent', format='1.9')
1235
parent.add([''], ['TREE_ROOT'])
1236
r1 = parent.commit(message='first commit')
1237
r2 = parent.commit(message='second commit')
1239
local = self.make_branch_and_memory_tree('local', format='1.9')
1240
local.branch.pull(parent.branch)
1241
local.set_parent_ids([r2])
1242
r3 = local.commit(message='local commit')
1243
local.branch.create_clone_on_transport(
1244
self.get_transport('stacked'), stacked_on=self.get_url('parent'))
1246
SmartServerResponse(('history-incomplete', 2, r2)),
1247
request.execute('stacked', 1, (3, r3)))
1250
class TestSmartServerRepositoryGetStream(tests.TestCaseWithMemoryTransport):
1252
def make_two_commit_repo(self):
1253
tree = self.make_branch_and_memory_tree('.')
1256
r1 = tree.commit('1st commit')
1257
r2 = tree.commit('2nd commit', rev_id=u'\xc8'.encode('utf-8'))
1259
repo = tree.branch.repository
1262
def test_ancestry_of(self):
1263
"""The search argument may be a 'ancestry-of' some heads'."""
1264
backing = self.get_transport()
1265
request = smart.repository.SmartServerRepositoryGetStream(backing)
1266
repo, r1, r2 = self.make_two_commit_repo()
1267
fetch_spec = ['ancestry-of', r2]
1268
lines = '\n'.join(fetch_spec)
1269
request.execute('', repo._format.network_name())
1270
response = request.do_body(lines)
1271
self.assertEqual(('ok',), response.args)
1272
stream_bytes = ''.join(response.body_stream)
1273
self.assertStartsWith(stream_bytes, 'Bazaar pack format 1')
1275
def test_search(self):
1276
"""The search argument may be a 'search' of some explicit keys."""
1277
backing = self.get_transport()
1278
request = smart.repository.SmartServerRepositoryGetStream(backing)
1279
repo, r1, r2 = self.make_two_commit_repo()
1280
fetch_spec = ['search', '%s %s' % (r1, r2), 'null:', '2']
1281
lines = '\n'.join(fetch_spec)
1282
request.execute('', repo._format.network_name())
1283
response = request.do_body(lines)
1284
self.assertEqual(('ok',), response.args)
1285
stream_bytes = ''.join(response.body_stream)
1286
self.assertStartsWith(stream_bytes, 'Bazaar pack format 1')
1289
class TestSmartServerRequestHasRevision(tests.TestCaseWithMemoryTransport):
570
1291
def test_missing_revision(self):
571
1292
"""For a missing revision, ('no', ) is returned."""
670
1386
request = smart.repository.SmartServerRepositoryIsShared(backing)
671
1387
self.make_repository('.', shared=False)
672
1388
self.assertEqual(SmartServerResponse(('no', )),
673
request.execute(backing.local_abspath(''), ))
676
class TestSmartServerRepositoryLockWrite(tests.TestCaseWithTransport):
679
tests.TestCaseWithTransport.setUp(self)
680
self.reduceLockdirTimeout()
1389
request.execute('', ))
1392
class TestSmartServerRepositoryLockWrite(tests.TestCaseWithMemoryTransport):
682
1394
def test_lock_write_on_unlocked_repo(self):
683
1395
backing = self.get_transport()
684
1396
request = smart.repository.SmartServerRepositoryLockWrite(backing)
685
repository = self.make_repository('.')
686
response = request.execute(backing.local_abspath(''))
1397
repository = self.make_repository('.', format='knit')
1398
response = request.execute('')
687
1399
nonce = repository.control_files._lock.peek().get('nonce')
688
1400
self.assertEqual(SmartServerResponse(('ok', nonce)), response)
689
1401
# The repository is now locked. Verify that with a new repository
691
1403
new_repo = repository.bzrdir.open_repository()
692
1404
self.assertRaises(errors.LockContention, new_repo.lock_write)
1406
request = smart.repository.SmartServerRepositoryUnlock(backing)
1407
response = request.execute('', nonce)
694
1409
def test_lock_write_on_locked_repo(self):
695
1410
backing = self.get_transport()
696
1411
request = smart.repository.SmartServerRepositoryLockWrite(backing)
697
repository = self.make_repository('.')
698
repository.lock_write()
1412
repository = self.make_repository('.', format='knit')
1413
repo_token = repository.lock_write()
699
1414
repository.leave_lock_in_place()
700
1415
repository.unlock()
701
response = request.execute(backing.local_abspath(''))
1416
response = request.execute('')
702
1417
self.assertEqual(
703
1418
SmartServerResponse(('LockContention',)), response)
1420
repository.lock_write(repo_token)
1421
repository.dont_leave_lock_in_place()
705
1424
def test_lock_write_on_readonly_transport(self):
706
1425
backing = self.get_readonly_transport()
707
1426
request = smart.repository.SmartServerRepositoryLockWrite(backing)
1427
repository = self.make_repository('.', format='knit')
1428
response = request.execute('')
1429
self.assertFalse(response.is_successful())
1430
self.assertEqual('LockFailed', response.args[0])
1433
class TestInsertStreamBase(tests.TestCaseWithMemoryTransport):
1435
def make_empty_byte_stream(self, repo):
1436
byte_stream = smart.repository._stream_to_byte_stream([], repo._format)
1437
return ''.join(byte_stream)
1440
class TestSmartServerRepositoryInsertStream(TestInsertStreamBase):
1442
def test_insert_stream_empty(self):
1443
backing = self.get_transport()
1444
request = smart.repository.SmartServerRepositoryInsertStream(backing)
708
1445
repository = self.make_repository('.')
709
response = request.execute('')
711
SmartServerResponse(('UnlockableTransport',)), response)
714
class TestSmartServerRepositoryUnlock(tests.TestCaseWithTransport):
1446
response = request.execute('', '')
1447
self.assertEqual(None, response)
1448
response = request.do_chunk(self.make_empty_byte_stream(repository))
1449
self.assertEqual(None, response)
1450
response = request.do_end()
1451
self.assertEqual(SmartServerResponse(('ok', )), response)
1454
class TestSmartServerRepositoryInsertStreamLocked(TestInsertStreamBase):
1456
def test_insert_stream_empty(self):
1457
backing = self.get_transport()
1458
request = smart.repository.SmartServerRepositoryInsertStreamLocked(
1460
repository = self.make_repository('.', format='knit')
1461
lock_token = repository.lock_write()
1462
response = request.execute('', '', lock_token)
1463
self.assertEqual(None, response)
1464
response = request.do_chunk(self.make_empty_byte_stream(repository))
1465
self.assertEqual(None, response)
1466
response = request.do_end()
1467
self.assertEqual(SmartServerResponse(('ok', )), response)
1470
def test_insert_stream_with_wrong_lock_token(self):
1471
backing = self.get_transport()
1472
request = smart.repository.SmartServerRepositoryInsertStreamLocked(
1474
repository = self.make_repository('.', format='knit')
1475
lock_token = repository.lock_write()
1477
errors.TokenMismatch, request.execute, '', '', 'wrong-token')
1481
class TestSmartServerRepositoryUnlock(tests.TestCaseWithMemoryTransport):
716
1483
def setUp(self):
717
tests.TestCaseWithTransport.setUp(self)
718
self.reduceLockdirTimeout()
1484
tests.TestCaseWithMemoryTransport.setUp(self)
720
1486
def test_unlock_on_locked_repo(self):
721
1487
backing = self.get_transport()
722
1488
request = smart.repository.SmartServerRepositoryUnlock(backing)
723
repository = self.make_repository('.')
1489
repository = self.make_repository('.', format='knit')
724
1490
token = repository.lock_write()
725
1491
repository.leave_lock_in_place()
726
1492
repository.unlock()
727
response = request.execute(backing.local_abspath(''), token)
1493
response = request.execute('', token)
728
1494
self.assertEqual(
729
1495
SmartServerResponse(('ok',)), response)
730
1496
# The repository is now unlocked. Verify that with a new repository
783
1525
SmartServerResponse(('yes',)), response)
1528
class TestSmartServerRepositorySetMakeWorkingTrees(tests.TestCaseWithMemoryTransport):
1530
def test_set_false(self):
1531
backing = self.get_transport()
1532
repo = self.make_repository('.', shared=True)
1533
repo.set_make_working_trees(True)
1534
request_class = smart.repository.SmartServerRepositorySetMakeWorkingTrees
1535
request = request_class(backing)
1536
self.assertEqual(SuccessfulSmartServerResponse(('ok',)),
1537
request.execute('', 'False'))
1538
repo = repo.bzrdir.open_repository()
1539
self.assertFalse(repo.make_working_trees())
1541
def test_set_true(self):
1542
backing = self.get_transport()
1543
repo = self.make_repository('.', shared=True)
1544
repo.set_make_working_trees(False)
1545
request_class = smart.repository.SmartServerRepositorySetMakeWorkingTrees
1546
request = request_class(backing)
1547
self.assertEqual(SuccessfulSmartServerResponse(('ok',)),
1548
request.execute('', 'True'))
1549
repo = repo.bzrdir.open_repository()
1550
self.assertTrue(repo.make_working_trees())
1553
class TestSmartServerPackRepositoryAutopack(tests.TestCaseWithTransport):
1555
def make_repo_needing_autopacking(self, path='.'):
1556
# Make a repo in need of autopacking.
1557
tree = self.make_branch_and_tree('.', format='pack-0.92')
1558
repo = tree.branch.repository
1559
# monkey-patch the pack collection to disable autopacking
1560
repo._pack_collection._max_pack_count = lambda count: count
1562
tree.commit('commit %s' % x)
1563
self.assertEqual(10, len(repo._pack_collection.names()))
1564
del repo._pack_collection._max_pack_count
1567
def test_autopack_needed(self):
1568
repo = self.make_repo_needing_autopacking()
1570
self.addCleanup(repo.unlock)
1571
backing = self.get_transport()
1572
request = smart.packrepository.SmartServerPackRepositoryAutopack(
1574
response = request.execute('')
1575
self.assertEqual(SmartServerResponse(('ok',)), response)
1576
repo._pack_collection.reload_pack_names()
1577
self.assertEqual(1, len(repo._pack_collection.names()))
1579
def test_autopack_not_needed(self):
1580
tree = self.make_branch_and_tree('.', format='pack-0.92')
1581
repo = tree.branch.repository
1583
self.addCleanup(repo.unlock)
1585
tree.commit('commit %s' % x)
1586
backing = self.get_transport()
1587
request = smart.packrepository.SmartServerPackRepositoryAutopack(
1589
response = request.execute('')
1590
self.assertEqual(SmartServerResponse(('ok',)), response)
1591
repo._pack_collection.reload_pack_names()
1592
self.assertEqual(9, len(repo._pack_collection.names()))
1594
def test_autopack_on_nonpack_format(self):
1595
"""A request to autopack a non-pack repo is a no-op."""
1596
repo = self.make_repository('.', format='knit')
1597
backing = self.get_transport()
1598
request = smart.packrepository.SmartServerPackRepositoryAutopack(
1600
response = request.execute('')
1601
self.assertEqual(SmartServerResponse(('ok',)), response)
786
1604
class TestHandlers(tests.TestCase):
787
1605
"""Tests for the request.request_handlers object."""
1607
def test_all_registrations_exist(self):
1608
"""All registered request_handlers can be found."""
1609
# If there's a typo in a register_lazy call, this loop will fail with
1610
# an AttributeError.
1611
for key, item in smart.request.request_handlers.iteritems():
1614
def assertHandlerEqual(self, verb, handler):
1615
self.assertEqual(smart.request.request_handlers.get(verb), handler)
789
1617
def test_registered_methods(self):
790
1618
"""Test that known methods are registered to the correct object."""
792
smart.request.request_handlers.get('Branch.get_config_file'),
1619
self.assertHandlerEqual('Branch.get_config_file',
793
1620
smart.branch.SmartServerBranchGetConfigFile)
795
smart.request.request_handlers.get('Branch.lock_write'),
1621
self.assertHandlerEqual('Branch.get_parent',
1622
smart.branch.SmartServerBranchGetParent)
1623
self.assertHandlerEqual('Branch.get_tags_bytes',
1624
smart.branch.SmartServerBranchGetTagsBytes)
1625
self.assertHandlerEqual('Branch.lock_write',
796
1626
smart.branch.SmartServerBranchRequestLockWrite)
798
smart.request.request_handlers.get('Branch.last_revision_info'),
1627
self.assertHandlerEqual('Branch.last_revision_info',
799
1628
smart.branch.SmartServerBranchRequestLastRevisionInfo)
801
smart.request.request_handlers.get('Branch.revision_history'),
1629
self.assertHandlerEqual('Branch.revision_history',
802
1630
smart.branch.SmartServerRequestRevisionHistory)
804
smart.request.request_handlers.get('Branch.set_last_revision'),
1631
self.assertHandlerEqual('Branch.set_config_option',
1632
smart.branch.SmartServerBranchRequestSetConfigOption)
1633
self.assertHandlerEqual('Branch.set_last_revision',
805
1634
smart.branch.SmartServerBranchRequestSetLastRevision)
807
smart.request.request_handlers.get('Branch.unlock'),
1635
self.assertHandlerEqual('Branch.set_last_revision_info',
1636
smart.branch.SmartServerBranchRequestSetLastRevisionInfo)
1637
self.assertHandlerEqual('Branch.set_last_revision_ex',
1638
smart.branch.SmartServerBranchRequestSetLastRevisionEx)
1639
self.assertHandlerEqual('Branch.set_parent_location',
1640
smart.branch.SmartServerBranchRequestSetParentLocation)
1641
self.assertHandlerEqual('Branch.unlock',
808
1642
smart.branch.SmartServerBranchRequestUnlock)
810
smart.request.request_handlers.get('BzrDir.find_repository'),
811
smart.bzrdir.SmartServerRequestFindRepository)
813
smart.request.request_handlers.get('BzrDirFormat.initialize'),
1643
self.assertHandlerEqual('BzrDir.find_repository',
1644
smart.bzrdir.SmartServerRequestFindRepositoryV1)
1645
self.assertHandlerEqual('BzrDir.find_repositoryV2',
1646
smart.bzrdir.SmartServerRequestFindRepositoryV2)
1647
self.assertHandlerEqual('BzrDirFormat.initialize',
814
1648
smart.bzrdir.SmartServerRequestInitializeBzrDir)
816
smart.request.request_handlers.get('BzrDir.open_branch'),
1649
self.assertHandlerEqual('BzrDirFormat.initialize_ex_1.16',
1650
smart.bzrdir.SmartServerRequestBzrDirInitializeEx)
1651
self.assertHandlerEqual('BzrDir.cloning_metadir',
1652
smart.bzrdir.SmartServerBzrDirRequestCloningMetaDir)
1653
self.assertHandlerEqual('BzrDir.get_config_file',
1654
smart.bzrdir.SmartServerBzrDirRequestConfigFile)
1655
self.assertHandlerEqual('BzrDir.open_branch',
817
1656
smart.bzrdir.SmartServerRequestOpenBranch)
819
smart.request.request_handlers.get('Repository.gather_stats'),
1657
self.assertHandlerEqual('BzrDir.open_branchV2',
1658
smart.bzrdir.SmartServerRequestOpenBranchV2)
1659
self.assertHandlerEqual('PackRepository.autopack',
1660
smart.packrepository.SmartServerPackRepositoryAutopack)
1661
self.assertHandlerEqual('Repository.gather_stats',
820
1662
smart.repository.SmartServerRepositoryGatherStats)
822
smart.request.request_handlers.get('Repository.get_revision_graph'),
1663
self.assertHandlerEqual('Repository.get_parent_map',
1664
smart.repository.SmartServerRepositoryGetParentMap)
1665
self.assertHandlerEqual('Repository.get_rev_id_for_revno',
1666
smart.repository.SmartServerRepositoryGetRevIdForRevno)
1667
self.assertHandlerEqual('Repository.get_revision_graph',
823
1668
smart.repository.SmartServerRepositoryGetRevisionGraph)
825
smart.request.request_handlers.get('Repository.has_revision'),
1669
self.assertHandlerEqual('Repository.get_stream',
1670
smart.repository.SmartServerRepositoryGetStream)
1671
self.assertHandlerEqual('Repository.has_revision',
826
1672
smart.repository.SmartServerRequestHasRevision)
828
smart.request.request_handlers.get('Repository.is_shared'),
1673
self.assertHandlerEqual('Repository.insert_stream',
1674
smart.repository.SmartServerRepositoryInsertStream)
1675
self.assertHandlerEqual('Repository.insert_stream_locked',
1676
smart.repository.SmartServerRepositoryInsertStreamLocked)
1677
self.assertHandlerEqual('Repository.is_shared',
829
1678
smart.repository.SmartServerRepositoryIsShared)
831
smart.request.request_handlers.get('Repository.lock_write'),
1679
self.assertHandlerEqual('Repository.lock_write',
832
1680
smart.repository.SmartServerRepositoryLockWrite)
834
smart.request.request_handlers.get('Repository.unlock'),
1681
self.assertHandlerEqual('Repository.tarball',
1682
smart.repository.SmartServerRepositoryTarball)
1683
self.assertHandlerEqual('Repository.unlock',
835
1684
smart.repository.SmartServerRepositoryUnlock)
837
smart.request.request_handlers.get('Repository.tarball'),
838
smart.repository.SmartServerRepositoryTarball)
840
smart.request.request_handlers.get('Transport.is_readonly'),
1685
self.assertHandlerEqual('Transport.is_readonly',
841
1686
smart.request.SmartServerIsReadonly)