~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/local.py

  • Committer: John Arbash Meinel
  • Date: 2006-09-05 19:34:34 UTC
  • mto: (1946.2.8 reduce-knit-churn)
  • mto: This revision was merged to the branch mainline in revision 1988.
  • Revision ID: john@arbash-meinel.com-20060905193434-2ae27ba5c50bae61
Lots of deprecation warnings, but no errors

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
import tempfile
27
27
 
28
28
from bzrlib import (
 
29
    atomicfile,
29
30
    osutils,
30
31
    urlutils,
31
32
    )
130
131
        except (IOError, OSError),e:
131
132
            self._translate_error(e, path)
132
133
 
133
 
    def put(self, relpath, f, mode=None):
134
 
        """Copy the file-like or string object into the location.
 
134
    def put_file(self, relpath, f, mode=None):
 
135
        """Copy the file-like object into the location.
135
136
 
136
137
        :param relpath: Location to put the contents, relative to base.
137
138
        :param f:       File-like or string object.
138
139
        """
139
 
        from bzrlib.atomicfile import AtomicFile
140
140
 
141
141
        path = relpath
142
142
        try:
143
143
            path = self._abspath(relpath)
144
144
            check_legal_path(path)
145
 
            fp = AtomicFile(path, 'wb', new_mode=mode)
 
145
            fp = atomicfile.AtomicFile(path, 'wb', new_mode=mode)
146
146
        except (IOError, OSError),e:
147
147
            self._translate_error(e, path)
148
148
        try:
151
151
        finally:
152
152
            fp.close()
153
153
 
 
154
    def put_bytes(self, relpath, bytes, mode=None):
 
155
        """Copy the string into the location.
 
156
 
 
157
        :param relpath: Location to put the contents, relative to base.
 
158
        :param bytes:   String
 
159
        """
 
160
 
 
161
        path = relpath
 
162
        try:
 
163
            path = self._abspath(relpath)
 
164
            check_legal_path(path)
 
165
            fp = atomicfile.AtomicFile(path, 'wb', new_mode=mode)
 
166
        except (IOError, OSError),e:
 
167
            self._translate_error(e, path)
 
168
        try:
 
169
            fp.write(bytes)
 
170
            fp.commit()
 
171
        finally:
 
172
            fp.close()
 
173
 
154
174
    def iter_files_recursive(self):
155
175
        """Iter the relative paths of files in the transports sub-tree."""
156
176
        queue = list(self.list_dir(u'.'))