/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/test_info.py

  • Committer: Jelmer Vernooij
  • Date: 2019-03-04 00:16:27 UTC
  • mfrom: (7293 work)
  • mto: This revision was merged to the branch mainline in revision 7318.
  • Revision ID: jelmer@jelmer.uk-20190304001627-v6u7o6pf97tukhek
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
            info.describe_layout(tree.branch.repository, control=tree.controldir))
41
41
        tree.branch.repository.set_make_working_trees(False)
42
42
        self.assertEqual('Unshared repository with colocated branches',
43
 
            info.describe_layout(tree.branch.repository, control=tree.controldir))
 
43
                         info.describe_layout(tree.branch.repository, control=tree.controldir))
44
44
        self.assertEqual('Standalone branch',
45
 
            info.describe_layout(tree.branch.repository, tree.branch,
46
 
                control=tree.controldir))
 
45
                         info.describe_layout(tree.branch.repository, tree.branch,
 
46
                                              control=tree.controldir))
47
47
        self.assertEqual('Standalone branchless tree',
48
 
            info.describe_layout(tree.branch.repository, None, tree,
49
 
                control=tree.controldir))
 
48
                         info.describe_layout(tree.branch.repository, None, tree,
 
49
                                              control=tree.controldir))
50
50
        self.assertEqual('Standalone tree',
51
 
            info.describe_layout(tree.branch.repository, tree.branch, tree,
52
 
                control=tree.controldir))
 
51
                         info.describe_layout(tree.branch.repository, tree.branch, tree,
 
52
                                              control=tree.controldir))
53
53
        tree.branch.bind(tree.branch)
54
54
        self.assertEqual('Bound branch',
55
 
            info.describe_layout(tree.branch.repository, tree.branch,
56
 
                control=tree.controldir))
 
55
                         info.describe_layout(tree.branch.repository, tree.branch,
 
56
                                              control=tree.controldir))
57
57
        self.assertEqual('Checkout',
58
 
            info.describe_layout(tree.branch.repository, tree.branch, tree,
59
 
                control=tree.controldir))
 
58
                         info.describe_layout(tree.branch.repository, tree.branch, tree,
 
59
                                              control=tree.controldir))
60
60
        checkout = tree.branch.create_checkout('checkout', lightweight=True)
61
61
        self.assertEqual('Lightweight checkout',
62
 
            info.describe_layout(checkout.branch.repository, checkout.branch,
63
 
                                 checkout, control=tree.controldir))
 
62
                         info.describe_layout(checkout.branch.repository, checkout.branch,
 
63
                                              checkout, control=tree.controldir))
64
64
 
65
65
    def test_describe_repository_layout(self):
66
66
        repository = self.make_repository('.', shared=True)
67
67
        tree = controldir.ControlDir.create_branch_convenience('tree',
68
 
            force_new_tree=True).controldir.open_workingtree()
 
68
                                                               force_new_tree=True).controldir.open_workingtree()
69
69
        self.assertEqual('Shared repository with trees and colocated branches',
70
 
            info.describe_layout(tree.branch.repository, control=tree.controldir))
 
70
                         info.describe_layout(tree.branch.repository, control=tree.controldir))
71
71
        repository.set_make_working_trees(False)
72
72
        self.assertEqual('Shared repository with colocated branches',
73
 
            info.describe_layout(tree.branch.repository, control=tree.controldir))
 
73
                         info.describe_layout(tree.branch.repository, control=tree.controldir))
74
74
        self.assertEqual('Repository branch',
75
 
            info.describe_layout(tree.branch.repository, tree.branch,
76
 
                control=tree.controldir))
 
75
                         info.describe_layout(tree.branch.repository, tree.branch,
 
76
                                              control=tree.controldir))
77
77
        self.assertEqual('Repository branchless tree',
78
 
            info.describe_layout(tree.branch.repository, None, tree,
79
 
                control=tree.controldir))
 
78
                         info.describe_layout(tree.branch.repository, None, tree,
 
79
                                              control=tree.controldir))
80
80
        self.assertEqual('Repository tree',
81
 
            info.describe_layout(tree.branch.repository, tree.branch, tree,
82
 
                control=tree.controldir))
 
81
                         info.describe_layout(tree.branch.repository, tree.branch, tree,
 
82
                                              control=tree.controldir))
83
83
        tree.branch.bind(tree.branch)
84
84
        self.assertEqual('Repository checkout',
85
 
            info.describe_layout(tree.branch.repository, tree.branch, tree,
86
 
                control=tree.controldir))
 
85
                         info.describe_layout(tree.branch.repository, tree.branch, tree,
 
86
                                              control=tree.controldir))
87
87
        checkout = tree.branch.create_checkout('checkout', lightweight=True)
88
88
        self.assertEqual('Lightweight checkout',
89
 
            info.describe_layout(checkout.branch.repository, checkout.branch,
90
 
                                 checkout, control=tree.controldir))
 
89
                         info.describe_layout(checkout.branch.repository, checkout.branch,
 
90
                                              checkout, control=tree.controldir))
91
91
 
92
92
    def assertTreeDescription(self, format):
93
93
        """Assert a tree's format description matches expectations"""
