~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lock.py

  • Committer: Robert Collins
  • Date: 2010-05-11 08:36:16 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100511083616-b8fjb19zomwupid0
Make all lock methods return Result objects, rather than lock_read returning self, as per John's review.

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
                             self.lock_url, self.details)
89
89
 
90
90
 
 
91
class LogicalLockResult(object):
 
92
    """The result of a lock_read/lock_write/lock_tree_write call on lockables.
 
93
 
 
94
    :ivar unlock: A callable which will unlock the lock.
 
95
    """
 
96
 
 
97
    def __init__(self, unlock):
 
98
        self.unlock = unlock
 
99
 
 
100
    def __repr__(self):
 
101
        return "LogicalLockResult(%s)" % (self.unlock)
 
102
 
 
103
 
 
104
 
91
105
def cant_unlock_not_held(locked_object):
92
106
    """An attempt to unlock failed because the object was not locked.
93
107