Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/subrepo.py @ 25572:3d8c044ed513
subrepo: introduce hgsubrepo._getctx()
This code is already used in a couple of places, and will need to be used in
others where wdir() support is needed. Trying to get the wdir() revision stored
in self._substate[1] when creating the object in subrepo.subrepo() resulted in
breaking various status and diff tests. This is a far less invasive change.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 14 Jun 2015 21:51:57 -0400 |
parents | c4a92867c048 |
children | f1d46075b13a |
comparison
equal
deleted
inserted
replaced
25571:1abfe639a70c | 25572:3d8c044ed513 |
---|---|
660 vfs = self._cachestorehashvfs | 660 vfs = self._cachestorehashvfs |
661 vfs.writelines(cachefile, storehash, mode='w', notindexed=True) | 661 vfs.writelines(cachefile, storehash, mode='w', notindexed=True) |
662 finally: | 662 finally: |
663 lock.release() | 663 lock.release() |
664 | 664 |
665 def _getctx(self): | |
666 '''fetch the context for this subrepo revision, possibly a workingctx | |
667 ''' | |
668 if self._ctx.rev() is None: | |
669 return self._repo[None] # workingctx if parent is workingctx | |
670 else: | |
671 rev = self._state[1] | |
672 return self._repo[rev] | |
673 | |
665 @annotatesubrepoerror | 674 @annotatesubrepoerror |
666 def _initrepo(self, parentrepo, source, create): | 675 def _initrepo(self, parentrepo, source, create): |
667 self._repo._subparent = parentrepo | 676 self._repo._subparent = parentrepo |
668 self._repo._subsource = source | 677 self._repo._subsource = source |
669 | 678 |