1
# Copyright (C) 2006-2010 Canonical Ltd
1
# Copyright (C) 2006, 2007 Canonical Ltd
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
55
50
self.assertEqual('', err)
57
def test_init_format_2a(self):
58
"""Smoke test for constructing a format 2a repoistory."""
59
out, err = self.run_bzr('init --format=2a')
60
self.assertEqual("""Created a standalone tree (format: 2a)\n""",
62
self.assertEqual('', err)
64
52
def test_init_at_repository_root(self):
65
53
# bzr init at the root of a repository should create a branch
66
54
# and working tree even when creation of working trees is disabled.
71
59
repo = newdir.create_repository(shared=True)
72
60
repo.set_make_working_trees(False)
73
61
out, err = self.run_bzr('init repo')
74
self.assertEqual("""Created a repository tree (format: %s)
62
self.assertEqual("""Created a repository tree (format: pack-0.92)
75
63
Using shared repository: %s
76
""" % (self._default_label, urlutils.local_path_from_url(
77
repo.bzrdir.root_transport.external_url())), out)
78
cwd = osutils.getcwd()
79
self.assertEndsWith(out, cwd + '/repo/\n')
64
""" % urlutils.local_path_from_url(
65
repo.bzrdir.root_transport.external_url()), out)
66
self.assertEndsWith(out, "bzrlib.tests.blackbox.test_init.TestInit."
67
"test_init_at_repository_root/work/repo/\n")
80
68
self.assertEqual('', err)
81
69
newdir.open_branch()
82
70
newdir.open_workingtree()
84
72
def test_init_branch(self):
85
73
out, err = self.run_bzr('init')
86
self.assertEqual("Created a standalone tree (format: %s)\n" % (
87
self._default_label,), out)
74
self.assertEqual("""Created a standalone tree (format: pack-0.92)\n""",
88
76
self.assertEqual('', err)
90
78
# Can it handle subdirectories of branches too ?
91
79
out, err = self.run_bzr('init subdir1')
92
self.assertEqual("Created a standalone tree (format: %s)\n" % (
93
self._default_label,), out)
80
self.assertEqual("""Created a standalone tree (format: pack-0.92)\n""",
94
82
self.assertEqual('', err)
95
83
WorkingTree.open('subdir1')
102
90
os.mkdir('subdir2')
103
91
out, err = self.run_bzr('init subdir2')
104
self.assertEqual("Created a standalone tree (format: %s)\n" % (
105
self._default_label,), out)
92
self.assertEqual("""Created a standalone tree (format: pack-0.92)\n""",
106
94
self.assertEqual('', err)
107
95
# init an existing branch.
108
96
out, err = self.run_bzr('init subdir2', retcode=3)
169
157
def test_init(self):
170
158
# init on a remote url should succeed.
171
out, err = self.run_bzr(['init', '--pack-0.92', self.get_url()])
159
out, err = self.run_bzr(['init', self.get_url()])
172
160
self.assertEqual(out,
173
161
"""Created a standalone branch (format: pack-0.92)\n""")
174
162
self.assertEqual('', err)