~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lockable_files.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-03-25 04:20:12 UTC
  • mfrom: (3468.3.4 controlfiles)
  • Revision ID: pqm@pqm.ubuntu.com-20090325042012-23a6pm0mraw7g2kg
(mbp) better CountedLock handling of tokens,
        and bzrdir takes more responsibility for default file modes

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
import warnings
23
23
 
24
24
from bzrlib import (
 
25
    counted_lock,
25
26
    errors,
26
27
    osutils,
27
28
    transactions,
85
86
    This class is now deprecated; code should move to using the Transport
86
87
    directly for file operations and using the lock or CountedLock for
87
88
    locking.
 
89
    
 
90
    :ivar _lock: The real underlying lock (e.g. a LockDir)
 
91
    :ivar _counted_lock: A lock decorated with a semaphore, so that it 
 
92
        can be re-entered.
88
93
    """
89
94
 
90
95
    # _lock_mode: None, or 'r' or 'w'
111
116
        self._lock = lock_class(transport, esc_name,
112
117
                                file_modebits=self._file_mode,
113
118
                                dir_modebits=self._dir_mode)
 
119
        self._counted_lock = counted_lock.CountedLock(self._lock)
114
120
 
115
121
    def create_lock(self):
116
122
        """Create the lock.
146
152
 
147
153
        :deprecated: Replaced by BzrDir._find_modes.
148
154
        """
 
155
        # XXX: The properties created by this can be removed or deprecated
 
156
        # once all the _get_text_store methods etc no longer use them.
 
157
        # -- mbp 20080512
149
158
        try:
150
159
            st = self._transport.stat('.')
151
160
        except errors.TransportNotPossible: