mercurial/localrepo.py
changeset 8108 a26d33749bd8
parent 8072 ecf7795479d5
child 8109 496ae1ea4698
--- 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') %