/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Robert Collins
  • Date: 2007-11-07 13:10:37 UTC
  • mfrom: (2974 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2975.
  • Revision ID: robertc@robertcollins.net-20071107131037-1sl8cq53pxb9qzhv
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
from bzrlib import symbol_versioning
58
58
from bzrlib.symbol_versioning import (
59
59
    deprecated_function,
 
60
    zero_ninetythree,
60
61
    )
61
62
from bzrlib.trace import mutter
62
63
 
68
69
# OR with 0 on those platforms
69
70
O_BINARY = getattr(os, 'O_BINARY', 0)
70
71
 
71
 
# On posix, use lstat instead of stat so that we can
72
 
# operate on broken symlinks. On Windows revert to stat.
73
 
lstat = getattr(os, 'lstat', os.stat)
74
72
 
75
73
def make_readonly(filename):
76
74
    """Make a filename read-only."""
77
 
    mod = lstat(filename).st_mode
 
75
    mod = os.lstat(filename).st_mode
78
76
    if not stat.S_ISLNK(mod):
79
77
        mod = mod & 0777555
80
78
        os.chmod(filename, mod)
81
79
 
82
80
 
83
81
def make_writable(filename):
84
 
    mod = lstat(filename).st_mode
 
82
    mod = os.lstat(filename).st_mode
85
83
    if not stat.S_ISLNK(mod):
86
84
        mod = mod | 0200
87
85
        os.chmod(filename, mod)
463
461
        return pathjoin(F(p), e)
464
462
 
465
463
 
 
464
@deprecated_function(zero_ninetythree)
466
465
def backup_file(fn):
467
466
    """Copy a file to a backup.
468
467