/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_sprout.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:
40
40
 
41
41
    def test_sprout_branch_parent(self):
42
42
        source = self.make_branch('source')
43
 
        target = source.bzrdir.sprout(self.get_url('target')).open_branch()
44
 
        self.assertEqual(source.bzrdir.root_transport.base, target.get_parent())
 
43
        target = source.controldir.sprout(self.get_url('target')).open_branch()
 
44
        self.assertEqual(source.controldir.root_transport.base, target.get_parent())
45
45
 
46
46
    def test_sprout_uses_bzrdir_branch_format(self):
47
47
        # branch.sprout(bzrdir) is defined as using the branch format selected
58
58
        # We call the super class to allow overriding the format of creation)
59
59
        source = tests.TestCaseWithTransport.make_branch(self, 'old-branch',
60
60
                                                         format='knit')
61
 
        target_bzrdir = self.make_bzrdir('target')
 
61
        target_bzrdir = self.make_controldir('target')
62
62
        target_bzrdir.create_repository()
63
63
        result_format = self.branch_format
64
64
        if isinstance(target_bzrdir, remote.RemoteBzrDir):
93
93
        repo_b = self.make_repository('b')
94
94
        repo_a = wt_a.branch.repository
95
95
        repo_a.copy_content_into(repo_b)
96
 
        br_b = wt_a.branch.sprout(repo_b.bzrdir, revision_id='1')
 
96
        br_b = wt_a.branch.sprout(repo_b.controldir, revision_id='1')
97
97
        self.assertEqual('1', br_b.last_revision())
98
98
 
99
99
    def test_sprout_partial_not_in_revision_history(self):
111
111
 
112
112
        repo = self.make_repository('target')
113
113
        repo.fetch(wt.branch.repository)
114
 
        branch2 = wt.branch.sprout(repo.bzrdir, revision_id='rev2-alt')
 
114
        branch2 = wt.branch.sprout(repo.controldir, revision_id='rev2-alt')
115
115
        self.assertEqual((2, 'rev2-alt'), branch2.last_revision_info())
116
116
        self.assertEqual('rev2-alt', branch2.last_revision())
117
117
 
129
129
            raise tests.TestNotApplicable(
130
130
                'Branch format does not support tags or tags to ghosts.')
131
131
        # Now source has a tag pointing to an absent revision.  Sprout it.
132
 
        target_bzrdir = self.make_repository('target').bzrdir
 
132
        target_bzrdir = self.make_repository('target').controldir
133
133
        new_branch = source.sprout(target_bzrdir)
134
134
        # The tag is present in the target
135
135
        self.assertEqual('missing-rev', new_branch.tags.lookup_tag('tag-a'))
145
145
        wt.set_last_revision(_mod_revision.NULL_REVISION)
146
146
        wt.revert()
147
147
        wt.commit('rev1b', rev_id='rev1b')
148
 
        wt2 = wt.bzrdir.sprout('target',
 
148
        wt2 = wt.controldir.sprout('target',
149
149
            revision_id='rev1a').open_workingtree()
150
150
        self.assertEqual('rev1a', wt2.last_revision())
151
151
        self.assertPathExists('target/a')
169
169
        tree.add([link_name],['link-id'])
170
170
 
171
171
        revision = tree.commit('added a link to a Unicode target')
172
 
        tree.bzrdir.sprout('dest')
 
172
        tree.controldir.sprout('dest')
173
173
        self.assertEqual(target, osutils.readlink('dest/' + link_name))
174
174
        tree.lock_read()
175
175
        self.addCleanup(tree.unlock)
187
187
        tree.add('')
188
188
        tree.commit('msg1', rev_id='rev1')
189
189
        tree.commit('msg2', rev_id='rev2')
190
 
        tree.bzrdir.sprout('target', revision_id='rev1')
 
190
        tree.controldir.sprout('target', revision_id='rev1')
191
191
 
192
192
    def assertBranchHookBranchIsStacked(self, pre_change_params):
193
193
        # Just calling will either succeed or fail.
204
204
        _mod_branch.Branch.hooks.install_named_hook("pre_change_branch_tip",
205
205
            self.assertBranchHookBranchIsStacked, None)
206
206
        try:
207
 
            dir = source.bzrdir.sprout(target_transport.base,
 
207
            dir = source.controldir.sprout(target_transport.base,
208
208
                source.last_revision(), possible_transports=[target_transport],
209
209
                source_branch=source, stacked=True)
210
210
        except errors.UnstackableBranchFormat: