##// END OF EJS Templates
lock: factor out lock testing into a separate function...
Siddharth Agarwal -
r26291:1d33842c default
parent child Browse files
Show More
@@ -113,18 +113,7 b' class lock(object):'
113 113 return None
114 114 raise
115 115
116 def testlock(self):
117 """return id of locker if lock is valid, else None.
118
119 If old-style lock, we cannot tell what machine locker is on.
120 with new-style lock, if locker is on this machine, we can
121 see if locker is alive. If locker is on this machine but
122 not alive, we can safely break lock.
123
124 The lock file is only deleted when None is returned.
125
126 """
127 locker = self._readlock()
116 def _testlock(self, locker):
128 117 if locker is None:
129 118 return None
130 119 try:
@@ -148,6 +137,20 b' class lock(object):'
148 137 except error.LockError:
149 138 return locker
150 139
140 def testlock(self):
141 """return id of locker if lock is valid, else None.
142
143 If old-style lock, we cannot tell what machine locker is on.
144 with new-style lock, if locker is on this machine, we can
145 see if locker is alive. If locker is on this machine but
146 not alive, we can safely break lock.
147
148 The lock file is only deleted when None is returned.
149
150 """
151 locker = self._readlock()
152 return self._testlock(locker)
153
151 154 def release(self):
152 155 """release the lock and execute callback function if any
153 156
General Comments 0
You need to be logged in to leave comments. Login now