~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/local.py

  • Committer: Patch Queue Manager
  • Date: 2011-12-05 14:53:57 UTC
  • mfrom: (6344.1.1 dev_2.4_integration)
  • Revision ID: pqm@pqm.ubuntu.com-20111205145357-aesrpb6b49pxzym8
(gz) Merge 2.4 into bzr.dev (Martin Packman)

Show diffs side-by-side

added added

removed removed

Lines of Context:
255
255
            if mode is not None and mode != S_IMODE(st.st_mode):
256
256
                # Because of umask, we may still need to chmod the file.
257
257
                # But in the general case, we won't have to
258
 
                os.chmod(abspath, mode)
 
258
                osutils.chmod_if_possible(abspath, mode)
259
259
            writer(fd)
260
260
        finally:
261
261
            os.close(fd)
314
314
            local_mode = mode
315
315
        try:
316
316
            os.mkdir(abspath, local_mode)
317
 
            if mode is not None:
318
 
                # It is probably faster to just do the chmod, rather than
319
 
                # doing a stat, and then trying to compare
320
 
                os.chmod(abspath, mode)
321
317
        except (IOError, OSError),e:
322
318
            self._translate_error(e, abspath)
 
319
        if mode is not None:
 
320
            try:
 
321
                osutils.chmod_if_possible(abspath, mode)
 
322
            except (IOError, OSError), e:
 
323
                self._translate_error(e, abspath)
323
324
 
324
325
    def mkdir(self, relpath, mode=None):
325
326
        """Create a directory at the given path."""
357
358
        if mode is not None and mode != S_IMODE(st.st_mode):
358
359
            # Because of umask, we may still need to chmod the file.
359
360
            # But in the general case, we won't have to
360
 
            os.chmod(file_abspath, mode)
 
361
            osutils.chmod_if_possible(file_abspath, mode)
361
362
        return st.st_size
362
363
 
363
364
    def append_file(self, relpath, f, mode=None):
456
457
                    otherpath = other._abspath(path)
457
458
                    shutil.copy(mypath, otherpath)
458
459
                    if mode is not None:
459
 
                        os.chmod(otherpath, mode)
 
460
                        osutils.chmod_if_possible(otherpath, mode)
460
461
                except (IOError, OSError),e:
461
462
                    self._translate_error(e, path)
462
463
                count += 1