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