Mercurial > public > mercurial-scm > hg
comparison mercurial/subrepo.py @ 31236:8a0687a2be75
vfs: use 'vfs' module directly in 'mercurial.subrepo'
Now that the 'vfs' classes moved in their own module, lets use the new module
directly. We update code iteratively to help with possible bisect needs in the
future.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Thu, 02 Mar 2017 13:30:38 +0100 |
parents | 96d561c90ad0 |
children | b589f5b953f4 |
comparison
equal
deleted
inserted
replaced
31235:7feab0e7702d | 31236:8a0687a2be75 |
---|---|
33 pathutil, | 33 pathutil, |
34 phases, | 34 phases, |
35 pycompat, | 35 pycompat, |
36 scmutil, | 36 scmutil, |
37 util, | 37 util, |
38 vfs as vfsmod, | |
38 ) | 39 ) |
39 | 40 |
40 hg = None | 41 hg = None |
41 propertycache = util.propertycache | 42 propertycache = util.propertycache |
42 | 43 |
613 | 614 |
614 @propertycache | 615 @propertycache |
615 def wvfs(self): | 616 def wvfs(self): |
616 """return vfs to access the working directory of this subrepository | 617 """return vfs to access the working directory of this subrepository |
617 """ | 618 """ |
618 return scmutil.vfs(self._ctx.repo().wvfs.join(self._path)) | 619 return vfsmod.vfs(self._ctx.repo().wvfs.join(self._path)) |
619 | 620 |
620 @propertycache | 621 @propertycache |
621 def _relpath(self): | 622 def _relpath(self): |
622 """return path to this subrepository as seen from outermost repository | 623 """return path to this subrepository as seen from outermost repository |
623 """ | 624 """ |
675 filehash = hashlib.sha1(vfs.tryread(relname)).hexdigest() | 676 filehash = hashlib.sha1(vfs.tryread(relname)).hexdigest() |
676 yield '%s = %s\n' % (relname, filehash) | 677 yield '%s = %s\n' % (relname, filehash) |
677 | 678 |
678 @propertycache | 679 @propertycache |
679 def _cachestorehashvfs(self): | 680 def _cachestorehashvfs(self): |
680 return scmutil.vfs(self._repo.join('cache/storehash')) | 681 return vfsmod.vfs(self._repo.join('cache/storehash')) |
681 | 682 |
682 def _readstorehashcache(self, remotepath): | 683 def _readstorehashcache(self, remotepath): |
683 '''read the store hash cache for a given remote repository''' | 684 '''read the store hash cache for a given remote repository''' |
684 cachefile = _getstorehashcachename(remotepath) | 685 cachefile = _getstorehashcachename(remotepath) |
685 return self._cachestorehashvfs.tryreadlines(cachefile, 'r') | 686 return self._cachestorehashvfs.tryreadlines(cachefile, 'r') |