~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lockable_files.py

  • Committer: Robert Collins
  • Date: 2006-05-04 10:36:13 UTC
  • mto: (1697.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 1701.
  • Revision ID: robertc@robertcollins.net-20060504103613-bf4d13f925aa8520
Extend LockableFiles to support break_lock() calls.

Show diffs side-by-side

added added

removed removed

Lines of Context:
107
107
            warn("file group %r was not explicitly unlocked" % self)
108
108
            self._lock.unlock()
109
109
 
 
110
    def break_lock(self):
 
111
        """Break the lock of this lockable files group if it is held.
 
112
 
 
113
        The current ui factory will be used to prompt for user conformation.
 
114
        """
 
115
        self._lock.break_lock()
 
116
 
110
117
    def _escape(self, file_or_path):
111
118
        if not isinstance(file_or_path, basestring):
112
119
            file_or_path = '/'.join(file_or_path)
244
251
            #note('unlocking %s', self)
245
252
            #traceback.print_stack()
246
253
            self._finish_transaction()
247
 
            self._lock.unlock()
248
 
            self._lock_mode = self._lock_count = None
 
254
            try:
 
255
                self._lock.unlock()
 
256
            finally:
 
257
                self._lock_mode = self._lock_count = None
249
258
 
250
259
    def is_locked(self):
251
260
        """Return true if this LockableFiles group is locked"""
296
305
        self._file_modebits = file_modebits
297
306
        self._dir_modebits = dir_modebits
298
307
 
 
308
    def break_lock(self):
 
309
        raise NotImplementedError(self.break_lock)
 
310
 
299
311
    def lock_write(self):
300
312
        self._lock = self._transport.lock_write(self._escaped_name)
301
313