~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Alexander Belchenko
  • Date: 2006-07-30 16:43:12 UTC
  • mto: (1711.2.111 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1906.
  • Revision ID: bialix@ukr.net-20060730164312-b025fd3ff0cee59e
rename  gpl.txt => COPYING.txt

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007 Canonical Ltd
 
1
# Copyright (C) 2006 by 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
20
20
import os
21
21
import re
22
22
 
23
 
from bzrlib import (
24
 
    branch as _mod_branch,
25
 
    )
26
23
from bzrlib.bzrdir import BzrDirMetaFormat1
27
 
from bzrlib.tests import TestSkipped
28
24
from bzrlib.tests.blackbox import ExternalBase
29
25
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
30
26
from bzrlib.workingtree import WorkingTree
76
72
        out, err = self.run_bzr('init', 'subdir2/nothere', retcode=3)
77
73
        self.assertEqual('', out)
78
74
        self.assertContainsRe(err,
79
 
            r'^bzr: ERROR: No such file: .*'
80
 
            '\[Err(no|or) 2\]')
 
75
            r'^bzr: ERROR: .*'
 
76
            '\[Errno 2\] No such file or directory: ')
81
77
        
82
78
        os.mkdir('subdir2')
83
79
        out, err = self.run_bzr('init', 'subdir2')
97
93
 
98
94
    def test_init_existing_without_workingtree(self):
99
95
        # make a repository
100
 
        repo = self.make_repository('.', shared=True)
101
 
        repo.set_make_working_trees(False)
 
96
        self.run_bzr('init-repo', '.')
102
97
        # make a branch; by default without a working tree
103
98
        self.run_bzr('init', 'subdir')
104
99
        # fail
111
106
        self.run_bzr('init')
112
107
        self.assertFalse(os.path.exists('.bzrignore'))
113
108
 
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
 
 
123
109
 
124
110
class TestSFTPInit(TestCaseWithSFTPServer):
125
111
 
138
124
 
139
125
        # make sure using 'bzr checkout' is not suggested
140
126
        # for remote locations missing a working tree
141
 
        self.assertFalse(re.search(r'use bzr checkout', err))
 
127
        self.assertFalse(re.search(r'checkout', err))
142
128
 
143
129
    def test_init_existing_branch_with_workingtree(self):
144
130
        # don't distinguish between the branch having a working tree or not
147
133
 
148
134
        # rely on SFTPServer get_url() pointing at '.'
149
135
        self.run_bzr_error(['Already a branch'], 'init', self.get_url())
150
 
 
151
 
    def test_init_append_revisions_only(self):
152
 
        self.run_bzr('init', '--dirstate-tags', 'normal_branch6')
153
 
        branch = _mod_branch.Branch.open('normal_branch6')
154
 
        self.assertEqual(False, branch._get_append_revisions_only())
155
 
        self.run_bzr('init', '--append-revisions-only',
156
 
                     '--dirstate-tags', 'branch6')
157
 
        branch = _mod_branch.Branch.open('branch6')
158
 
        self.assertEqual(True, branch._get_append_revisions_only())
159
 
        self.run_bzr_error(['cannot be set to append-revisions-only'], 'init',
160
 
            '--append-revisions-only', '--knit', 'knit')