~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_reconfigure.py

  • Committer: Alexander Belchenko
  • Date: 2012-03-29 08:34:13 UTC
  • mto: (6015.44.14 2.4)
  • mto: This revision was merged to the branch mainline in revision 6513.
  • Revision ID: bialix@ukr.net-20120329083413-d4bqqdtfn2yrxp4f
change st_dev, st_ino, st_uid, st_gid from int members to properties.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2012 Canonical Ltd
 
1
# Copyright (C) 2007, 2009 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
from bzrlib import (
18
 
    controldir,
 
18
    bzrdir,
19
19
    errors,
20
20
    tests,
21
21
    workingtree,
22
22
    )
23
 
from bzrlib.tests.script import TestCaseWithTransportAndScript
24
 
 
25
 
 
26
 
class TestReconfigure(TestCaseWithTransportAndScript):
 
23
from bzrlib.branchbuilder import BranchBuilder
 
24
 
 
25
 
 
26
class TestReconfigure(tests.TestCaseWithTransport):
27
27
 
28
28
    def test_no_type(self):
29
29
        branch = self.make_branch('branch')
85
85
 
86
86
    def test_use_shared_to_standalone(self):
87
87
        repo = self.make_repository('repo', shared=True)
88
 
        branch = controldir.ControlDir.create_branch_convenience('repo/tree')
 
88
        branch = bzrdir.BzrDir.create_branch_convenience('repo/tree')
89
89
        self.assertNotEqual(branch.bzrdir.root_transport.base,
90
90
            branch.repository.bzrdir.root_transport.base)
91
91
        self.run_bzr('reconfigure --standalone', working_dir='repo/tree')
125
125
 
126
126
    def test_make_without_trees_leaves_tree_alone(self):
127
127
        repo = self.make_repository('repo', shared=True)
128
 
        branch = controldir.ControlDir.create_branch_convenience('repo/branch')
 
128
        branch = bzrdir.BzrDir.create_branch_convenience('repo/branch')
129
129
        tree = workingtree.WorkingTree.open('repo/branch')
130
130
        self.build_tree(['repo/branch/foo'])
131
131
        tree.add('foo')
136
136
 
137
137
    def test_shared_format_to_standalone(self, format=None):
138
138
        repo = self.make_repository('repo', shared=True, format=format)
139
 
        branch = controldir.ControlDir.create_branch_convenience('repo/tree')
 
139
        branch = bzrdir.BzrDir.create_branch_convenience('repo/tree')
140
140
        self.assertNotEqual(branch.bzrdir.root_transport.base,
141
141
            branch.repository.bzrdir.root_transport.base)
142
142
        tree = workingtree.WorkingTree.open('repo/tree')
175
175
        self.run_bzr('revert', working_dir='checkout')
176
176
        self.check_file_contents('checkout/file', 'foo\n')
177
177
 
178
 
    def test_lightweight_knit_checkout_to_tree(self):
 
178
    def test_lightweight_knit_checkout_to_tree(self, format=None):
179
179
        self.test_lightweight_format_checkout_to_tree('knit')
180
180
 
181
 
    def test_lightweight_pack092_checkout_to_tree(self):
 
181
    def test_lightweight_pack092_checkout_to_tree(self, format=None):
182
182
        self.test_lightweight_format_checkout_to_tree('pack-0.92')
183
183
 
184
 
    def test_lightweight_rich_root_pack_checkout_to_tree(self):
 
184
    def test_lightweight_rich_root_pack_checkout_to_tree(self, format=None):
185
185
        self.test_lightweight_format_checkout_to_tree('rich-root-pack')
186
186
 
187
 
    def test_branch_and_use_shared(self):
188
 
        self.run_script("""\
189
 
$ bzr init -q branch
190
 
$ echo foo > branch/foo
191
 
$ bzr add -q branch/foo
192
 
$ bzr commit -q -m msg branch
193
 
$ bzr init-repo -q .
194
 
$ bzr reconfigure --branch --use-shared branch
195
 
$ bzr info branch
196
 
Repository branch (format: ...)
197
 
Location:
198
 
  shared repository: .
199
 
  repository branch: branch
200
 
""")
201
 
 
202
 
    def test_use_shared_and_branch(self):
203
 
        self.run_script("""\
204
 
$ bzr init -q branch
205
 
$ echo foo > branch/foo
206
 
$ bzr add -q branch/foo
207
 
$ bzr commit -q -m msg branch
208
 
$ bzr init-repo -q .
209
 
$ bzr reconfigure --use-shared --branch branch
210
 
$ bzr info branch
211
 
Repository branch (format: ...)
212
 
Location:
213
 
  shared repository: .
214
 
  repository branch: branch
215
 
""")
216
 
 
217
187
 
218
188
class TestReconfigureStacking(tests.TestCaseWithTransport):
219
189
 
241
211
        branch_2 = tree_2.branch
242
212
        # now reconfigure to be stacked
243
213
        out, err = self.run_bzr('reconfigure --stacked-on b1 b2')
244
 
        self.assertContainsRe(out, '^.*/b2/ is now stacked on ../b1\n$')
 
214
        self.assertContainsRe(out,
 
215
            '^.*/b2/ is now stacked on ../b1\n$')
245
216
        self.assertEquals('', err)
246
217
        # can also give the absolute URL of the branch, and it gets stored 
247
218
        # as a relative path if possible
248
219
        out, err = self.run_bzr('reconfigure --stacked-on %s b2'
249
 
                                % (self.get_url('b1'),))
250
 
        self.assertContainsRe(out, '^.*/b2/ is now stacked on ../b1\n$')
 
220
            % (self.get_url('b1'),))
 
221
        self.assertContainsRe(out,
 
222
            '^.*/b2/ is now stacked on ../b1\n$')
251
223
        self.assertEquals('', err)
252
 
        # Refresh the branch as 'reconfigure' modified it
253
 
        branch_2 = branch_2.bzrdir.open_branch()
254
224
        # It should be given a relative URL to the destination, if possible,
255
225
        # because that's most likely to work across different transports
256
 
        self.assertEquals('../b1', branch_2.get_stacked_on_url())
 
226
        self.assertEquals(branch_2.get_stacked_on_url(),
 
227
            '../b1')
257
228
        # commit, and it should be stored into b2's repo
258
229
        self.build_tree_contents([('foo', 'new foo')])
259
230
        tree_2.commit('update foo')
262
233
        self.assertContainsRe(out,
263
234
            '^.*/b2/ is now not stacked\n$')
264
235
        self.assertEquals('', err)
265
 
        # Refresh the branch as 'reconfigure' modified it
266
 
        branch_2 = branch_2.bzrdir.open_branch()
267
 
        self.assertRaises(errors.NotStacked, branch_2.get_stacked_on_url)
 
236
        self.assertRaises(errors.NotStacked,
 
237
            branch_2.get_stacked_on_url)
268
238
 
269
239
    # XXX: Needs a test for reconfiguring stacking and shape at the same time;
270
240
    # no branch at location; stacked-on is not a branch; quiet mode.