comparison mercurial/localrepo.py @ 1787:e431344e604c

add a timeout when a lock is held (default 1024 sec) - change the wait keyword from lock.lock to timeout, a negative timeout of means "wait forever" - refactor the two lock functions from localrepo.py - make them use the timeout (default 1024, can be changed with ui.timeout in the config file - update the doc
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Tue, 21 Feb 2006 23:21:15 +0100
parents b9671b41e360
children 750b9cd83965
comparison
equal deleted inserted replaced
1782:b9671b41e360 1787:e431344e604c
259 l = lock.lock(self.join(lockname), 0, releasefn) 259 l = lock.lock(self.join(lockname), 0, releasefn)
260 except lock.LockHeld, inst: 260 except lock.LockHeld, inst:
261 if not wait: 261 if not wait:
262 raise inst 262 raise inst
263 self.ui.warn(_("waiting for lock held by %s\n") % inst.args[0]) 263 self.ui.warn(_("waiting for lock held by %s\n") % inst.args[0])
264 l = lock.lock(self.join(lockname), wait, releasefn) 264 try:
265 # default to 1024 seconds timeout
266 l = lock.lock(self.join(lockname),
267 int(self.ui.config("ui", "timeout") or 1024),
268 releasefn)
269 except lock.LockHeld, inst:
270 raise util.Abort(_("timeout while waiting for "
271 "lock held by %s") % inst.args[0])
265 if acquirefn: 272 if acquirefn:
266 acquirefn() 273 acquirefn()
267 return l 274 return l
268 275
269 def lock(self, wait=1): 276 def lock(self, wait=1):