~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/local.py

  • Committer: John Arbash Meinel
  • Date: 2012-09-14 07:22:49 UTC
  • mfrom: (6015.57.3 2.4)
  • mto: (6015.57.7 2.4)
  • mto: This revision was merged to the branch mainline in revision 6579.
  • Revision ID: john@arbash-meinel.com-20120914072249-rvpderuqqme7sy88
Merge bzr/2.4 (6072) into client-reconnect code.

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."""
354
355
        if mode is not None and mode != S_IMODE(st.st_mode):
355
356
            # Because of umask, we may still need to chmod the file.
356
357
            # But in the general case, we won't have to
357
 
            os.chmod(file_abspath, mode)
 
358
            osutils.chmod_if_possible(file_abspath, mode)
358
359
        return st.st_size
359
360
 
360
361
    def append_file(self, relpath, f, mode=None):
453
454
                    otherpath = other._abspath(path)
454
455
                    shutil.copy(mypath, otherpath)
455
456
                    if mode is not None:
456
 
                        os.chmod(otherpath, mode)
 
457
                        osutils.chmod_if_possible(otherpath, mode)
457
458
                except (IOError, OSError),e:
458
459
                    self._translate_error(e, path)
459
460
                count += 1