mercurial/manifest.py
changeset 29959 483003c27938
parent 29941 1cc93a154723
child 29960 da75bc36202c
equal deleted inserted replaced
29958:37a36c05dcc3 29959:483003c27938
   955     class do not care about the implementation details of the actual manifests
   955     class do not care about the implementation details of the actual manifests
   956     they receive (i.e. tree or flat or lazily loaded, etc)."""
   956     they receive (i.e. tree or flat or lazily loaded, etc)."""
   957     def __init__(self, opener, repo):
   957     def __init__(self, opener, repo):
   958         self._repo = repo
   958         self._repo = repo
   959 
   959 
       
   960         usetreemanifest = False
       
   961 
       
   962         opts = getattr(opener, 'options', None)
       
   963         if opts is not None:
       
   964             usetreemanifest = opts.get('treemanifest', usetreemanifest)
       
   965         self._treeinmem = usetreemanifest
       
   966 
   960         # We'll separate this into it's own cache once oldmanifest is no longer
   967         # We'll separate this into it's own cache once oldmanifest is no longer
   961         # used
   968         # used
   962         self._mancache = repo.manifest._mancache
   969         self._mancache = repo.manifest._mancache
   963 
   970 
   964     @property
   971     @property
   965     def _revlog(self):
   972     def _revlog(self):
   966         return self._repo.manifest
       
   967 
       
   968     @property
       
   969     def _oldmanifest(self):
       
   970         # _revlog is the same as _oldmanifest right now, but we eventually want
       
   971         # to delete _oldmanifest while still allowing manifestlog to access the
       
   972         # revlog specific apis.
       
   973         return self._repo.manifest
   973         return self._repo.manifest
   974 
   974 
   975     def __getitem__(self, node):
   975     def __getitem__(self, node):
   976         """Retrieves the manifest instance for the given node. Throws a KeyError
   976         """Retrieves the manifest instance for the given node. Throws a KeyError
   977         if not found.
   977         if not found.
   982             # those since they don't implement the full api.
   982             # those since they don't implement the full api.
   983             if (isinstance(cachemf, manifestctx) or
   983             if (isinstance(cachemf, manifestctx) or
   984                 isinstance(cachemf, treemanifestctx)):
   984                 isinstance(cachemf, treemanifestctx)):
   985                 return cachemf
   985                 return cachemf
   986 
   986 
   987         if self._oldmanifest._treeinmem:
   987         if self._treeinmem:
   988             m = treemanifestctx(self._revlog, '', node)
   988             m = treemanifestctx(self._revlog, '', node)
   989         else:
   989         else:
   990             m = manifestctx(self._revlog, node)
   990             m = manifestctx(self._revlog, node)
   991         if node != revlog.nullid:
   991         if node != revlog.nullid:
   992             self._mancache[node] = m
   992             self._mancache[node] = m