/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 bzrlib/tests/blackbox/test_reconfigure.py

  • Committer: mernst at mit
  • Date: 2008-10-16 10:57:16 UTC
  • mto: This revision was merged to the branch mainline in revision 3799.
  • Revision ID: mernst@csail.mit.edu-20081016105716-v8x8n5t2pf7f6uds
Improved documentation of stacked and lightweight branches

These patches improve the User Guide's documentation of stacked and
lightweight branches.

Section "1.2.6 Putting the concepts together" should mention stacked
branches and the difference between them and lightweight branches.  It
should also contain links to further details of the common scenarios.

Section "5.3.4 Getting a lightweight checkout" should mention stacked
branches as an option, and should link to all the options, not just some of
them.  It should also clarify that lightweight only applies to checkouts,
not to arbitrary branches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2007 Canonical Ltd
 
2
#
 
3
# This program is free software; you can redistribute it and/or modify
 
4
# it under the terms of the GNU General Public License as published by
 
5
# the Free Software Foundation; either version 2 of the License, or
 
6
# (at your option) any later version.
 
7
#
 
8
# This program is distributed in the hope that it will be useful,
 
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
# GNU General Public License for more details.
 
12
#
 
13
# You should have received a copy of the GNU General Public License
 
14
# along with this program; if not, write to the Free Software
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
16
 
 
17
from bzrlib import (
 
18
    bzrdir,
 
19
    errors,
 
20
    tests,
 
21
    workingtree,
 
22
    )
 
23
 
 
24
 
 
25
class TestReconfigure(tests.TestCaseWithTransport):
 
26
 
 
27
    def test_no_type(self):
 
28
        branch = self.make_branch('branch')
 
29
        self.run_bzr_error(['No target configuration specified'],
 
30
                           'reconfigure branch')
 
31
 
 
32
    def test_branch_to_tree(self):
 
33
        branch = self.make_branch('branch')
 
34
        self.run_bzr('reconfigure --tree branch')
 
35
        tree = workingtree.WorkingTree.open('branch')
 
36
 
 
37
    def test_tree_to_branch(self):
 
38
        tree = self.make_branch_and_tree('tree')
 
39
        self.run_bzr('reconfigure --branch tree')
 
40
        self.assertRaises(errors.NoWorkingTree,
 
41
                          workingtree.WorkingTree.open, 'tree')
 
42
 
 
43
    def test_branch_to_specified_checkout(self):
 
44
        branch = self.make_branch('branch')
 
45
        parent = self.make_branch('parent')
 
46
        self.run_bzr('reconfigure branch --checkout --bind-to parent')
 
47
 
 
48
    def test_force(self):
 
49
        tree = self.make_branch_and_tree('tree')
 
50
        self.build_tree(['tree/file'])
 
51
        tree.add('file')
 
52
        self.run_bzr_error(['Working tree ".*" has uncommitted changes'],
 
53
                            'reconfigure --branch tree')
 
54
        self.run_bzr('reconfigure --force --branch tree')
 
55
 
 
56
    def test_lightweight_checkout_to_checkout(self):
 
57
        branch = self.make_branch('branch')
 
58
        checkout = branch.create_checkout('checkout', lightweight=True)
 
59
        self.run_bzr('reconfigure --checkout checkout')
 
60
 
 
61
    def test_no_args(self):
 
62
        branch = self.make_branch('branch')
 
63
        self.run_bzr_error(['No target configuration specified'],
 
64
                           'reconfigure', working_dir='branch')
 
65
 
 
66
    def test_checkout_to_lightweight_checkout(self):
 
67
        branch = self.make_branch('branch')
 
68
        checkout = branch.create_checkout('checkout')
 
69
        self.run_bzr('reconfigure --lightweight-checkout checkout')
 
70
 
 
71
    def test_standalone_to_use_shared(self):
 
72
        self.build_tree(['repo/'])
 
73
        tree = self.make_branch_and_tree('repo/tree')
 
74
        repo = self.make_repository('repo', shared=True)
 
75
        self.run_bzr('reconfigure --use-shared', working_dir='repo/tree')
 
76
        tree = workingtree.WorkingTree.open('repo/tree')
 
77
        self.assertNotEqual(tree.bzrdir.root_transport.base,
 
78
            tree.branch.repository.bzrdir.root_transport.base)
 
79
 
 
80
    def test_use_shared_to_standalone(self):
 
81
        repo = self.make_repository('repo', shared=True)
 
82
        branch = bzrdir.BzrDir.create_branch_convenience('repo/tree')
 
83
        self.assertNotEqual(branch.bzrdir.root_transport.base,
 
84
            branch.repository.bzrdir.root_transport.base)
 
85
        self.run_bzr('reconfigure --standalone', working_dir='repo/tree')
 
86
        tree = workingtree.WorkingTree.open('repo/tree')
 
87
        self.assertEqual(tree.bzrdir.root_transport.base,
 
88
            tree.branch.repository.bzrdir.root_transport.base)