159
159
# Remove the sticky and execute bits for files
160
160
self._file_mode = self._dir_mode & ~07111
162
@deprecated_method(deprecated_in((1, 6, 0)))
163
def controlfilename(self, file_or_path):
164
"""Return location relative to branch.
166
:deprecated: Use Transport methods instead.
168
return self._transport.abspath(self._escape(file_or_path))
171
@deprecated_method(deprecated_in((1, 5, 0)))
172
def get(self, relpath):
173
"""Get a file as a bytestream.
175
:deprecated: Use a Transport instead of LockableFiles.
177
relpath = self._escape(relpath)
178
return self._transport.get(relpath)
181
@deprecated_method(deprecated_in((1, 5, 0)))
182
def get_utf8(self, relpath):
183
"""Get a file as a unicode stream.
185
:deprecated: Use a Transport instead of LockableFiles.
187
relpath = self._escape(relpath)
188
# DO NOT introduce an errors=replace here.
189
return codecs.getreader('utf-8')(self._transport.get(relpath))
192
@deprecated_method(deprecated_in((1, 6, 0)))
193
def put(self, path, file):
196
:param path: The path to put the file, relative to the .bzr control
198
:param file: A file-like or string object whose contents should be copied.
200
:deprecated: Use Transport methods instead.
202
self._transport.put_file(self._escape(path), file, mode=self._file_mode)
205
@deprecated_method(deprecated_in((1, 6, 0)))
206
def put_bytes(self, path, a_string):
207
"""Write a string of bytes.
209
:param path: The path to put the bytes, relative to the transport root.
210
:param a_string: A string object, whose exact bytes are to be copied.
212
:deprecated: Use Transport methods instead.
214
self._transport.put_bytes(self._escape(path), a_string,
215
mode=self._file_mode)
218
@deprecated_method(deprecated_in((1, 6, 0)))
219
def put_utf8(self, path, a_string):
220
"""Write a string, encoding as utf-8.
222
:param path: The path to put the string, relative to the transport root.
223
:param string: A string or unicode object whose contents should be copied.
225
:deprecated: Use Transport methods instead.
227
# IterableFile would not be needed if Transport.put took iterables
228
# instead of files. ADHB 2005-12-25
229
# RBC 20060103 surely its not needed anyway, with codecs transcode
231
# JAM 20060103 We definitely don't want encode(..., 'replace')
232
# these are valuable files which should have exact contents.
233
if not isinstance(a_string, basestring):
234
raise errors.BzrBadParameterNotString(a_string)
235
self.put_bytes(path, a_string.encode('utf-8'))
237
162
def leave_in_place(self):
238
163
"""Set this LockableFiles to not clear the physical lock on unlock."""
239
164
self._lock.leave_in_place()