~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_init.py

  • Committer: Vincent Ladeuil
  • Date: 2009-06-22 12:52:39 UTC
  • mto: (4471.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4472.
  • Revision ID: v.ladeuil+lp@free.fr-20090622125239-kabo9smxt9c3vnir
Use a consistent scheme for naming pyrex source files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2009 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
 
18
18
"""Test "bzr init"""
22
22
 
23
23
from bzrlib import (
24
24
    branch as _mod_branch,
 
25
    urlutils,
25
26
    )
26
27
from bzrlib.bzrdir import BzrDirMetaFormat1
27
28
from bzrlib.tests import TestSkipped
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""",
 
49
            out)
 
50
        self.assertEqual('', err)
 
51
 
 
52
    def test_init_format_2a(self):
 
53
        """Smoke test for constructing a format 2a repoistory."""
 
54
        out, err = self.run_bzr('init --format=2a')
 
55
        self.assertEqual("""Created a standalone tree (format: 2a)\n""",
 
56
            out)
48
57
        self.assertEqual('', err)
49
58
 
50
59
    def test_init_at_repository_root(self):
57
66
        repo = newdir.create_repository(shared=True)
58
67
        repo.set_make_working_trees(False)
59
68
        out, err = self.run_bzr('init repo')
60
 
        self.assertEqual('', out)
 
69
        self.assertEqual("""Created a repository tree (format: pack-0.92)
 
70
Using shared repository: %s
 
71
""" % urlutils.local_path_from_url(
 
72
            repo.bzrdir.root_transport.external_url()), out)
 
73
        self.assertEndsWith(out, "bzrlib.tests.blackbox.test_init.TestInit."
 
74
            "test_init_at_repository_root/work/repo/\n")
61
75
        self.assertEqual('', err)
62
76
        newdir.open_branch()
63
77
        newdir.open_workingtree()
64
 
        
 
78
 
65
79
    def test_init_branch(self):
66
80
        out, err = self.run_bzr('init')
67
 
        self.assertEqual('', out)
 
81
        self.assertEqual("""Created a standalone tree (format: pack-0.92)\n""",
 
82
            out)
68
83
        self.assertEqual('', err)
69
84
 
70
85
        # Can it handle subdirectories of branches too ?
71
86
        out, err = self.run_bzr('init subdir1')
72
 
        self.assertEqual('', out)
 
87
        self.assertEqual("""Created a standalone tree (format: pack-0.92)\n""",
 
88
            out)
73
89
        self.assertEqual('', err)
74
90
        WorkingTree.open('subdir1')
75
 
        
 
91
 
76
92
        self.run_bzr_error(['Parent directory of subdir2/nothere does not exist'],
77
93
                            'init subdir2/nothere')
78
94
        out, err = self.run_bzr('init subdir2/nothere', retcode=3)
79
95
        self.assertEqual('', out)
80
 
        
 
96
 
81
97
        os.mkdir('subdir2')
82
98
        out, err = self.run_bzr('init subdir2')
83
 
        self.assertEqual('', out)
 
99
        self.assertEqual("""Created a standalone tree (format: pack-0.92)\n""",
 
100
            out)
84
101
        self.assertEqual('', err)
85
102
        # init an existing branch.
86
103
        out, err = self.run_bzr('init subdir2', retcode=3)
87
104
        self.assertEqual('', out)
88
105
        self.failUnless(err.startswith('bzr: ERROR: Already a branch:'))
89
106
 
 
107
    def test_init_branch_quiet(self):
 
108
        out, err = self.run_bzr('init -q')
 
109
        self.assertEqual('', out)
 
110
        self.assertEqual('', err)
 
111
 
90
112
    def test_init_existing_branch(self):
91
113
        self.run_bzr('init')
92
114
        out, err = self.run_bzr('init', retcode=3)
118
140
        except UnicodeError:
119
141
            raise TestSkipped("Unable to create Unicode filename")
120
142
        # try to init unicode dir
121
 
        self.run_bzr(['init', u'mu-\xb5'])
 
143
        self.run_bzr(['init', '-q', u'mu-\xb5'])
122
144
 
123
145
    def create_simple_tree(self):
124
146
        tree = self.make_branch_and_tree('tree')
142
164
    def test_init(self):
143
165
        # init on a remote url should succeed.
144
166
        out, err = self.run_bzr(['init', self.get_url()])
145
 
        self.assertEqual('', out)
 
167
        self.assertEqual(out,
 
168
            """Created a standalone branch (format: pack-0.92)\n""")
146
169
        self.assertEqual('', err)
147
 
    
 
170
 
148
171
    def test_init_existing_branch(self):
149
172
        # when there is already a branch present, make mention
150
173
        self.make_branch('.')