~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-06-21 23:43:17 UTC
  • mto: (2520.5.2 bzr.mpbundle)
  • mto: This revision was merged to the branch mainline in revision 2631.
  • Revision ID: abentley@panoramicfeedback.com-20070621234317-5w3h8h36oe90sups
Implement new merge directive format

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2010 Canonical Ltd
 
1
# Copyright (C) 2007 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
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
 
import sys
18
 
from urllib import quote
19
17
 
20
18
from bzrlib import (
21
19
    branch as _mod_branch,
98
96
                bzrdir.format_registry.make_bzrdir(format).workingtree_format
99
97
            control.create_workingtree()
100
98
            tree = workingtree.WorkingTree.open('%s_co' % format)
101
 
            format_description = info.describe_format(tree.bzrdir,
102
 
                    tree.branch.repository, tree.branch, tree)
103
 
            self.assertEqual(expected, format_description,
104
 
                "checkout of format called %r was described as %r" %
105
 
                (expected, format_description))
 
99
            self.assertEqual(expected, info.describe_format(tree.bzrdir,
 
100
                tree.branch.repository, tree.branch, tree))
106
101
        finally:
107
102
            control._format.workingtree_format = old_format
108
103
 
126
121
 
127
122
    def test_describe_tree_format(self):
128
123
        for key in bzrdir.format_registry.keys():
129
 
            if key in bzrdir.format_registry.aliases():
 
124
            if key == 'default':
130
125
                continue
131
126
            self.assertTreeDescription(key)
132
127
 
133
128
    def test_describe_checkout_format(self):
134
129
        for key in bzrdir.format_registry.keys():
135
 
            if key in bzrdir.format_registry.aliases():
136
 
                # Aliases will not describe correctly in the UI because the
137
 
                # real format is found.
138
 
                continue
139
 
            # legacy: weave does not support checkouts
140
 
            if key == 'weave':
141
 
                continue
142
 
            if bzrdir.format_registry.get_info(key).experimental:
143
 
                # We don't require that experimental formats support checkouts
144
 
                # or describe correctly in the UI.
145
 
                continue
146
 
            if bzrdir.format_registry.get_info(key).hidden:
 
130
            if key in ('default', 'weave'):
147
131
                continue
148
132
            expected = None
149
 
            if key in ('pack-0.92',):
150
 
                expected = 'pack-0.92'
151
 
            elif key in ('knit', 'metaweave'):
 
133
            if key in ('dirstate', 'dirstate-tags', 'dirstate-with-subtree'):
 
134
                expected = 'dirstate or dirstate-tags'
 
135
            if key in ('knit', 'metaweave'):
152
136
                expected = 'knit or metaweave'
153
 
            elif key in ('1.14', '1.14-rich-root'):
154
 
                expected = '1.14 or 1.14-rich-root'
155
137
            self.assertCheckoutDescription(key, expected)
156
138
 
157
139
    def test_describe_branch_format(self):
158
140
        for key in bzrdir.format_registry.keys():
159
 
            if key in bzrdir.format_registry.aliases():
160
 
                continue
161
 
            if bzrdir.format_registry.get_info(key).hidden:
 
141
            if key == 'default':
162
142
                continue
163
143
            expected = None
164
144
            if key in ('dirstate', 'knit'):
165
145
                expected = 'dirstate or knit'
166
 
            elif key in ('1.14',):
167
 
                expected = '1.14'
168
 
            elif key in ('1.14-rich-root',):
169
 
                expected = '1.14-rich-root'
170
146
            self.assertBranchDescription(key, expected)
171
147
 
172
148
    def test_describe_repo_format(self):
173
149
        for key in bzrdir.format_registry.keys():
174
 
            if key in bzrdir.format_registry.aliases():
175
 
                continue
176
 
            if bzrdir.format_registry.get_info(key).hidden:
 
150
            if key == 'default':
177
151
                continue
178
152
            expected = None
179
153
            if key in ('dirstate', 'knit', 'dirstate-tags'):
180
154
                expected = 'dirstate or dirstate-tags or knit'
181
 
            elif key in ('1.14',):
182
 
                expected = '1.14'
183
 
            elif key in ('1.14-rich-root',):
184
 
                expected = '1.14-rich-root'
185
155
            self.assertRepoDescription(key, expected)
186
156
 
187
157
        format = bzrdir.format_registry.make_bzrdir('metaweave')
217
187
        tree = self.make_branch_and_tree('shared/tree')
218
188
        self.assertEqual([('shared repository',
219
189
                          srepo.bzrdir.root_transport.base),
220
 
                          ('repository branch', tree.branch.base)],
 
190
                          ('repository branch', 'tree')],
221
191
                          info.gather_location_info(srepo, tree.branch, tree))
222
192
 
223
193
    def test_gather_location_light_checkout(self):
269
239
             ('bound to branch', branch.bzrdir.root_transport.base)],
270
240
            info.gather_location_info(bound_branch.repository, bound_branch)
271
241
        )
272
 
 
273
 
    def test_location_list(self):
274
 
        if sys.platform == 'win32':
275
 
            raise tests.TestSkipped('Windows-unfriendly test')
276
 
        locs = info.LocationList('/home/foo')
277
 
        locs.add_url('a', 'file:///home/foo/')
278
 
        locs.add_url('b', 'file:///home/foo/bar/')
279
 
        locs.add_url('c', 'file:///home/bar/bar')
280
 
        locs.add_url('d', 'http://example.com/example/')
281
 
        locs.add_url('e', None)
282
 
        self.assertEqual(locs.locs, [('a', '.'),
283
 
                                     ('b', 'bar'),
284
 
                                     ('c', '/home/bar/bar'),
285
 
                                     ('d', 'http://example.com/example/')])
286
 
        self.assertEqualDiff('  a: .\n  b: bar\n  c: /home/bar/bar\n'
287
 
                             '  d: http://example.com/example/\n',
288
 
                             ''.join(locs.get_lines()))
289
 
 
290
 
    def test_gather_related_braches(self):
291
 
        branch = self.make_branch('.')
292
 
        branch.set_public_branch('baz')
293
 
        branch.set_push_location('bar')
294
 
        branch.set_parent('foo')
295
 
        branch.set_submit_branch('qux')
296
 
        self.assertEqual(
297
 
            [('public branch', 'baz'), ('push branch', 'bar'),
298
 
             ('parent branch', 'foo'), ('submit branch', 'qux')],
299
 
            info._gather_related_branches(branch).locs)