~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/local.py

  • Committer: Wouter van Heyst
  • Date: 2006-07-13 18:18:00 UTC
  • mfrom: (1863 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1867.
  • Revision ID: larstiq@larstiq.dyndns.org-20060713181800-4e8c4f9326597d7f
[merge] bzr.dev 1863

Show diffs side-by-side

added added

removed removed

Lines of Context:
172
172
    def append(self, relpath, f, mode=None):
173
173
        """Append the text in the file-like object into the final location."""
174
174
        abspath = self._abspath(relpath)
 
175
        fp = None
175
176
        try:
176
 
            fp = open(abspath, 'ab')
177
 
            # FIXME should we really be chmodding every time ? RBC 20060523
178
 
            if mode is not None:
179
 
                os.chmod(abspath, mode)
180
 
        except (IOError, OSError),e:
181
 
            self._translate_error(e, relpath)
182
 
        # win32 workaround (tell on an unwritten file returns 0)
183
 
        fp.seek(0, 2)
184
 
        result = fp.tell()
185
 
        self._pump(f, fp)
 
177
            try:
 
178
                fp = open(abspath, 'ab')
 
179
                # FIXME should we really be chmodding every time ? RBC 20060523
 
180
                if mode is not None:
 
181
                    os.chmod(abspath, mode)
 
182
            except (IOError, OSError),e:
 
183
                self._translate_error(e, relpath)
 
184
            # win32 workaround (tell on an unwritten file returns 0)
 
185
            fp.seek(0, 2)
 
186
            result = fp.tell()
 
187
            self._pump(f, fp)
 
188
        finally:
 
189
            if fp is not None:
 
190
                fp.close()
186
191
        return result
187
192
 
188
193
    def copy(self, rel_from, rel_to):