mercurial/manifest.py
changeset 30403 a431daa93f8c
parent 30377 2019fbdab075
child 30404 a1beadaa4061
equal deleted inserted replaced
30402:945f8229b30d 30403:a431daa93f8c
  1276         """Retrieves the manifest instance for the given node. Throws a
  1276         """Retrieves the manifest instance for the given node. Throws a
  1277         LookupError if not found.
  1277         LookupError if not found.
  1278         """
  1278         """
  1279         return self.get('', node)
  1279         return self.get('', node)
  1280 
  1280 
  1281     def get(self, dir, node):
  1281     def get(self, dir, node, verify=True):
  1282         """Retrieves the manifest instance for the given node. Throws a
  1282         """Retrieves the manifest instance for the given node. Throws a
  1283         LookupError if not found.
  1283         LookupError if not found.
       
  1284 
       
  1285         `verify` - if True an exception will be thrown if the node is not in
       
  1286                    the revlog
  1284         """
  1287         """
  1285         if node in self._dirmancache.get(dir, ()):
  1288         if node in self._dirmancache.get(dir, ()):
  1286             cachemf = self._dirmancache[dir][node]
  1289             cachemf = self._dirmancache[dir][node]
  1287             # The old manifest may put non-ctx manifests in the cache, so
  1290             # The old manifest may put non-ctx manifests in the cache, so
  1288             # skip those since they don't implement the full api.
  1291             # skip those since they don't implement the full api.
  1290                 isinstance(cachemf, treemanifestctx)):
  1293                 isinstance(cachemf, treemanifestctx)):
  1291                 return cachemf
  1294                 return cachemf
  1292 
  1295 
  1293         if dir:
  1296         if dir:
  1294             if self._revlog._treeondisk:
  1297             if self._revlog._treeondisk:
  1295                 dirlog = self._revlog.dirlog(dir)
  1298                 if verify:
  1296                 if node not in dirlog.nodemap:
  1299                     dirlog = self._revlog.dirlog(dir)
  1297                     raise LookupError(node, dirlog.indexfile,
  1300                     if node not in dirlog.nodemap:
  1298                                       _('no node'))
  1301                         raise LookupError(node, dirlog.indexfile,
       
  1302                                           _('no node'))
  1299                 m = treemanifestctx(self._repo, dir, node)
  1303                 m = treemanifestctx(self._repo, dir, node)
  1300             else:
  1304             else:
  1301                 raise error.Abort(
  1305                 raise error.Abort(
  1302                         _("cannot ask for manifest directory '%s' in a flat "
  1306                         _("cannot ask for manifest directory '%s' in a flat "
  1303                           "manifest") % dir)
  1307                           "manifest") % dir)
  1304         else:
  1308         else:
  1305             if node not in self._revlog.nodemap:
  1309             if verify:
  1306                 raise LookupError(node, self._revlog.indexfile,
  1310                 if node not in self._revlog.nodemap:
  1307                                   _('no node'))
  1311                     raise LookupError(node, self._revlog.indexfile,
       
  1312                                       _('no node'))
  1308             if self._treeinmem:
  1313             if self._treeinmem:
  1309                 m = treemanifestctx(self._repo, '', node)
  1314                 m = treemanifestctx(self._repo, '', node)
  1310             else:
  1315             else:
  1311                 m = manifestctx(self._repo, node)
  1316                 m = manifestctx(self._repo, node)
  1312 
  1317