~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lockable_files.py

  • Committer: Martin Pool
  • Date: 2009-03-24 04:49:51 UTC
  • mfrom: (3407.2.20 controlfiles)
  • mto: This revision was merged to the branch mainline in revision 4202.
  • Revision ID: mbp@sourcefrog.net-20090324044951-k5h6x6u0zz4721m5
bzrdir takes responsibility for file/directory unix modes

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
from bzrlib.decorators import (needs_read_lock,
24
24
        needs_write_lock)
25
25
import bzrlib.errors as errors
 
26
from bzrlib.counted_lock import CountedLock
26
27
from bzrlib.errors import BzrError
27
28
from bzrlib.osutils import file_iterator, safe_unicode
28
29
from bzrlib.symbol_versioning import (
63
64
    This class is now deprecated; code should move to using the Transport 
64
65
    directly for file operations and using the lock or CountedLock for 
65
66
    locking.
 
67
    
 
68
    :ivar _lock: The real underlying lock (e.g. a LockDir)
 
69
    :ivar _counted_lock: A lock decorated with a semaphore, so that it 
 
70
        can be re-entered.
66
71
    """
67
72
 
68
73
    # _lock_mode: None, or 'r' or 'w'
89
94
        self._lock = lock_class(transport, esc_name,
90
95
                                file_modebits=self._file_mode,
91
96
                                dir_modebits=self._dir_mode)
 
97
        self._counted_lock = CountedLock(self._lock)
92
98
 
93
99
    def create_lock(self):
94
100
        """Create the lock.
129
135
        
130
136
        :deprecated: Replaced by BzrDir._find_modes.
131
137
        """
 
138
        # XXX: The properties created by this can be removed or deprecated
 
139
        # once all the _get_text_store methods etc no longer use them.
 
140
        # -- mbp 20080512
132
141
        try:
133
142
            st = self._transport.stat('.')
134
143
        except errors.TransportNotPossible: