/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_push.py

  • Committer: Jelmer Vernooij
  • Date: 2012-01-30 14:12:36 UTC
  • mfrom: (6437.3.28 2.5)
  • mto: This revision was merged to the branch mainline in revision 6522.
  • Revision ID: jelmer@samba.org-20120130141236-66k8qj1he6q2nq3r
Merge 2.5 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
from bzrlib import (
23
23
    branch,
24
24
    bzrdir,
 
25
    controldir,
25
26
    errors,
26
27
    osutils,
27
28
    tests,
32
33
    )
33
34
from bzrlib.repofmt import knitrepo
34
35
from bzrlib.tests import (
35
 
    blackbox,
36
36
    http_server,
37
37
    scenarios,
 
38
    script,
38
39
    test_foreign,
39
 
    test_server,
40
40
    )
 
41
from bzrlib.tests.matchers import ContainsNoVfsCalls
41
42
from bzrlib.transport import memory
42
43
 
43
44
 
56
57
                           ['push', public_url],
57
58
                           working_dir='source')
58
59
 
 
60
    def test_push_suggests_parent_alias(self):
 
61
        """Push suggests using :parent if there is a known parent branch."""
 
62
        tree_a = self.make_branch_and_tree('a')
 
63
        tree_a.commit('this is a commit')
 
64
        tree_b = self.make_branch_and_tree('b')
 
65
 
 
66
        # If there is no parent location set, :parent isn't mentioned.
 
67
        out = self.run_bzr('push', working_dir='a', retcode=3)
 
68
        self.assertEquals(out,
 
69
                ('','bzr: ERROR: No push location known or specified.\n'))
 
70
 
 
71
        # If there is a parent location set, the error suggests :parent.
 
72
        tree_a.branch.set_parent(tree_b.branch.base)
 
73
        out = self.run_bzr('push', working_dir='a', retcode=3)
 
74
        self.assertEquals(out,
 
75
            ('','bzr: ERROR: No push location known or specified. '
 
76
                'To push to the parent branch '
 
77
                '(at %s), use \'bzr push :parent\'.\n' %
 
78
                urlutils.unescape_for_display(tree_b.branch.base, 'utf-8')))
 
79
 
59
80
    def test_push_remember(self):
60
81
        """Push changes from one branch to another and test push location."""
61
82
        transport = self.get_transport()
173
194
 
174
195
        def make_shared_tree(path):
175
196
            shared_repo.bzrdir.root_transport.mkdir(path)
176
 
            shared_repo.bzrdir.create_branch_convenience('repo/' + path)
 
197
            controldir.ControlDir.create_branch_convenience('repo/' + path)
177
198
            return workingtree.WorkingTree.open('repo/' + path)
178
199
        tree_a = make_shared_tree('a')
179
200
        self.build_tree(['repo/a/file'])
247
268
        # become necessary for this use case. Please do not adjust this number
248
269
        # upwards without agreement from bzr's network support maintainers.
249
270
        self.assertLength(9, self.hpss_calls)
 
271
        self.assertLength(1, self.hpss_connections)
 
272
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
250
273
 
251
274
    def test_push_smart_stacked_streaming_acceptance(self):
252
275
        self.setup_smart_server_with_call_log()
262
285
        # being too low. If rpc_count increases, more network roundtrips have
263
286
        # become necessary for this use case. Please do not adjust this number
264
287
        # upwards without agreement from bzr's network support maintainers.
265
 
        self.assertLength(13, self.hpss_calls)
 
288
        self.assertLength(14, self.hpss_calls)
 
289
        self.assertLength(1, self.hpss_connections)
 
290
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
266
291
        remote = branch.Branch.open('public')
267
292
        self.assertEndsWith(remote.get_stacked_on_url(), '/parent')
268
293
 
279
304
        # become necessary for this use case. Please do not adjust this number
280
305
        # upwards without agreement from bzr's network support maintainers.
281
306
        self.assertLength(11, self.hpss_calls)
 
307
        self.assertLength(1, self.hpss_connections)
 
308
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
282
309
 
283
310
    def test_push_smart_incremental_acceptance(self):
284
311
        self.setup_smart_server_with_call_log()
295
322
        # become necessary for this use case. Please do not adjust this number
296
323
        # upwards without agreement from bzr's network support maintainers.
297
324
        self.assertLength(11, self.hpss_calls)
 
325
        self.assertLength(1, self.hpss_connections)
 
326
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
298
327
 
299
328
    def test_push_smart_with_default_stacking_url_path_segment(self):
300
329
        # If the default stacked-on location is a path element then branches
858
887
        self.assertEquals("", output)
859
888
        self.assertEquals(error, "bzr: ERROR: It is not possible to losslessly"
860
889
            " push to dummy. You may want to use dpush instead.\n")
 
890
 
 
891
 
 
892
class TestPushOutput(script.TestCaseWithTransportAndScript):
 
893
 
 
894
    def test_push_log_format(self):
 
895
        self.run_script("""
 
896
            $ bzr init trunk
 
897
            Created a standalone tree (format: 2a)
 
898
            $ cd trunk
 
899
            $ echo foo > file
 
900
            $ bzr add
 
901
            adding file
 
902
            $ bzr commit -m 'we need some foo'
 
903
            2>Committing to:...trunk/
 
904
            2>added file
 
905
            2>Committed revision 1.
 
906
            $ bzr init ../feature
 
907
            Created a standalone tree (format: 2a)
 
908
            $ bzr push -v ../feature -Olog_format=line
 
909
            Added Revisions:
 
910
            1: jrandom@example.com ...we need some foo
 
911
            2>All changes applied successfully.
 
912
            2>Pushed up to revision 1.
 
913
            """)