/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_pull.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2017-06-10 18:39:27 UTC
  • mfrom: (6653.6.7 rename-controldir)
  • Revision ID: breezy.the.bot@gmail.com-20170610183927-8yn4wmsk1ki92xc3
Rename ``bzrdir`` attribute to ``controldir``.

Merged from https://code.launchpad.net/~jelmer/brz/rename-controldir/+merge/325433

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
        # become the revision-history.
38
38
        parent = self.make_branch_and_tree('parent')
39
39
        parent.commit('1st post', rev_id='P1', allow_pointless=True)
40
 
        mine = parent.bzrdir.sprout('mine').open_workingtree()
 
40
        mine = parent.controldir.sprout('mine').open_workingtree()
41
41
        mine.commit('my change', rev_id='M1', allow_pointless=True)
42
42
        parent.merge_from_branch(mine.branch)
43
43
        parent.commit('merge my change', rev_id='P2')
51
51
        # directly accessible.
52
52
        parent = self.make_branch_and_tree('parent')
53
53
        parent.commit('1st post', rev_id='P1', allow_pointless=True)
54
 
        mine = parent.bzrdir.sprout('mine').open_workingtree()
 
54
        mine = parent.controldir.sprout('mine').open_workingtree()
55
55
        mine.commit('my change', rev_id='M1', allow_pointless=True)
56
 
        other = parent.bzrdir.sprout('other').open_workingtree()
 
56
        other = parent.controldir.sprout('other').open_workingtree()
57
57
        other.merge_from_branch(mine.branch)
58
58
        other.commit('merge my change', rev_id='O2')
59
59
        parent.merge_from_branch(other.branch)
67
67
        rev1 = master_tree.commit('master')
68
68
        checkout = master_tree.branch.create_checkout('checkout')
69
69
 
70
 
        other = master_tree.branch.bzrdir.sprout('other').open_workingtree()
 
70
        other = master_tree.branch.controldir.sprout('other').open_workingtree()
71
71
        rev2 = other.commit('other commit')
72
72
        # now pull, which should update both checkout and master.
73
73
        checkout.branch.pull(other.branch)
81
81
        rev1 = master_tree.commit('master')
82
82
        checkout = master_tree.branch.create_checkout('checkout')
83
83
 
84
 
        other = master_tree.branch.bzrdir.sprout('other').open_workingtree()
 
84
        other = master_tree.branch.controldir.sprout('other').open_workingtree()
85
85
        rev2 = other.commit('other commit')
86
86
        # now pull local, which should update checkout but not master.
87
87
        checkout.branch.pull(other.branch, local = True)
93
93
        master_tree = self.make_branch_and_tree('branch')
94
94
        rev1 = master_tree.commit('master')
95
95
 
96
 
        other = master_tree.branch.bzrdir.sprout('other').open_workingtree()
 
96
        other = master_tree.branch.controldir.sprout('other').open_workingtree()
97
97
        rev2 = other.commit('other commit')
98
98
        # now pull --local, which should raise LocalRequiresBoundBranch error.
99
99
        self.assertRaises(errors.LocalRequiresBoundBranch,
103
103
    def test_pull_returns_result(self):
104
104
        parent = self.make_branch_and_tree('parent')
105
105
        parent.commit('1st post', rev_id='P1')
106
 
        mine = parent.bzrdir.sprout('mine').open_workingtree()
 
106
        mine = parent.controldir.sprout('mine').open_workingtree()
107
107
        mine.commit('my change', rev_id='M1')
108
108
        result = parent.branch.pull(mine.branch)
109
109
        self.assertIsNot(None, result)
120
120
    def test_pull_overwrite(self):
121
121
        tree_a = self.make_branch_and_tree('tree_a')
122
122
        tree_a.commit('message 1')
123
 
        tree_b = tree_a.bzrdir.sprout('tree_b').open_workingtree()
 
123
        tree_b = tree_a.controldir.sprout('tree_b').open_workingtree()
124
124
        tree_a.commit('message 2', rev_id='rev2a')
125
125
        tree_b.commit('message 2', rev_id='rev2b')
126
126
        self.assertRaises(errors.DivergedBranches, tree_a.pull, tree_b.branch)
148
148
        except errors.UninitializableFormat:
149
149
            raise TestNotApplicable('uninitializeable format')
150
150
        source = fixtures.build_branch_with_non_ancestral_rev(builder)
151
 
        target = source.bzrdir.sprout('target').open_branch()
 
151
        target = source.controldir.sprout('target').open_branch()
152
152
        # Add a tag to the source, then pull from source
153
153
        try:
154
154
            source.tags.set_tag('tag-a', 'rev-2')
169
169
        except errors.UninitializableFormat:
170
170
            raise TestNotApplicable('uninitializeable format')
171
171
        source = fixtures.build_branch_with_non_ancestral_rev(builder)
172
 
        target = source.bzrdir.sprout('target').open_branch()
 
172
        target = source.controldir.sprout('target').open_branch()
173
173
        # Add a new commit to the ancestry
174
174
        builder.build_commit(message="Rev 2 again", rev_id='rev-2-again')
175
175
        # Add a tag to the source, then pull rev-2-again from source
259
259
        target.add('')
260
260
        rev1 = target.commit('rev 1')
261
261
        target.unlock()
262
 
        sourcedir = target.bzrdir.clone(self.get_url('source'))
 
262
        sourcedir = target.controldir.clone(self.get_url('source'))
263
263
        source = memorytree.MemoryTree.create_on_branch(sourcedir.open_branch())
264
264
        rev2 = source.commit('rev 2')
265
265
        branch.Branch.hooks.install_named_hook(