Mercurial > hg
changeset 3686:4308f4cdc07b
Don't step into an endless loop when lock file is empty.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Mon, 20 Nov 2006 19:36:28 +0100 |
parents | 193e9c6d1a6d |
children | d5dd0a2a44bc |
files | mercurial/lock.py |
diffstat | 1 files changed, 11 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/lock.py Sun Nov 19 23:47:19 2006 +0100 +++ b/mercurial/lock.py Mon Nov 20 19:36:28 2006 +0100 @@ -71,7 +71,7 @@ except (OSError, IOError), why: if why.errno == errno.EEXIST: locker = self.testlock() - if locker: + if locker is not None: raise LockHeld(errno.EAGAIN, self.f, self.desc, locker) else: @@ -79,11 +79,16 @@ why.filename, self.desc) def testlock(self): - '''return id of locker if lock is valid, else None.''' - # if old-style lock, we cannot tell what machine locker is on. - # with new-style lock, if locker is on this machine, we can - # see if locker is alive. if locker is on this machine but - # not alive, we can safely break lock. + """return id of locker if lock is valid, else None. + + If old-style lock, we cannot tell what machine locker is on. + with new-style lock, if locker is on this machine, we can + see if locker is alive. If locker is on this machine but + not alive, we can safely break lock. + + The lock file is only deleted when None is returned. + + """ locker = util.readlock(self.f) try: host, pid = locker.split(":", 1)