~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-02-22 07:59:56 UTC
  • mfrom: (1553.5.33 bzr.mbp.locks)
  • Revision ID: pqm@pqm.ubuntu.com-20060222075956-fb281c427e571da6
add LockDir and related fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 Canonical Ltd
 
1
# Copyright (C) 2005, 2006 Canonical Ltd
2
2
 
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
167
167
        # and potentially a remote locking protocol
168
168
        if self._lock_mode:
169
169
            if self._lock_mode != 'w':
170
 
                raise ReadOnlyError("can't upgrade to a write lock from %r" %
171
 
                                self._lock_mode)
 
170
                raise ReadOnlyError(self)
172
171
            self._lock_count += 1
173
172
        else:
174
173
            self._lock = self._transport.lock_write(
195
194
    def unlock(self):
196
195
        # mutter("unlock: %s (%s)", self, self._lock_count)
197
196
        if not self._lock_mode:
198
 
            raise LockError('branch %r is not locked' % (self))
199
 
 
 
197
            raise errors.BranchNotLocked(self)
200
198
        if self._lock_count > 1:
201
199
            self._lock_count -= 1
202
200
        else: