/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 bzrlib/tests/blackbox/test_init.py

  • Committer: Martin Pool
  • Date: 2006-04-20 07:54:15 UTC
  • mto: This revision was merged to the branch mainline in revision 1679.
  • Revision ID: mbp@sourcefrog.net-20060420075415-44c236b796c1931b
Better error message when initting existing tree

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
"""Test "bzr init"""
19
19
 
20
20
import os
 
21
import re
21
22
 
22
23
from bzrlib.bzrdir import BzrDirMetaFormat1
23
24
from bzrlib.tests.blackbox import ExternalBase
81
82
        out, err = self.run_bzr('init', 'subdir2', retcode=3)
82
83
        self.assertEqual('', out)
83
84
        self.failUnless(err.startswith('bzr: ERROR: Already a branch:'))
 
85
 
 
86
    def test_init_existing_branch(self):
 
87
        self.run_bzr('init')
 
88
        out, err = self.run_bzr('init', retcode=3)
 
89
        self.assertContainsRe(err, 'Already a branch')
 
90
        # don't suggest making a checkout, there's already a working tree
 
91
        self.assertFalse(re.search(r'checkout', err))
 
92
 
 
93
    def test_init_existing_without_workingtree(self):
 
94
        # make a repository
 
95
        self.run_bzr('init-repo', '.')
 
96
        # make a branch; by default without a working tree
 
97
        self.run_bzr('init', 'subdir')
 
98
        # fail
 
99
        out, err = self.run_bzr('init', 'subdir', retcode=3)
 
100
        # suggests using checkout
 
101
        self.assertContainsRe(err, 'ontains a branch.*but no working tree.*checkout')
 
102