38
38
from bzrlib.tests import TestCaseInTempDir, TestSkipped
39
39
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
40
40
from bzrlib.transport import get_transport
41
from bzrlib.workingtree import WorkingTree
43
44
def chmod_r(base, file_mode, dir_mode):
86
87
if sys.platform == 'win32':
87
88
raise TestSkipped('chmod has no effect on win32')
89
b = Branch.initialize(u'.')
90
t = WorkingTree.create_standalone('.')
91
92
open('a', 'wb').write('foo\n')
156
157
# extra chmod calls aren't being made
157
158
import bzrlib.branch
159
b = Branch.initialize(u'.')
160
t = WorkingTree.create_standalone('.')
160
162
self.assertNotEqual(None, b._dir_mode)
161
163
self.assertNotEqual(None, b._file_mode)
191
193
mode = stat.S_IMODE(os.stat('a').st_mode)
192
b = Branch.initialize('a')
194
t = WorkingTree.create_standalone('.')
193
196
assertEqualMode(self, mode, b._dir_mode)
194
197
assertEqualMode(self, mode & ~07111, b._file_mode)
197
200
os.chmod('b', 02777)
198
b = Branch.initialize('b')
201
b = Branch.create('b')
199
202
assertEqualMode(self, 02777, b._dir_mode)
200
203
assertEqualMode(self, 00666, b._file_mode)
201
204
check_mode_r(self, 'b/.bzr', 00666, 02777)
204
207
os.chmod('c', 02750)
205
b = Branch.initialize('c')
208
b = Branch.create('c')
206
209
assertEqualMode(self, 02750, b._dir_mode)
207
210
assertEqualMode(self, 00640, b._file_mode)
208
211
check_mode_r(self, 'c/.bzr', 00640, 02750)
211
214
os.chmod('d', 0700)
212
b = Branch.initialize('d')
215
b = Branch.create('d')
213
216
assertEqualMode(self, 0700, b._dir_mode)
214
217
assertEqualMode(self, 0600, b._file_mode)
215
218
check_mode_r(self, 'd/.bzr', 00600, 0700)
231
234
_transport = SFTPTransport(self._sftp_url)
233
236
os.mkdir('local')
234
b_local = Branch.initialize(u'local')
235
t_local = b_local.working_tree()
237
t_local = WorkingTree.create_standalone('local')
238
b_local = t_local.branch
236
239
open('local/a', 'wb').write('foo\n')
238
241
t_local.commit('foo')