mercurial/util.py
changeset 30438 90933e4e44fd
parent 30437 64d7275445d0
child 30442 41a8106789ca
equal deleted inserted replaced
30437:64d7275445d0 30438:90933e4e44fd
  3019 
  3019 
  3020     def forbundlename(self, bundlename):
  3020     def forbundlename(self, bundlename):
  3021         """Obtain a compression engine registered to a bundle name.
  3021         """Obtain a compression engine registered to a bundle name.
  3022 
  3022 
  3023         Will raise KeyError if the bundle type isn't registered.
  3023         Will raise KeyError if the bundle type isn't registered.
       
  3024 
       
  3025         Will abort if the engine is known but not available.
  3024         """
  3026         """
  3025         return self._engines[self._bundlenames[bundlename]]
  3027         engine = self._engines[self._bundlenames[bundlename]]
       
  3028         if not engine.available():
       
  3029             raise error.Abort(_('compression engine %s could not be loaded') %
       
  3030                               engine.name())
       
  3031         return engine
  3026 
  3032 
  3027     def forbundletype(self, bundletype):
  3033     def forbundletype(self, bundletype):
  3028         """Obtain a compression engine registered to a bundle type.
  3034         """Obtain a compression engine registered to a bundle type.
  3029 
  3035 
  3030         Will raise KeyError if the bundle type isn't registered.
  3036         Will raise KeyError if the bundle type isn't registered.
       
  3037 
       
  3038         Will abort if the engine is known but not available.
  3031         """
  3039         """
  3032         return self._engines[self._bundletypes[bundletype]]
  3040         engine = self._engines[self._bundletypes[bundletype]]
       
  3041         if not engine.available():
       
  3042             raise error.Abort(_('compression engine %s could not be loaded') %
       
  3043                               engine.name())
       
  3044         return engine
  3033 
  3045 
  3034 compengines = compressormanager()
  3046 compengines = compressormanager()
  3035 
  3047 
  3036 class compressionengine(object):
  3048 class compressionengine(object):
  3037     """Base class for compression engines.
  3049     """Base class for compression engines.