~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_info.py

  • Committer: Aaron Bentley
  • Date: 2007-03-20 15:09:49 UTC
  • mto: This revision was merged to the branch mainline in revision 2528.
  • Revision ID: abentley@panoramicfeedback.com-20070320150949-ng8lv3yxi3lkzj7p
Implement layout description

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from bzrlib import (
 
2
    bzrdir,
 
3
    info,
 
4
    tests,
 
5
    )
 
6
 
 
7
 
 
8
class TestInfo(tests.TestCaseWithTransport):
 
9
 
 
10
    def test_describe_standalone_layout(self):
 
11
        tree = self.make_branch_and_tree('tree')
 
12
        self.assertEqual('Empty control directory', info.describe_layout())
 
13
        self.assertEqual('Unshared repository with trees',
 
14
            info.describe_layout(tree.branch.repository))
 
15
        tree.branch.repository.set_make_working_trees(False)
 
16
        self.assertEqual('Unshared repository',
 
17
            info.describe_layout(tree.branch.repository))
 
18
        self.assertEqual('Standalone branch',
 
19
            info.describe_layout(tree.branch.repository, tree.branch))
 
20
        self.assertEqual('Standalone branchless tree',
 
21
            info.describe_layout(tree.branch.repository, None, tree))
 
22
        self.assertEqual('Standalone tree',
 
23
            info.describe_layout(tree.branch.repository, tree.branch, tree))
 
24
        tree.branch.bind(tree.branch)
 
25
        self.assertEqual('Bound branch',
 
26
            info.describe_layout(tree.branch.repository, tree.branch))
 
27
        self.assertEqual('Checkout',
 
28
            info.describe_layout(tree.branch.repository, tree.branch, tree))
 
29
        checkout = tree.branch.create_checkout('checkout', lightweight=True)
 
30
        self.assertEqual('Lightweight checkout',
 
31
            info.describe_layout(checkout.branch.repository, checkout.branch,
 
32
                                 checkout))
 
33
 
 
34
 
 
35
    def test_describe_repository_layout(self):
 
36
        repository = self.make_repository('.', shared=True)
 
37
        tree = bzrdir.BzrDir.create_branch_convenience('tree',
 
38
            force_new_tree=True).bzrdir.open_workingtree()
 
39
        self.assertEqual('Shared repository with trees',
 
40
            info.describe_layout(tree.branch.repository))
 
41
        repository.set_make_working_trees(False)
 
42
        self.assertEqual('Shared repository',
 
43
            info.describe_layout(tree.branch.repository))
 
44
        self.assertEqual('Repository branch',
 
45
            info.describe_layout(tree.branch.repository, tree.branch))
 
46
        self.assertEqual('Repository branchless tree',
 
47
            info.describe_layout(tree.branch.repository, None, tree))
 
48
        self.assertEqual('Repository tree',
 
49
            info.describe_layout(tree.branch.repository, tree.branch, tree))
 
50
        tree.branch.bind(tree.branch)
 
51
        self.assertEqual('Repository checkout',
 
52
            info.describe_layout(tree.branch.repository, tree.branch, tree))
 
53
        checkout = tree.branch.create_checkout('checkout', lightweight=True)
 
54
        self.assertEqual('Repository lightweight checkout',
 
55
            info.describe_layout(checkout.branch.repository, checkout.branch,
 
56
                                 checkout))