~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lockable_files.py

Merge bzr.dev

Show diffs side-by-side

added added

removed removed

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