~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Tarmac
  • Author(s): Vincent Ladeuil
  • Date: 2017-01-30 14:42:05 UTC
  • mfrom: (6620.1.1 trunk)
  • Revision ID: tarmac-20170130144205-r8fh2xpmiuxyozpv
Merge  2.7 into trunk including fix for bug #1657238 [r=vila]

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
from bzrlib import (
23
23
    branch,
24
24
    builtins,
25
 
    bzrdir,
 
25
    controldir,
26
26
    check,
27
27
    errors,
28
28
    memorytree,
53
53
        mine.merge_from_branch(other.branch)
54
54
        mine.commit('merge my change', rev_id='P2')
55
55
        result = mine.branch.push(other.branch)
56
 
        self.assertEqual(['P1', 'P2'], other.branch.revision_history())
 
56
        self.assertEqual('P2', other.branch.last_revision())
57
57
        # result object contains some structured data
58
58
        self.assertEqual(result.old_revid, 'M1')
59
59
        self.assertEqual(result.new_revid, 'P2')
60
 
        # and it can be treated as an integer for compatibility
61
 
        self.assertEqual(self.applyDeprecated(
62
 
            symbol_versioning.deprecated_in((2, 3, 0)),
63
 
            result.__int__),
64
 
            0)
65
60
 
66
61
    def test_push_merged_indirect(self):
67
62
        # it should be possible to do a push from one branch into another
78
73
        mine.merge_from_branch(other.branch)
79
74
        mine.commit('merge other', rev_id='P2')
80
75
        mine.branch.push(target.branch)
81
 
        self.assertEqual(['P1', 'P2'], target.branch.revision_history())
 
76
        self.assertEqual('P2', target.branch.last_revision())
82
77
 
83
78
    def test_push_to_checkout_updates_master(self):
84
79
        """Pushing into a checkout updates the checkout and the master branch"""
95
90
        rev2 = other.commit('other commit')
96
91
        # now push, which should update both checkout and master.
97
92
        other.branch.push(checkout.branch)
98
 
        self.assertEqual([rev1, rev2], checkout.branch.revision_history())
99
 
        self.assertEqual([rev1, rev2], master_tree.branch.revision_history())
 
93
        self.assertEqual(rev2, checkout.branch.last_revision())
 
94
        self.assertEqual(rev2, master_tree.branch.last_revision())
100
95
 
101
96
    def test_push_raises_specific_error_on_master_connection_error(self):
102
97
        master_tree = self.make_branch_and_tree('master')
173
168
            if self.vfs_transport_factory is test_server.LocalURLServer:
174
169
                # the branch is colocated on disk, we cannot create a checkout.
175
170
                # hopefully callers will expect this.
176
 
                local_controldir= bzrdir.BzrDir.open(
 
171
                local_controldir = controldir.ControlDir.open(
177
172
                    self.get_vfs_only_url('repo/tree'))
178
173
                tree = local_controldir.create_workingtree()
179
174
            else:
355
350
            # remotebranches can't be bound.  Let's instead make a new local
356
351
            # branch of the default type, which does allow binding.
357
352
            # See https://bugs.launchpad.net/bzr/+bug/112020
358
 
            local = bzrdir.BzrDir.create_branch_convenience('local2')
 
353
            local = controldir.ControlDir.create_branch_convenience('local2')
359
354
            local.bind(target)
360
355
        source = self.make_branch('source')
361
356
        branch.Branch.hooks.install_named_hook(