subrepo: replace "os.path.exists" by "exists" via wvfs of the parent
authorFUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Wed, 19 Nov 2014 18:35:14 +0900
changeset 23364 83736508e98a
parent 23363 55525924af43
child 23365 2ff394bbfa74
subrepo: replace "os.path.exists" by "exists" via wvfs of the parent Existance of specified "path" should be examined by "exists" via wvfs of the parent repository, because the working directory of the parent repository may be in UTF-8 mode. Wide API should be used via wvfs in such case. In this patch, "/" is used as the path separator, even though "path" uses platform specific path separator (e.g. "\\" on Windows). But it is reasonable enough, because "store" and other management file handling already include such implementation, and they work well.
mercurial/subrepo.py
--- a/mercurial/subrepo.py	Wed Nov 19 18:35:14 2014 +0900
+++ b/mercurial/subrepo.py	Wed Nov 19 18:35:14 2014 +0900
@@ -522,7 +522,7 @@
         self._state = state
         r = ctx._repo
         root = r.wjoin(path)
-        create = not os.path.exists(os.path.join(root, '.hg'))
+        create = not r.wvfs.exists('%s/.hg' % path)
         self._repo = hg.repository(r.baseui, root, create=create)
         for s, k in [('ui', 'commitsubrepos')]:
             v = r.ui.config(s, k)