/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 breezy/tests/per_branch/test_push.py

  • Committer: Jelmer Vernooij
  • Date: 2019-03-04 00:16:27 UTC
  • mfrom: (7293 work)
  • mto: This revision was merged to the branch mainline in revision 7318.
  • Revision ID: jelmer@jelmer.uk-20190304001627-v6u7o6pf97tukhek
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
            return
91
91
        rev1 = checkout.commit('master')
92
92
 
93
 
        other = master_tree.branch.controldir.sprout('other').open_workingtree()
 
93
        other = master_tree.branch.controldir.sprout(
 
94
            'other').open_workingtree()
94
95
        rev2 = other.commit('other commit')
95
96
        # now push, which should update both checkout and master.
96
97
        other.branch.push(checkout.branch)
105
106
        except errors.UpgradeRequired:
106
107
            # cant bind this format, the test is irrelevant.
107
108
            return
108
 
        other = master_tree.branch.controldir.sprout('other').open_workingtree()
 
109
        other = master_tree.branch.controldir.sprout(
 
110
            'other').open_workingtree()
109
111
        # move the branch out of the way on disk to cause a connection
110
112
        # error.
111
113
        os.rename('master', 'master_gone')
112
114
        # try to push, which should raise a BoundBranchConnectionFailure.
113
115
        self.assertRaises(errors.BoundBranchConnectionFailure,
114
 
                other.branch.push, checkout.branch)
 
116
                          other.branch.push, checkout.branch)
115
117
 
116
118
    def test_push_new_tag_to_bound_branch(self):
117
119
        master = self.make_branch('master')
143
145
        try:
144
146
            target.lock_write()
145
147
            try:
146
 
                source.branch.push(target, stop_revision=source.last_revision())
 
148
                source.branch.push(
 
149
                    target, stop_revision=source.last_revision())
147
150
            finally:
148
151
                target.unlock()
149
152
        finally:
285
288
            ('add', ('filename', b'f-id', 'file', b'content\n'))])
286
289
        revid2 = builder.build_snapshot([revid1], [])
287
290
        revid3 = builder.build_snapshot([revid2],
288
 
            [('modify', ('filename', b'new-content\n'))])
 
291
                                        [('modify', ('filename', b'new-content\n'))])
289
292
        builder.finish_series()
290
293
        trunk = builder.get_branch()
291
294
        # Sprout rev-1 to "trunk", so that we can stack on it.
379
382
        rev1 = target.commit('rev 1')
380
383
        target.unlock()
381
384
        sourcedir = target.controldir.clone(self.get_url('source'))
382
 
        source = memorytree.MemoryTree.create_on_branch(sourcedir.open_branch())
 
385
        source = memorytree.MemoryTree.create_on_branch(
 
386
            sourcedir.open_branch())
383
387
        rev2 = source.commit('rev 2')
384
388
        branch.Branch.hooks.install_named_hook(
385
389
            'post_push', self.capture_post_push_hook, None)
400
404
 
401
405
    def setUp(self):
402
406
        # Skip some scenarios that don't apply to these tests.
403
 
        if (self.transport_server is not None
404
 
            and issubclass(self.transport_server,
405
 
                           test_server.SmartTCPServer_for_testing)):
 
407
        if (self.transport_server is not None and
 
408
            issubclass(self.transport_server,
 
409
                       test_server.SmartTCPServer_for_testing)):
406
410
            raise tests.TestNotApplicable(
407
411
                'Does not apply when remote backing branch is also '
408
412
                'a smart branch')
428
432
    def test_empty_branch_api(self):
429
433
        """The branch_obj.push API should make a limited number of HPSS calls.
430
434
        """
431
 
        t = transport.get_transport_from_url(self.smart_server.get_url()).clone('target')
 
435
        t = transport.get_transport_from_url(
 
436
            self.smart_server.get_url()).clone('target')
432
437
        target = branch.Branch.open_from_transport(t)
433
438
        self.empty_branch.push(target)
434
439
        self.assertEqual(
465
470
    def test_lossy_push_raises_same_vcs(self):
466
471
        target = self.make_branch('target')
467
472
        source = self.make_branch('source')
468
 
        self.assertRaises(errors.LossyPushToSameVCS, source.push, target, lossy=True)
 
473
        self.assertRaises(errors.LossyPushToSameVCS,
 
474
                          source.push, target, lossy=True)