/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: Robert Collins
  • Date: 2006-08-08 23:19:29 UTC
  • mfrom: (1884 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1912.
  • Revision ID: robertc@robertcollins.net-20060808231929-4e3e298190214b3a
current status

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
from bzrlib.bzrdir import BzrDirMetaFormat1
24
24
from bzrlib.tests.blackbox import ExternalBase
 
25
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
25
26
from bzrlib.workingtree import WorkingTree
26
27
 
27
28
 
70
71
        
71
72
        out, err = self.run_bzr('init', 'subdir2/nothere', retcode=3)
72
73
        self.assertEqual('', out)
73
 
        self.failUnless(err.startswith(
74
 
            'bzr: ERROR: exceptions.OSError: '
75
 
            '[Errno 2] No such file or directory: '))
 
74
        self.assertContainsRe(err,
 
75
            r'^bzr: ERROR: .*'
 
76
            '\[Errno 2\] No such file or directory: ')
76
77
        
77
78
        os.mkdir('subdir2')
78
79
        out, err = self.run_bzr('init', 'subdir2')
100
101
        # suggests using checkout
101
102
        self.assertContainsRe(err, 'ontains a branch.*but no working tree.*checkout')
102
103
 
 
104
    def test_no_defaults(self):
 
105
        """Init creates no default ignore rules."""
 
106
        self.run_bzr('init')
 
107
        self.assertFalse(os.path.exists('.bzrignore'))
 
108
 
 
109
 
 
110
class TestSFTPInit(TestCaseWithSFTPServer):
 
111
 
 
112
    def test_init(self):
 
113
        # init on a remote url should succeed.
 
114
        out, err = self.run_bzr('init', self.get_url())
 
115
        self.assertEqual('', out)
 
116
        self.assertEqual('', err)
 
117
    
 
118
    def test_init_existing_branch(self):
 
119
        # when there is already a branch present, make mention
 
120
        self.make_branch('.')
 
121
 
 
122
        # rely on SFTPServer get_url() pointing at '.'
 
123
        out, err = self.run_bzr_error(['Already a branch'], 'init', self.get_url())
 
124
 
 
125
        # make sure using 'bzr checkout' is not suggested
 
126
        # for remote locations missing a working tree
 
127
        self.assertFalse(re.search(r'checkout', err))
 
128
 
 
129
    def test_init_existing_branch_with_workingtree(self):
 
130
        # don't distinguish between the branch having a working tree or not
 
131
        # when the branch itself is remote.
 
132
        self.make_branch_and_tree('.')
 
133
 
 
134
        # rely on SFTPServer get_url() pointing at '.'
 
135
        self.run_bzr_error(['Already a branch'], 'init', self.get_url())