Mercurial > public > mercurial-scm > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/localrepo.py Tue Feb 21 16:46:38 2006 +0100 +++ b/mercurial/localrepo.py Tue Feb 21 23:21:15 2006 +0100 @@ -261,7 +261,14 @@ if not wait: raise inst self.ui.warn(_("waiting for lock held by %s\n") % inst.args[0]) - l = lock.lock(self.join(lockname), wait, releasefn) + try: + # default to 1024 seconds timeout + l = lock.lock(self.join(lockname), + int(self.ui.config("ui", "timeout") or 1024), + releasefn) + except lock.LockHeld, inst: + raise util.Abort(_("timeout while waiting for " + "lock held by %s") % inst.args[0]) if acquirefn: acquirefn() return l