changeset 1530 | abfab59fce79 |
parent 1062 | 6d5a62a549fa |
child 1559 | 59b3639df0a9 |
--- a/mercurial/lock.py Fri Nov 11 15:34:06 2005 -0800 +++ b/mercurial/lock.py Fri Nov 11 15:34:09 2005 -0800 @@ -12,10 +12,11 @@ pass class lock: - def __init__(self, file, wait=1): + def __init__(self, file, wait=1, releasefn=None): self.f = file self.held = 0 self.wait = wait + self.releasefn = releasefn self.lock() def __del__(self): @@ -43,6 +44,8 @@ def release(self): if self.held: self.held = 0 + if self.releasefn: + self.releasefn() try: os.unlink(self.f) except: pass