~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Jelmer Vernooij
  • Date: 2012-01-06 22:44:57 UTC
  • mfrom: (6436 +trunk)
  • mto: (6437.3.11 2.5)
  • mto: This revision was merged to the branch mainline in revision 6444.
  • Revision ID: jelmer@samba.org-20120106224457-re0pcy0fz31xob77
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
    )
34
34
from bzrlib.repofmt import knitrepo
35
35
from bzrlib.tests import (
36
 
    blackbox,
37
36
    http_server,
38
37
    scenarios,
39
38
    script,
40
39
    test_foreign,
41
 
    test_server,
42
40
    )
 
41
from bzrlib.tests.matchers import ContainsNoVfsCalls
43
42
from bzrlib.transport import memory
44
43
 
45
44
 
58
57
                           ['push', public_url],
59
58
                           working_dir='source')
60
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
 
61
80
    def test_push_remember(self):
62
81
        """Push changes from one branch to another and test push location."""
63
82
        transport = self.get_transport()
249
268
        # become necessary for this use case. Please do not adjust this number
250
269
        # upwards without agreement from bzr's network support maintainers.
251
270
        self.assertLength(9, self.hpss_calls)
 
271
        self.assertLength(1, self.hpss_connections)
 
272
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
252
273
 
253
274
    def test_push_smart_stacked_streaming_acceptance(self):
254
275
        self.setup_smart_server_with_call_log()
264
285
        # being too low. If rpc_count increases, more network roundtrips have
265
286
        # become necessary for this use case. Please do not adjust this number
266
287
        # upwards without agreement from bzr's network support maintainers.
267
 
        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)
268
291
        remote = branch.Branch.open('public')
269
292
        self.assertEndsWith(remote.get_stacked_on_url(), '/parent')
270
293
 
281
304
        # become necessary for this use case. Please do not adjust this number
282
305
        # upwards without agreement from bzr's network support maintainers.
283
306
        self.assertLength(11, self.hpss_calls)
 
307
        self.assertLength(1, self.hpss_connections)
 
308
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
284
309
 
285
310
    def test_push_smart_incremental_acceptance(self):
286
311
        self.setup_smart_server_with_call_log()
297
322
        # become necessary for this use case. Please do not adjust this number
298
323
        # upwards without agreement from bzr's network support maintainers.
299
324
        self.assertLength(11, self.hpss_calls)
 
325
        self.assertLength(1, self.hpss_connections)
 
326
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
300
327
 
301
328
    def test_push_smart_with_default_stacking_url_path_segment(self):
302
329
        # If the default stacked-on location is a path element then branches