253
257
# upwards without agreement from bzr's network support maintainers.
254
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)
256
276
def test_push_smart_with_default_stacking_url_path_segment(self):
257
277
# If the default stacked-on location is a path element then branches
258
278
# we push there over the smart server are stacked and their
319
339
# The push should have created target/a
320
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')
322
353
def test_push_onto_repo(self):
323
354
"""We should be able to 'bzr push' into an existing bzrdir."""
324
355
tree = self.create_simple_tree()
577
608
tests.TestCaseWithTransport.setUp(self)
578
609
self.memory_server = RedirectingMemoryServer()
579
self.memory_server.setUp()
580
self.addCleanup(self.memory_server.tearDown)
610
self.start_server(self.memory_server)
582
611
# Make the branch and tree that we'll be pushing.
583
612
t = self.make_branch_and_tree('tree')
584
613
self.build_tree(['tree/file'])
683
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
684
715
getattr(self, self._changes_type)()
686
717
def _uncommitted_changes(self):
741
772
self.set_config_push_strict('oFF')
742
773
self.assertPushFails(['--strict'])
743
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")