/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: Jelmer Vernooij
  • Date: 2020-05-06 02:13:25 UTC
  • mfrom: (7490.7.21 work)
  • mto: This revision was merged to the branch mainline in revision 7501.
  • Revision ID: jelmer@jelmer.uk-20200506021325-awbmmqu1zyorz7sj
Merge 3.1 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
        """Smoke test for constructing a format 2a repository."""
52
52
        out, err = self.run_bzr('init --format=2a')
53
53
        self.assertEqual("""Created a standalone tree (format: 2a)\n""",
 
54
                         out)
 
55
        self.assertEqual('', err)
 
56
 
 
57
    def test_init_format_bzr(self):
 
58
        """Smoke test for constructing a format with the 'bzr' alias."""
 
59
        out, err = self.run_bzr('init --format=bzr')
 
60
        self.assertEqual(
 
61
            "Created a standalone tree (format: %s)\n" % self._default_label,
54
62
            out)
55
63
        self.assertEqual('', err)
56
64
 
57
65
    def test_init_colocated(self):
58
66
        """Smoke test for constructing a colocated branch."""
59
 
        out, err = self.run_bzr('init --format=development-colo file:,branch=abranch')
60
 
        self.assertEqual("""Created a lightweight checkout (format: development-colo)\n""",
61
 
            out)
 
67
        out, err = self.run_bzr(
 
68
            'init --format=development-colo file:,branch=abranch')
 
69
        self.assertEqual("""Created a standalone tree (format: development-colo)\n""",
 
70
                         out)
62
71
        self.assertEqual('', err)
63
72
        out, err = self.run_bzr('branches')
64
73
        self.assertEqual("  abranch\n", out)
98
107
        WorkingTree.open('subdir1')
99
108
 
100
109
        self.run_bzr_error(['Parent directory of subdir2/nothere does not exist'],
101
 
                            'init subdir2/nothere')
 
110
                           'init subdir2/nothere')
102
111
        out, err = self.run_bzr('init subdir2/nothere', retcode=3)
103
112
        self.assertEqual('', out)
104
113
 
153
162
    def create_simple_tree(self):
154
163
        tree = self.make_branch_and_tree('tree')
155
164
        self.build_tree(['tree/a'])
156
 
        tree.add(['a'], ['a-id'])
157
 
        tree.commit('one', rev_id='r1')
 
165
        tree.add(['a'], [b'a-id'])
 
166
        tree.commit('one', rev_id=b'r1')
158
167
        return tree
159
168
 
160
169
    def test_init_create_prefix(self):
162
171
        tree = self.create_simple_tree()
163
172
 
164
173
        self.run_bzr_error(['Parent directory of ../new/tree does not exist'],
165
 
                            'init ../new/tree', working_dir='tree')
 
174
                           'init ../new/tree', working_dir='tree')
166
175
        self.run_bzr('init ../new/tree --create-prefix', working_dir='tree')
167
176
        self.assertPathExists('new/tree/.bzr')
168
177
 
169
178
    def test_init_default_format_option(self):
170
179
        """brz init should read default format from option default_format"""
171
180
        g_store = _mod_config.GlobalStore()
172
 
        g_store._load_from_string('''
 
181
        g_store._load_from_string(b'''
173
182
[DEFAULT]
174
183
default_format = 1.9
175
184
''')
176
185
        g_store.save()
177
186
        out, err = self.run_bzr_subprocess('init')
178
 
        self.assertContainsRe(out, '1.9')
 
187
        self.assertContainsRe(out, b'1.9')
179
188
 
180
189
    def test_init_no_tree(self):
181
190
        """'brz init --no-tree' creates a branch with no working tree."""
189
198
        # init on a remote url should succeed.
190
199
        out, err = self.run_bzr(['init', '--format=pack-0.92', self.get_url()])
191
200
        self.assertEqual(out,
192
 
            """Created a standalone branch (format: pack-0.92)\n""")
 
201
                         """Created a standalone branch (format: pack-0.92)\n""")
193
202
        self.assertEqual('', err)
194
203
 
195
204
    def test_init_existing_branch(self):
216
225
        self.run_bzr('init --format=dirstate-tags normal_branch6')
217
226
        branch = _mod_branch.Branch.open('normal_branch6')
218
227
        self.assertEqual(None, branch.get_append_revisions_only())
219
 
        self.run_bzr('init --append-revisions-only --format=dirstate-tags branch6')
 
228
        self.run_bzr(
 
229
            'init --append-revisions-only --format=dirstate-tags branch6')
220
230
        branch = _mod_branch.Branch.open('branch6')
221
231
        self.assertEqual(True, branch.get_append_revisions_only())
222
232
        self.run_bzr_error(['cannot be set to append-revisions-only'],
235
245
        out, err = self.run_bzr(['init', 'foo'])
236
246
        self.assertEqual(err, '')
237
247
        self.assertTrue(os.path.exists('foo'))
238