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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
18
"""Test "bzr init"""
44
45
# --format=weave should be accepted to allow interoperation with
45
46
# old releases when desired.
46
47
out, err = self.run_bzr('init --format=weave')
47
self.assertEqual('', out)
48
self.assertEqual("""Created a standalone tree (format: weave)\n""",
48
50
self.assertEqual('', err)
50
52
def test_init_at_repository_root(self):
57
59
repo = newdir.create_repository(shared=True)
58
60
repo.set_make_working_trees(False)
59
61
out, err = self.run_bzr('init repo')
60
self.assertEqual('', out)
62
self.assertEqual("""Created a repository tree (format: pack-0.92)
63
Using shared repository: %s
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")
61
68
self.assertEqual('', err)
62
69
newdir.open_branch()
63
70
newdir.open_workingtree()
65
72
def test_init_branch(self):
66
73
out, err = self.run_bzr('init')
67
self.assertEqual('', out)
74
self.assertEqual("""Created a standalone tree (format: pack-0.92)\n""",
68
76
self.assertEqual('', err)
70
78
# Can it handle subdirectories of branches too ?
71
79
out, err = self.run_bzr('init subdir1')
72
self.assertEqual('', out)
80
self.assertEqual("""Created a standalone tree (format: pack-0.92)\n""",
73
82
self.assertEqual('', err)
74
83
WorkingTree.open('subdir1')
76
85
self.run_bzr_error(['Parent directory of subdir2/nothere does not exist'],
77
86
'init subdir2/nothere')
78
87
out, err = self.run_bzr('init subdir2/nothere', retcode=3)
79
88
self.assertEqual('', out)
81
90
os.mkdir('subdir2')
82
91
out, err = self.run_bzr('init subdir2')
83
self.assertEqual('', out)
92
self.assertEqual("""Created a standalone tree (format: pack-0.92)\n""",
84
94
self.assertEqual('', err)
85
95
# init an existing branch.
86
96
out, err = self.run_bzr('init subdir2', retcode=3)
87
97
self.assertEqual('', out)
88
98
self.failUnless(err.startswith('bzr: ERROR: Already a branch:'))
100
def test_init_branch_quiet(self):
101
out, err = self.run_bzr('init -q')
102
self.assertEqual('', out)
103
self.assertEqual('', err)
90
105
def test_init_existing_branch(self):
91
106
self.run_bzr('init')
92
107
out, err = self.run_bzr('init', retcode=3)
118
133
except UnicodeError:
119
134
raise TestSkipped("Unable to create Unicode filename")
120
135
# try to init unicode dir
121
self.run_bzr(['init', u'mu-\xb5'])
136
self.run_bzr(['init', '-q', u'mu-\xb5'])
123
138
def create_simple_tree(self):
124
139
tree = self.make_branch_and_tree('tree')
142
157
def test_init(self):
143
158
# init on a remote url should succeed.
144
159
out, err = self.run_bzr(['init', self.get_url()])
145
self.assertEqual('', out)
160
self.assertEqual(out,
161
"""Created a standalone branch (format: pack-0.92)\n""")
146
162
self.assertEqual('', err)
148
164
def test_init_existing_branch(self):
149
165
# when there is already a branch present, make mention
150
166
self.make_branch('.')