/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: Jelmer Vernooij
  • Date: 2017-06-10 16:40:42 UTC
  • mfrom: (6653.6.7 rename-controldir)
  • mto: This revision was merged to the branch mainline in revision 6690.
  • Revision ID: jelmer@jelmer.uk-20170610164042-zrxqgy2htyduvke2
MergeĀ rename-controldirĀ branch.

Show diffs side-by-side

added added

removed removed

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