96
96
def get_format_type(typestring):
97
97
"""Parse and return a format specifier."""
98
if typestring == "weave":
99
return bzrdir.BzrDirFormat6()
98
# Have to use BzrDirMetaFormat1 directly, so that
99
# RepositoryFormat.set_default_format works
100
100
if typestring == "default":
101
101
return bzrdir.BzrDirMetaFormat1()
102
if typestring == "metaweave":
103
format = bzrdir.BzrDirMetaFormat1()
104
format.repository_format = repository.RepositoryFormat7()
106
if typestring == "knit":
107
format = bzrdir.BzrDirMetaFormat1()
108
format.repository_format = repository.RepositoryFormatKnit1()
110
if typestring == "experimental-knit2":
111
format = bzrdir.BzrDirMetaFormat1()
112
format.repository_format = repository.RepositoryFormatKnit2()
114
msg = "Unknown bzr format %s. Current formats are: default, knit,\n" \
115
"metaweave and weave" % typestring
116
raise errors.BzrCommandError(msg)
103
return bzrdir.format_registry.make_bzrdir(typestring)
105
msg = 'Unknown bzr format "%s". See "bzr help formats".' % typestring
106
raise errors.BzrCommandError(msg)
119
109
# TODO: Make sure no commands unconditionally use the working directory as a
847
old_format = bzrdir.BzrDirFormat.get_default_format()
848
bzrdir.BzrDirFormat.set_default_format(bzrdir.BzrDirMetaFormat1())
850
source.create_checkout(to_location, revision_id, lightweight)
852
bzrdir.BzrDirFormat.set_default_format(old_format)
837
source.create_checkout(to_location, revision_id, lightweight)
855
840
class cmd_renames(Command):
2065
2050
class cmd_selftest(Command):
2066
2051
"""Run internal test suite.
2068
This creates temporary test directories in the working directory,
2069
but not existing data is affected. These directories are deleted
2070
if the tests pass, or left behind to help in debugging if they
2071
fail and --keep-output is specified.
2053
This creates temporary test directories in the working directory, but not
2054
existing data is affected. These directories are deleted if the tests
2055
pass, or left behind to help in debugging if they fail and --keep-output
2073
If arguments are given, they are regular expressions that say
2074
which tests should run.
2058
If arguments are given, they are regular expressions that say which tests
2059
should run. Tests matching any expression are run, and other tests are
2062
Alternatively if --first is given, matching tests are run first and then
2063
all other tests are run. This is useful if you have been working in a
2064
particular area, but want to make sure nothing else was broken.
2076
2066
If the global option '--no-plugins' is given, plugins are not loaded
2077
2067
before running the selftests. This has two effects: features provided or
2078
2068
modified by plugins will not be tested, and tests provided by plugins will
2082
2072
bzr selftest ignore
2073
run only tests relating to 'ignore'
2083
2074
bzr --no-plugins selftest -v
2075
disable plugins and list tests as they're run
2085
2077
# TODO: --list should give a list of all available tests
2121
2113
Option('clean-output',
2122
2114
help='clean temporary tests directories'
2123
2115
' without running tests'),
2117
help='run all tests, but run specified tests first',
2125
2120
encoding_type = 'replace'
2127
2122
def run(self, testspecs_list=None, verbose=None, one=False,
2128
2123
keep_output=False, transport=None, benchmark=None,
2129
lsprof_timed=None, cache_dir=None, clean_output=False):
2124
lsprof_timed=None, cache_dir=None, clean_output=False,
2130
2126
import bzrlib.ui
2131
2127
from bzrlib.tests import selftest
2132
2128
import bzrlib.benchmarks as benchmarks
2165
2161
transport=transport,
2166
2162
test_suite_factory=test_suite_factory,
2167
2163
lsprof_timed=lsprof_timed,
2168
bench_history=benchfile)
2164
bench_history=benchfile,
2165
matching_tests_first=first,
2170
2168
if benchfile is not None:
2171
2169
benchfile.close()