~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: 2006-05-05 08:29:29 UTC
  • mfrom: (1697.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060505082929-a037ee137f1ff240
Merge break-lock command.

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"""
308
317
        self._file_modebits = file_modebits
309
318
        self._dir_modebits = dir_modebits
310
319
 
 
320
    def break_lock(self):
 
321
        raise NotImplementedError(self.break_lock)
 
322
 
311
323
    def lock_write(self):
312
324
        self._lock = self._transport.lock_write(self._escaped_name)
313
325