~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lockable_files.py

  • Committer: Jamie Wilkinson
  • Date: 2006-07-18 23:59:52 UTC
  • mfrom: (1868 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1874.
  • Revision ID: jaq@spacepants.org-20060718235952-1e362401a7858958
merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#import traceback
20
20
 
21
21
import bzrlib
22
 
from bzrlib.decorators import *
 
22
from bzrlib.decorators import (needs_read_lock,
 
23
        needs_write_lock)
23
24
import bzrlib.errors as errors
24
25
from bzrlib.errors import BzrError
25
26
from bzrlib.osutils import file_iterator, safe_unicode
26
 
from bzrlib.symbol_versioning import *
 
27
from bzrlib.symbol_versioning import (deprecated_method, 
 
28
        zero_eight)
27
29
from bzrlib.trace import mutter, note
28
30
import bzrlib.transactions as transactions
 
31
import bzrlib.urlutils as urlutils
 
32
 
29
33
 
30
34
# XXX: The tracking here of lock counts and whether the lock is held is
31
35
# somewhat redundant with what's done in LockDir; the main difference is that
73
77
        :param lock_class: Class of lock strategy to use: typically
74
78
            either LockDir or TransportLock.
75
79
        """
76
 
        object.__init__(self)
77
80
        self._transport = transport
78
81
        self.lock_name = lock_name
79
82
        self._transaction = None
80
 
        self._find_modes()
81
83
        self._lock_mode = None
82
84
        self._lock_count = 0
 
85
        self._find_modes()
83
86
        esc_name = self._escape(lock_name)
84
87
        self._lock = lock_class(transport, esc_name,
85
88
                                file_modebits=self._file_mode,
119
122
            file_or_path = '/'.join(file_or_path)
120
123
        if file_or_path == '':
121
124
            return u''
122
 
        return bzrlib.transport.urlescape(safe_unicode(file_or_path))
 
125
        return urlutils.escape(safe_unicode(file_or_path))
123
126
 
124
127
    def _find_modes(self):
125
128
        """Determine the appropriate modes for files and directories."""