diff mercurial/localrepo.py @ 20091:abfe6a8e619b

lock: take both vfs and lock file path relative to vfs to access via vfs This patch makes "lock.lock.__init__()" take both vfs and lock file path relative to vfs, instead of absolute path to lock file. This allows lock file to be accessed via vfs.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Tue, 12 Nov 2013 16:23:52 +0900
parents 7cbb79bddee7
children 4c96c50ef937
line wrap: on
line diff
--- a/mercurial/localrepo.py	Tue Nov 12 16:23:52 2013 +0900
+++ b/mercurial/localrepo.py	Tue Nov 12 16:23:52 2013 +0900
@@ -1000,16 +1000,16 @@
                 pass
         self.invalidatecaches()
 
-    def _lock(self, lockname, wait, releasefn, acquirefn, desc):
+    def _lock(self, vfs, lockname, wait, releasefn, acquirefn, desc):
         try:
-            l = lockmod.lock(lockname, 0, releasefn, desc=desc)
+            l = lockmod.lock(vfs, lockname, 0, releasefn, desc=desc)
         except error.LockHeld, inst:
             if not wait:
                 raise
             self.ui.warn(_("waiting for lock on %s held by %r\n") %
                          (desc, inst.locker))
             # default to 600 seconds timeout
-            l = lockmod.lock(lockname,
+            l = lockmod.lock(vfs, lockname,
                              int(self.ui.config("ui", "timeout", "600")),
                              releasefn, desc=desc)
         if acquirefn:
@@ -1044,7 +1044,7 @@
                     continue
                 ce.refresh()
 
-        l = self._lock(self.sjoin("lock"), wait, unlock,
+        l = self._lock(self.svfs, "lock", wait, unlock,
                        self.invalidate, _('repository %s') % self.origroot)
         self._lockref = weakref.ref(l)
         return l
@@ -1062,7 +1062,7 @@
             self.dirstate.write()
             self._filecache['dirstate'].refresh()
 
-        l = self._lock(self.join("wlock"), wait, unlock,
+        l = self._lock(self.vfs, "wlock", wait, unlock,
                        self.invalidatedirstate, _('working directory of %s') %
                        self.origroot)
         self._wlockref = weakref.ref(l)