~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2012-03-13 17:25:29 UTC
  • mfrom: (6499 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6501.
  • Revision ID: v.ladeuil+lp@free.fr-20120313172529-i0suyjnepsor25i7
Merge trunk

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')
78
78
        mine.merge_from_branch(other.branch)
79
79
        mine.commit('merge other', rev_id='P2')
80
80
        mine.branch.push(target.branch)
81
 
        self.assertEqual(['P1', 'P2'], target.branch.revision_history())
 
81
        self.assertEqual('P2', target.branch.last_revision())
82
82
 
83
83
    def test_push_to_checkout_updates_master(self):
84
84
        """Pushing into a checkout updates the checkout and the master branch"""
95
95
        rev2 = other.commit('other commit')
96
96
        # now push, which should update both checkout and master.
97
97
        other.branch.push(checkout.branch)
98
 
        self.assertEqual([rev1, rev2], checkout.branch.revision_history())
99
 
        self.assertEqual([rev1, rev2], master_tree.branch.revision_history())
 
98
        self.assertEqual(rev2, checkout.branch.last_revision())
 
99
        self.assertEqual(rev2, master_tree.branch.last_revision())
100
100
 
101
101
    def test_push_raises_specific_error_on_master_connection_error(self):
102
102
        master_tree = self.make_branch_and_tree('master')
157
157
        except (errors.IncompatibleFormat, errors.UninitializableFormat):
158
158
            # This Branch format cannot create shared repositories
159
159
            return
 
160
        if not repo._format.supports_nesting_repositories:
 
161
            return
160
162
        # This is a little bit trickier because make_branch_and_tree will not
161
163
        # re-use a shared repository.
162
164
        a_bzrdir = self.make_bzrdir('repo/tree')
171
173
            if self.vfs_transport_factory is test_server.LocalURLServer:
172
174
                # the branch is colocated on disk, we cannot create a checkout.
173
175
                # hopefully callers will expect this.
174
 
                local_controldir= bzrdir.BzrDir.open(
 
176
                local_controldir = controldir.ControlDir.open(
175
177
                    self.get_vfs_only_url('repo/tree'))
176
178
                tree = local_controldir.create_workingtree()
177
179
            else:
251
253
        self.addCleanup(repo.lock_read().unlock)
252
254
        # We should have pushed 'C', but not 'B', since it isn't in the
253
255
        # ancestry
254
 
        self.assertEqual([('A',), ('C',)], sorted(repo.revisions.keys()))
 
256
        self.assertEqual(['A', 'C'], sorted(repo.all_revision_ids()))
255
257
 
256
258
    def test_push_with_default_stacking_does_not_create_broken_branch(self):
257
259
        """Pushing a new standalone branch works even when there's a default
353
355
            # remotebranches can't be bound.  Let's instead make a new local
354
356
            # branch of the default type, which does allow binding.
355
357
            # See https://bugs.launchpad.net/bzr/+bug/112020
356
 
            local = bzrdir.BzrDir.create_branch_convenience('local2')
 
358
            local = controldir.ControlDir.create_branch_convenience('local2')
357
359
            local.bind(target)
358
360
        source = self.make_branch('source')
359
361
        branch.Branch.hooks.install_named_hook(
424
426
    def test_empty_branch_api(self):
425
427
        """The branch_obj.push API should make a limited number of HPSS calls.
426
428
        """
427
 
        t = transport.get_transport(self.smart_server.get_url()).clone('target')
 
429
        t = transport.get_transport_from_url(self.smart_server.get_url()).clone('target')
428
430
        target = branch.Branch.open_from_transport(t)
429
431
        self.empty_branch.push(target)
430
432
        self.assertEqual(