~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Robert Collins
  • Date: 2007-04-19 02:27:44 UTC
  • mto: This revision was merged to the branch mainline in revision 2426.
  • Revision ID: robertc@robertcollins.net-20070419022744-pfdqz42kp1wizh43
``make docs`` now creates a man page at ``man1/bzr.1`` fixing bug 107388.
(Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 Canonical Ltd
 
1
# Copyright (C) 2006, 2007 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
24
24
    branch as _mod_branch,
25
25
    )
26
26
from bzrlib.bzrdir import BzrDirMetaFormat1
 
27
from bzrlib.tests import TestSkipped
27
28
from bzrlib.tests.blackbox import ExternalBase
28
29
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
29
30
from bzrlib.workingtree import WorkingTree
75
76
        out, err = self.run_bzr('init', 'subdir2/nothere', retcode=3)
76
77
        self.assertEqual('', out)
77
78
        self.assertContainsRe(err,
78
 
            r'^bzr: ERROR: .*'
79
 
            '\[Errno 2\] No such file or directory')
 
79
            r'^bzr: ERROR: No such file: .*'
 
80
            '\[Err(no|or) 2\]')
80
81
        
81
82
        os.mkdir('subdir2')
82
83
        out, err = self.run_bzr('init', 'subdir2')
96
97
 
97
98
    def test_init_existing_without_workingtree(self):
98
99
        # make a repository
99
 
        self.run_bzr('init-repo', '.')
 
100
        repo = self.make_repository('.', shared=True)
 
101
        repo.set_make_working_trees(False)
100
102
        # make a branch; by default without a working tree
101
103
        self.run_bzr('init', 'subdir')
102
104
        # fail
109
111
        self.run_bzr('init')
110
112
        self.assertFalse(os.path.exists('.bzrignore'))
111
113
 
 
114
    def test_init_unicode(self):
 
115
        # Make sure getcwd can handle unicode filenames
 
116
        try:
 
117
            os.mkdir(u'mu-\xb5')
 
118
        except UnicodeError:
 
119
            raise TestSkipped("Unable to create Unicode filename")
 
120
        # try to init unicode dir
 
121
        self.run_bzr('init', u'mu-\xb5')
 
122
 
112
123
 
113
124
class TestSFTPInit(TestCaseWithSFTPServer):
114
125
 
138
149
        self.run_bzr_error(['Already a branch'], 'init', self.get_url())
139
150
 
140
151
    def test_init_append_revisions_only(self):
141
 
        self.run_bzr('init', '--experimental-branch6', 'normal_branch6')
 
152
        self.run_bzr('init', '--dirstate-tags', 'normal_branch6')
142
153
        branch = _mod_branch.Branch.open('normal_branch6')
143
154
        self.assertEqual(False, branch._get_append_revisions_only())
144
155
        self.run_bzr('init', '--append-revisions-only',
145
 
                     '--experimental-branch6', 'branch6')
 
156
                     '--dirstate-tags', 'branch6')
146
157
        branch = _mod_branch.Branch.open('branch6')
147
158
        self.assertEqual(True, branch._get_append_revisions_only())
148
159
        self.run_bzr_error(['cannot be set to append-revisions-only'], 'init',