~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bzrdir.py

  • Committer: John Arbash Meinel
  • Date: 2007-02-13 20:33:57 UTC
  • mfrom: (2283 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2294.
  • Revision ID: john@arbash-meinel.com-20070213203357-b7yg41mi9sk6cqd0
[merge] bzr.dev 2283
resolve conflicts in moved repository formats
small issue with osutils.contains_whitespace()

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 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
26
26
    help_topics,
27
27
    symbol_versioning,
28
28
    urlutils,
 
29
    workingtree,
29
30
    )
30
31
import bzrlib.branch
31
32
import bzrlib.bzrdir as bzrdir
39
40
from bzrlib.tests.HttpServer import HttpServer
40
41
from bzrlib.transport import get_transport
41
42
from bzrlib.transport.memory import MemoryServer
42
 
import bzrlib.workingtree as workingtree
 
43
from bzrlib.repofmt import knitrepo, weaverepo
43
44
 
44
45
 
45
46
class TestDefaultFormat(TestCase):
71
72
        my_format_registry.register_lazy('lazy', 'bzrlib.bzrdir', 
72
73
            'BzrDirFormat6', 'Format registered lazily', deprecated=True)
73
74
        my_format_registry.register_metadir('knit', 'RepositoryFormatKnit1',
74
 
            'Format using knits')
 
75
            'Format using knits',
 
76
            repo_module='bzrlib.repofmt.knitrepo')
75
77
        my_format_registry.set_default('knit')
76
 
        my_format_registry.register_metadir('metaweave', 'RepositoryFormat7',
77
 
            'Transitional format in 0.8.  Slower than knit.', deprecated=True)
78
 
        my_format_registry.register_metadir('experimental-knit2', 
 
78
        my_format_registry.register_metadir('experimental-knit2',
79
79
                                            'RepositoryFormatKnit2',
80
 
            'Experimental successor to knit.  Use at your own risk.')
 
80
            'Experimental successor to knit.  Use at your own risk.',
 
81
            repo_module='bzrlib.repofmt.knitrepo')
81
82
        return my_format_registry
82
83
 
83
84
    def test_format_registry(self):
88
89
        self.assertIsInstance(my_bzrdir, bzrdir.BzrDirFormat6)
89
90
        my_bzrdir = my_format_registry.make_bzrdir('default')
90
91
        self.assertIsInstance(my_bzrdir.repository_format, 
91
 
            repository.RepositoryFormatKnit1)
 
92
            knitrepo.RepositoryFormatKnit1)
92
93
        my_bzrdir = my_format_registry.make_bzrdir('knit')
93
94
        self.assertIsInstance(my_bzrdir.repository_format, 
94
 
            repository.RepositoryFormatKnit1)
95
 
        my_bzrdir = my_format_registry.make_bzrdir('metaweave')
96
 
        self.assertIsInstance(my_bzrdir.repository_format, 
97
 
            repository.RepositoryFormat7)
 
95
            knitrepo.RepositoryFormatKnit1)
98
96
 
99
97
    def test_get_help(self):
100
98
        my_format_registry = self.make_format_registry()
124
122
        default_factory = bzrdir.format_registry.get('default')
125
123
        old_default = [k for k, v in bzrdir.format_registry.iteritems()
126
124
                       if v == default_factory and k != 'default'][0]
127
 
        bzrdir.format_registry.set_default_repository('metaweave')
 
125
        bzrdir.format_registry.set_default_repository('experimental-knit2')
128
126
        try:
129
 
            self.assertIs(bzrdir.format_registry.get('metaweave'),
 
127
            self.assertIs(bzrdir.format_registry.get('experimental-knit2'),
130
128
                          bzrdir.format_registry.get('default'))
131
129
            self.assertIs(
132
130
                repository.RepositoryFormat.get_default_format().__class__,
133
 
                repository.RepositoryFormat7)
 
131
                knitrepo.RepositoryFormatKnit2)
134
132
        finally:
135
133
            bzrdir.format_registry.set_default_repository(old_default)
136
134
 
482
480
        repository_base = t.clone('repository').base
483
481
        self.assertEqual(repository_base, dir.get_repository_transport(None).base)
484
482
        self.assertEqual(repository_base,
485
 
                         dir.get_repository_transport(repository.RepositoryFormat7()).base)
 
483
                         dir.get_repository_transport(weaverepo.RepositoryFormat7()).base)
486
484
        checkout_base = t.clone('checkout').base
487
485
        self.assertEqual(checkout_base, dir.get_workingtree_transport(None).base)
488
486
        self.assertEqual(checkout_base,