140
142
self._dir_mode = (st.st_mode & 07777) | 00700
141
143
# Remove the sticky and execute bits for files
142
144
self._file_mode = self._dir_mode & ~07111
143
if not self._set_dir_mode:
144
self._dir_mode = None
145
if not self._set_file_mode:
146
self._file_mode = None
146
@deprecated_method(deprecated_in((1, 6, 0)))
148
147
def controlfilename(self, file_or_path):
149
"""Return location relative to branch."""
148
"""Return location relative to branch.
150
:deprecated: Use Transport methods instead.
150
152
return self._transport.abspath(self._escape(file_or_path))
155
@deprecated_method(deprecated_in((1, 5, 0)))
153
156
def get(self, relpath):
154
"""Get a file as a bytestream."""
157
"""Get a file as a bytestream.
159
:deprecated: Use a Transport instead of LockableFiles.
155
161
relpath = self._escape(relpath)
156
162
return self._transport.get(relpath)
159
165
@deprecated_method(deprecated_in((1, 5, 0)))
160
166
def get_utf8(self, relpath):
161
"""Get a file as a unicode stream."""
167
"""Get a file as a unicode stream.
169
:deprecated: Use a Transport instead of LockableFiles.
162
171
relpath = self._escape(relpath)
163
172
# DO NOT introduce an errors=replace here.
164
173
return codecs.getreader('utf-8')(self._transport.get(relpath))
166
175
@needs_write_lock
176
@deprecated_method(deprecated_in((1, 6, 0)))
167
177
def put(self, path, file):
170
180
:param path: The path to put the file, relative to the .bzr control
172
:param f: A file-like or string object whose contents should be copied.
182
:param file: A file-like or string object whose contents should be copied.
184
:deprecated: Use Transport methods instead.
174
186
self._transport.put_file(self._escape(path), file, mode=self._file_mode)
176
188
@needs_write_lock
189
@deprecated_method(deprecated_in((1, 6, 0)))
177
190
def put_bytes(self, path, a_string):
178
191
"""Write a string of bytes.
180
193
:param path: The path to put the bytes, relative to the transport root.
181
:param string: A string object, whose exact bytes are to be copied.
194
:param a_string: A string object, whose exact bytes are to be copied.
196
:deprecated: Use Transport methods instead.
183
198
self._transport.put_bytes(self._escape(path), a_string,
184
199
mode=self._file_mode)
186
201
@needs_write_lock
202
@deprecated_method(deprecated_in((1, 6, 0)))
187
203
def put_utf8(self, path, a_string):
188
204
"""Write a string, encoding as utf-8.
190
206
:param path: The path to put the string, relative to the transport root.
191
207
:param string: A string or unicode object whose contents should be copied.
209
:deprecated: Use Transport methods instead.
193
211
# IterableFile would not be needed if Transport.put took iterables
194
212
# instead of files. ADHB 2005-12-25