diff --git a/mercurial/lock.py b/mercurial/lock.py --- a/mercurial/lock.py +++ b/mercurial/lock.py @@ -131,6 +131,9 @@ class lock(object): except (OSError, IOError) as why: if why.errno == errno.EEXIST: locker = self._readlock() + if locker is None: + continue + # special case where a parent process holds the lock -- this # is different from the pid being different because we do # want the unlock and postrelease functions to be called,