Show More
@@ -158,6 +158,28 b' class lock(object):' | |||
|
158 | 158 | locker = self._readlock() |
|
159 | 159 | return self._testlock(locker) |
|
160 | 160 | |
|
161 | def prepinherit(self): | |
|
162 | """prepare for the lock to be inherited by a Mercurial subprocess | |
|
163 | ||
|
164 | Returns a string that will be recognized by the lock in the | |
|
165 | subprocess. Communicating this string to the subprocess needs to be done | |
|
166 | separately -- typically by an environment variable. | |
|
167 | """ | |
|
168 | if not self.held: | |
|
169 | raise error.LockInheritanceContractViolation( | |
|
170 | 'prepinherit can only be called while lock is held') | |
|
171 | if self._inherited: | |
|
172 | raise error.LockInheritanceContractViolation( | |
|
173 | 'prepinherit cannot be called while lock is already inherited') | |
|
174 | if self.releasefn: | |
|
175 | self.releasefn() | |
|
176 | if self._parentheld: | |
|
177 | lockname = self.parentlock | |
|
178 | else: | |
|
179 | lockname = '%s:%s' % (lock._host, self.pid) | |
|
180 | self._inherited = True | |
|
181 | return lockname | |
|
182 | ||
|
161 | 183 | def release(self): |
|
162 | 184 | """release the lock and execute callback function if any |
|
163 | 185 |
General Comments 0
You need to be logged in to leave comments.
Login now