Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 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 |
comparison
equal
deleted
inserted
replaced
18945:e75b72fffdfe | 18946:3d4f41eaae67 |
---|---|
207 raise | 207 raise |
208 requirements = set() | 208 requirements = set() |
209 | 209 |
210 self.sharedpath = self.path | 210 self.sharedpath = self.path |
211 try: | 211 try: |
212 s = os.path.realpath(self.opener.read("sharedpath").rstrip('\n')) | 212 vfs = scmutil.vfs(self.vfs.read("sharedpath").rstrip('\n'), |
213 if not os.path.exists(s): | 213 realpath=True) |
214 s = vfs.base | |
215 if not vfs.exists(): | |
214 raise error.RepoError( | 216 raise error.RepoError( |
215 _('.hg/sharedpath points to nonexistent directory %s') % s) | 217 _('.hg/sharedpath points to nonexistent directory %s') % s) |
216 self.sharedpath = s | 218 self.sharedpath = s |
217 except IOError, inst: | 219 except IOError, inst: |
218 if inst.errno != errno.ENOENT: | 220 if inst.errno != errno.ENOENT: |