253
258
# upwards without agreement from bzr's network support maintainers.
254
259
self.assertLength(11, self.hpss_calls)
261
def test_push_smart_incremental_acceptance(self):
262
self.setup_smart_server_with_call_log()
263
t = self.make_branch_and_tree('from')
264
rev_id1 = t.commit(allow_pointless=True, message='first commit')
265
rev_id2 = t.commit(allow_pointless=True, message='second commit')
267
['push', self.get_url('to-one'), '-r1'], working_dir='from')
268
self.reset_smart_call_log()
269
self.run_bzr(['push', self.get_url('to-one')], working_dir='from')
270
# This figure represent the amount of work to perform this use case. It
271
# is entirely ok to reduce this number if a test fails due to rpc_count
272
# being too low. If rpc_count increases, more network roundtrips have
273
# become necessary for this use case. Please do not adjust this number
274
# upwards without agreement from bzr's network support maintainers.
275
self.assertLength(11, self.hpss_calls)
256
277
def test_push_smart_with_default_stacking_url_path_segment(self):
257
278
# If the default stacked-on location is a path element then branches
258
279
# we push there over the smart server are stacked and their
319
340
# The push should have created target/a
320
341
self.failUnlessExists('target/a')
343
def test_push_use_existing_into_empty_bzrdir(self):
344
"""'bzr push --use-existing-dir' into a dir with an empty .bzr dir
347
tree = self.create_simple_tree()
348
self.build_tree(['target/', 'target/.bzr/'])
350
['Target directory ../target already contains a .bzr directory, '
351
'but it is not valid.'],
352
'push ../target --use-existing-dir', working_dir='tree')
322
354
def test_push_onto_repo(self):
323
355
"""We should be able to 'bzr push' into an existing bzrdir."""
324
356
tree = self.create_simple_tree()
577
609
tests.TestCaseWithTransport.setUp(self)
578
610
self.memory_server = RedirectingMemoryServer()
579
self.memory_server.setUp()
580
self.addCleanup(self.memory_server.tearDown)
611
self.start_server(self.memory_server)
582
612
# Make the branch and tree that we'll be pushing.
583
613
t = self.make_branch_and_tree('tree')
584
614
self.build_tree(['tree/file'])
683
713
super(TestPushStrictWithChanges, self).setUp()
714
# Apply the changes defined in load_tests: one of _uncommitted_changes,
715
# _pending_merges or _out_of_sync_trees
684
716
getattr(self, self._changes_type)()
686
718
def _uncommitted_changes(self):
741
773
self.set_config_push_strict('oFF')
742
774
self.assertPushFails(['--strict'])
743
775
self.assertPushSucceeds([])
778
class TestPushForeign(blackbox.ExternalBase):
781
super(TestPushForeign, self).setUp()
782
test_foreign.register_dummy_foreign_for_test(self)
784
def make_dummy_builder(self, relpath):
785
builder = self.make_branch_builder(
786
relpath, format=test_foreign.DummyForeignVcsDirFormat())
787
builder.build_snapshot('revid', None,
788
[('add', ('', 'TREE_ROOT', 'directory', None)),
789
('add', ('foo', 'fooid', 'file', 'bar'))])
792
def test_no_roundtripping(self):
793
target_branch = self.make_dummy_builder('dp').get_branch()
794
source_tree = self.make_branch_and_tree("dc")
795
output, error = self.run_bzr("push -d dc dp", retcode=3)
796
self.assertEquals("", output)
797
self.assertEquals(error, "bzr: ERROR: It is not possible to losslessly"
798
" push to dummy. You may want to use dpush instead.\n")