239
243
remote = branch.Branch.open('public')
240
244
self.assertEndsWith(remote.get_stacked_on_url(), '/parent')
246
def test_push_smart_tags_streaming_acceptance(self):
247
self.setup_smart_server_with_call_log()
248
t = self.make_branch_and_tree('from')
249
rev_id = t.commit(allow_pointless=True, message='first commit')
250
t.branch.tags.set_tag('new-tag', rev_id)
251
self.reset_smart_call_log()
252
self.run_bzr(['push', self.get_url('to-one')], working_dir='from')
253
# This figure represent the amount of work to perform this use case. It
254
# is entirely ok to reduce this number if a test fails due to rpc_count
255
# being too low. If rpc_count increases, more network roundtrips have
256
# become necessary for this use case. Please do not adjust this number
257
# upwards without agreement from bzr's network support maintainers.
258
self.assertLength(11, self.hpss_calls)
260
def test_push_smart_incremental_acceptance(self):
261
self.setup_smart_server_with_call_log()
262
t = self.make_branch_and_tree('from')
263
rev_id1 = t.commit(allow_pointless=True, message='first commit')
264
rev_id2 = t.commit(allow_pointless=True, message='second commit')
266
['push', self.get_url('to-one'), '-r1'], working_dir='from')
267
self.reset_smart_call_log()
268
self.run_bzr(['push', self.get_url('to-one')], working_dir='from')
269
# This figure represent the amount of work to perform this use case. It
270
# is entirely ok to reduce this number if a test fails due to rpc_count
271
# being too low. If rpc_count increases, more network roundtrips have
272
# become necessary for this use case. Please do not adjust this number
273
# upwards without agreement from bzr's network support maintainers.
274
self.assertLength(11, self.hpss_calls)
242
276
def test_push_smart_with_default_stacking_url_path_segment(self):
243
277
# If the default stacked-on location is a path element then branches
244
278
# we push there over the smart server are stacked and their
305
339
# The push should have created target/a
306
340
self.failUnlessExists('target/a')
342
def test_push_use_existing_into_empty_bzrdir(self):
343
"""'bzr push --use-existing-dir' into a dir with an empty .bzr dir
346
tree = self.create_simple_tree()
347
self.build_tree(['target/', 'target/.bzr/'])
349
['Target directory ../target already contains a .bzr directory, '
350
'but it is not valid.'],
351
'push ../target --use-existing-dir', working_dir='tree')
308
353
def test_push_onto_repo(self):
309
354
"""We should be able to 'bzr push' into an existing bzrdir."""
310
355
tree = self.create_simple_tree()
563
608
tests.TestCaseWithTransport.setUp(self)
564
609
self.memory_server = RedirectingMemoryServer()
565
self.memory_server.setUp()
566
self.addCleanup(self.memory_server.tearDown)
610
self.start_server(self.memory_server)
568
611
# Make the branch and tree that we'll be pushing.
569
612
t = self.make_branch_and_tree('tree')
570
613
self.build_tree(['tree/file'])
669
712
super(TestPushStrictWithChanges, self).setUp()
713
# Apply the changes defined in load_tests: one of _uncommitted_changes,
714
# _pending_merges or _out_of_sync_trees
670
715
getattr(self, self._changes_type)()
672
717
def _uncommitted_changes(self):
727
772
self.set_config_push_strict('oFF')
728
773
self.assertPushFails(['--strict'])
729
774
self.assertPushSucceeds([])
777
class TestPushForeign(blackbox.ExternalBase):
780
super(TestPushForeign, self).setUp()
781
test_foreign.register_dummy_foreign_for_test(self)
783
def make_dummy_builder(self, relpath):
784
builder = self.make_branch_builder(
785
relpath, format=test_foreign.DummyForeignVcsDirFormat())
786
builder.build_snapshot('revid', None,
787
[('add', ('', 'TREE_ROOT', 'directory', None)),
788
('add', ('foo', 'fooid', 'file', 'bar'))])
791
def test_no_roundtripping(self):
792
target_branch = self.make_dummy_builder('dp').get_branch()
793
source_tree = self.make_branch_and_tree("dc")
794
output, error = self.run_bzr("push -d dc dp", retcode=3)
795
self.assertEquals("", output)
796
self.assertEquals(error, "bzr: ERROR: It is not possible to losslessly"
797
" push to dummy. You may want to use dpush instead.\n")