Mercurial > public > mercurial-scm > hg-stable
diff mercurial/localrepo.py @ 8108:a26d33749bd8
made repo locks recursive and deprecate refcounting based lock releasing
all locks should use the explicit lock.release
mercurial.lock.lock.__del__ handles unwrapping recursive locks
localrepo.lock/wlock are still using weakref in order to keep backward
compatibiltiy to releasing locks via garbage collection
by ensuring the release on __del__
author | Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de> |
---|---|
date | Wed, 22 Apr 2009 02:01:22 +0200 |
parents | ecf7795479d5 |
children | 496ae1ea4698 |
line wrap: on
line diff
--- a/mercurial/localrepo.py Wed Apr 22 01:53:15 2009 +0200 +++ b/mercurial/localrepo.py Wed Apr 22 02:01:22 2009 +0200 @@ -683,8 +683,10 @@ return l def lock(self, wait=True): - if self._lockref and self._lockref(): - return self._lockref() + l = self._lockref and self._lockref() + if l is not None and l.held: + l.lock() + return l l = self._lock(self.sjoin("lock"), wait, None, self.invalidate, _('repository %s') % self.origroot) @@ -692,8 +694,10 @@ return l def wlock(self, wait=True): - if self._wlockref and self._wlockref(): - return self._wlockref() + l = self._wlockref and self._wlockref() + if l is not None and l.held: + l.lock() + return l l = self._lock(self.join("wlock"), wait, self.dirstate.write, self.dirstate.invalidate, _('working directory of %s') %