94
94
        self.make_branch_and_tree('%s_tree' % format, format=format)
95
95
        tree = workingtree.WorkingTree.open('%s_tree' % format)
96
96
        self.assertEqual(format, info.describe_format(tree.controldir,
97
 
            tree.branch.repository, tree.branch, tree))
 
97
                                                      tree.branch.repository, tree.branch, tree))
98
98
 
99
99
    def assertCheckoutDescription(self, format, expected=None):
100
100
        """Assert a checkout's format description matches expectations"""
103
103
        branch = self.make_branch('%s_cobranch' % format, format=format)
104
104
        # this ought to be easier...
105
105
        branch.create_checkout('%s_co' % format,
106
 
            lightweight=True).controldir.destroy_workingtree()
 
106
                               lightweight=True).controldir.destroy_workingtree()
107
107
        control = controldir.ControlDir.open('%s_co' % format)
108
108
        old_format = control._format.workingtree_format
109
109
        try:
110
110
            control._format.workingtree_format = \
111
 
                controldir.format_registry.make_controldir(format).workingtree_format
 
111
                controldir.format_registry.make_controldir(
 
112
                    format).workingtree_format
112
113
            control.create_workingtree()
113
114
            tree = workingtree.WorkingTree.open('%s_co' % format)
114
115
            format_description = info.describe_format(tree.controldir,
115
 
                    tree.branch.repository, tree.branch, tree)
 
116
                                                      tree.branch.repository, tree.branch, tree)
116
117
            self.assertEqual(expected, format_description,
117
 
                "checkout of format called %r was described as %r" %
118
 
                (expected, format_description))
 
118
                             "checkout of format called %r was described as %r" %
 
119
                             (expected, format_description))
119
120
        finally:
120
121
            control._format.workingtree_format = old_format
121
122
 
126
127
        self.make_branch('%s_branch' % format, format=format)
127
128
        branch = _mod_branch.Branch.open('%s_branch' % format)
128
129
        self.assertEqual(expected, info.describe_format(branch.controldir,
129
 
            branch.repository, branch, None))
 
130
                                                        branch.repository, branch, None))
130
131
 
131
132
    def assertRepoDescription(self, format, expected=None):
132
133
        """Assert repository's format description matches expectations"""
135
136
        self.make_repository('%s_repo' % format, format=format)
136
137
        repo = _mod_repository.Repository.open('%s_repo' % format)
137
138
        self.assertEqual(expected, info.describe_format(repo.controldir,
138
 
            repo, None, None))
 
139
                                                        repo, None, None))
139
140
 
140
141
    def test_describe_tree_format(self):
141
142
        for key, format in controldir.format_registry.iteritems():
209
210
        format.set_branch_format(_mod_bzrbranch.BzrBranchFormat6())
210
211
        tree = self.make_branch_and_tree('unknown', format=format)
211
212
        self.assertEqual('unnamed', info.describe_format(tree.controldir,
212
 
            tree.branch.repository, tree.branch, tree))
 
213
                                                         tree.branch.repository, tree.branch, tree))
213
214
 
214
215
    def test_gather_location_controldir_only(self):
215
216
        bzrdir = self.make_controldir('.')
216
217
        self.assertEqual([('control directory', bzrdir.user_url)],
217
 
            info.gather_location_info(control=bzrdir))
 
218
                         info.gather_location_info(control=bzrdir))
218
219
 
219
220
    def test_gather_location_standalone(self):
220
221
        tree = self.make_branch_and_tree('tree')
221
222
        self.assertEqual([('branch root', tree.controldir.root_transport.base)],
222
 
            info.gather_location_info(
223
 
                tree.branch.repository, tree.branch, tree, control=tree.controldir))
 
223
                         info.gather_location_info(
 
224
            tree.branch.repository, tree.branch, tree, control=tree.controldir))
224
225
        self.assertEqual([('branch root', tree.controldir.root_transport.base)],
225
 
            info.gather_location_info(
226
 
                tree.branch.repository, tree.branch, control=tree.controldir))
 
226
                         info.gather_location_info(
 
227
            tree.branch.repository, tree.branch, control=tree.controldir))
227
228
        return tree
228
229
 
229
230
    def test_gather_location_repo(self):
269
270
              light_checkout.controldir.root_transport.base),
270
271
             ('checkout root', checkout.controldir.root_transport.base),
271
272
             ('checkout of branch', tree.controldir.root_transport.base)],
272
 
             self.gather_tree_location_info(light_checkout)
273
 
             )
 
273
            self.gather_tree_location_info(light_checkout)
 
274
            )
274
275
 
275
276
    def test_gather_location_shared_repo_checkout(self):
276
277
        tree = self.make_branch_and_tree('tree')
281
282
              shared_checkout.controldir.root_transport.base),
282
283
             ('checkout of branch', tree.controldir.root_transport.base),
283
284
             ('shared repository', srepo.controldir.root_transport.base)],
284
 
             self.gather_tree_location_info(shared_checkout))
 
285
            self.gather_tree_location_info(shared_checkout))
285
286
 
286
287
    def gather_tree_location_info(self, tree):
287
288
        return info.gather_location_info(