104
104
transport.delete('branch_b/c')
105
105
out, err = self.run_bzr('push', working_dir='branch_a')
106
106
path = branch_a.get_push_location()
107
self.assertEquals(out,
108
'Using saved push location: %s\n'
109
% urlutils.local_path_from_url(path))
107
110
self.assertEqual(err,
108
'Using saved push location: %s\n'
109
111
'All changes applied successfully.\n'
110
'Pushed up to revision 2.\n'
111
% urlutils.local_path_from_url(path))
112
'Pushed up to revision 2.\n')
112
113
self.assertEqual(path,
113
114
branch_b.bzrdir.root_transport.base)
114
115
# test explicit --remember
134
135
out, err = self.run_bzr('push --no-tree -d push-from push-to')
135
136
self.assertEqual('', out)
136
137
self.assertEqual('Created new branch.\n', err)
137
self.assertPathDoesNotExist('push-to/file')
138
self.failIfExists('push-to/file')
139
140
def test_push_new_branch_revision_count(self):
140
141
# bzr push of a branch with revisions to a new location
148
149
self.assertEqual('', out)
149
150
self.assertEqual('Created new branch.\n', err)
151
def test_push_quiet(self):
152
# test that using -q makes output quiet
153
t = self.make_branch_and_tree('tree')
154
self.build_tree(['tree/file'])
157
self.run_bzr('push -d tree pushed-to')
158
path = t.branch.get_push_location()
159
out, err = self.run_bzr('push', working_dir="tree")
160
self.assertEqual('Using saved push location: %s\n'
161
'No new revisions or tags to push.\n' %
162
urlutils.local_path_from_url(path), err)
163
out, err = self.run_bzr('push -q', working_dir="tree")
164
self.assertEqual('', out)
165
self.assertEqual('', err)
167
152
def test_push_only_pushes_history(self):
168
153
# Knit branches should only push the history for the current revision.
169
154
format = bzrdir.BzrDirMetaFormat1()
214
199
t.commit(allow_pointless=True,
215
200
message='first commit')
216
201
self.run_bzr('push -d from to-one')
217
self.assertPathExists('to-one')
202
self.failUnlessExists('to-one')
218
203
self.run_bzr('push -d %s %s'
219
204
% tuple(map(urlutils.local_path_to_url, ['from', 'to-two'])))
220
self.assertPathExists('to-two')
222
def test_push_repository_no_branch_doesnt_fetch_all_revs(self):
223
# See https://bugs.launchpad.net/bzr/+bug/465517
224
target_repo = self.make_repository('target')
225
source = self.make_branch_builder('source')
226
source.start_series()
227
source.build_snapshot('A', None, [
228
('add', ('', 'root-id', 'directory', None))])
229
source.build_snapshot('B', ['A'], [])
230
source.build_snapshot('C', ['A'], [])
231
source.finish_series()
232
self.run_bzr('push target -d source')
233
self.addCleanup(target_repo.lock_read().unlock)
234
# We should have pushed 'C', but not 'B', since it isn't in the
236
self.assertEqual([('A',), ('C',)], sorted(target_repo.revisions.keys()))
205
self.failUnlessExists('to-two')
238
207
def test_push_smart_non_stacked_streaming_acceptance(self):
239
208
self.setup_smart_server_with_call_log()
339
308
working_dir='tree')
340
309
new_tree = workingtree.WorkingTree.open('new/tree')
341
310
self.assertEqual(tree.last_revision(), new_tree.last_revision())
342
self.assertPathExists('new/tree/a')
311
self.failUnlessExists('new/tree/a')
344
313
def test_push_use_existing(self):
345
314
"""'bzr push --use-existing-dir' can push into an existing dir.
360
329
new_tree = workingtree.WorkingTree.open('target')
361
330
self.assertEqual(tree.last_revision(), new_tree.last_revision())
362
331
# The push should have created target/a
363
self.assertPathExists('target/a')
332
self.failUnlessExists('target/a')
365
334
def test_push_use_existing_into_empty_bzrdir(self):
366
335
"""'bzr push --use-existing-dir' into a dir with an empty .bzr dir
676
645
def set_config_push_strict(self, value):
677
646
# set config var (any of bazaar.conf, locations.conf, branch.conf
679
conf = self.tree.branch.get_config_stack()
680
conf.set('push_strict', value)
648
conf = self.tree.branch.get_config()
649
conf.set_user_option('push_strict', value)
682
651
_default_command = ['push', '../to']
683
652
_default_wd = 'local'