comparison mercurial/subrepo.py @ 23364:83736508e98a

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.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Wed, 19 Nov 2014 18:35:14 +0900
parents 55525924af43
children 2ff394bbfa74
comparison
equal deleted inserted replaced
23363:55525924af43 23364:83736508e98a
520 def __init__(self, ctx, path, state): 520 def __init__(self, ctx, path, state):
521 self._path = path 521 self._path = path
522 self._state = state 522 self._state = state
523 r = ctx._repo 523 r = ctx._repo
524 root = r.wjoin(path) 524 root = r.wjoin(path)
525 create = not os.path.exists(os.path.join(root, '.hg')) 525 create = not r.wvfs.exists('%s/.hg' % path)
526 self._repo = hg.repository(r.baseui, root, create=create) 526 self._repo = hg.repository(r.baseui, root, create=create)
527 for s, k in [('ui', 'commitsubrepos')]: 527 for s, k in [('ui', 'commitsubrepos')]:
528 v = r.ui.config(s, k) 528 v = r.ui.config(s, k)
529 if v: 529 if v:
530 self._repo.ui.setconfig(s, k, v, 'subrepo') 530 self._repo.ui.setconfig(s, k, v, 'subrepo')