1
1
# Copyright (C) 2005 by Canonical Ltd
2
2
# -*- coding: utf-8 -*-
4
4
# This program is free software; you can redistribute it and/or modify
5
5
# it under the terms of the GNU General Public License as published by
6
6
# the Free Software Foundation; either version 2 of the License, or
7
7
# (at your option) any later version.
9
9
# This program is distributed in the hope that it will be useful,
10
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
12
# GNU General Public License for more details.
14
14
# You should have received a copy of the GNU General Public License
15
15
# along with this program; if not, write to the Free Software
16
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
38
38
from bzrlib.branch import Branch
39
39
from bzrlib.bzrdir import BzrDir
40
from bzrlib.lockable_files import LockableFiles, TransportLock
40
from bzrlib.lockable_files import LockableFiles
41
41
from bzrlib.tests import TestCaseWithTransport, TestSkipped
42
42
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
43
43
from bzrlib.transport import get_transport
158
158
transport = get_transport(self.get_url())
159
159
transport.put('my-lock', StringIO(''))
160
lockable = LockableFiles(transport, 'my-lock', TransportLock)
160
lockable = LockableFiles(transport, 'my-lock')
161
161
self.assertNotEqual(None, lockable._dir_mode)
162
162
self.assertNotEqual(None, lockable._file_mode)
164
164
LockableFiles._set_dir_mode = False
165
165
transport = get_transport('.')
166
lockable = LockableFiles(transport, 'my-lock', TransportLock)
166
lockable = LockableFiles(transport, 'my-lock')
167
167
self.assertEqual(None, lockable._dir_mode)
168
168
self.assertNotEqual(None, lockable._file_mode)
170
170
LockableFiles._set_file_mode = False
171
171
transport = get_transport('.')
172
lockable = LockableFiles(transport, 'my-lock', TransportLock)
172
lockable = LockableFiles(transport, 'my-lock')
173
173
self.assertEqual(None, lockable._dir_mode)
174
174
self.assertEqual(None, lockable._file_mode)
176
176
LockableFiles._set_dir_mode = True
177
177
transport = get_transport('.')
178
lockable = LockableFiles(transport, 'my-lock', TransportLock)
178
lockable = LockableFiles(transport, 'my-lock')
179
179
self.assertNotEqual(None, lockable._dir_mode)
180
180
self.assertEqual(None, lockable._file_mode)
182
182
LockableFiles._set_file_mode = True
183
183
transport = get_transport('.')
184
lockable = LockableFiles(transport, 'my-lock', TransportLock)
184
lockable = LockableFiles(transport, 'my-lock')
185
185
self.assertNotEqual(None, lockable._dir_mode)
186
186
self.assertNotEqual(None, lockable._file_mode)
213
213
check_mode_r(self, 'local/.bzr', 0644, 0755)
215
215
t = WorkingTree.open('local')
217
217
self.assertEqualMode(0755, b_local.control_files._dir_mode)
218
218
self.assertEqualMode(0644, b_local.control_files._file_mode)