changeset 18946:3d4f41eaae67

localrepo: use vfs instead of "os.path.*" in sharedpath checking In the point of view of efficiency, "vfs" instance created in this patch should be passed to and reuse in "store.store()" invocation just after patched code block, because "store" object is initialized by vfs created with "self.sharedpath". eBut to focus just on migration from direct file I/O API accessing to vfs, this patch uses created vfs as temporary one. Refactoring around "store.store()" invocation will be done in the future.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Mon, 15 Apr 2013 01:22:15 +0900
parents e75b72fffdfe
children 9b82f93e3a7a
files mercurial/localrepo.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Mon Apr 15 01:22:15 2013 +0900
+++ b/mercurial/localrepo.py	Mon Apr 15 01:22:15 2013 +0900
@@ -209,8 +209,10 @@
 
         self.sharedpath = self.path
         try:
-            s = os.path.realpath(self.opener.read("sharedpath").rstrip('\n'))
-            if not os.path.exists(s):
+            vfs = scmutil.vfs(self.vfs.read("sharedpath").rstrip('\n'),
+                              realpath=True)
+            s = vfs.base
+            if not vfs.exists():
                 raise error.RepoError(
                     _('.hg/sharedpath points to nonexistent directory %s') % s)
             self.sharedpath = s