Mercurial > kallithea
view rhodecode/lib/vcs/utils/archivers.py @ 3774:60335b702a00 beta
invalidation: don't create CacheInvalidation records on startup
Creating the records early gave an advantage before lightweight was introduced.
With lightweight it is no longer necessary.
The records will be created on demand anyway and there is no reason to create and
maintain them before they are used.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Wed, 03 Apr 2013 15:56:12 +0200 |
parents | 324ac367a4da |
children |
line wrap: on
line source
# -*- coding: utf-8 -*- """ vcs.utils.archivers ~~~~~~~~~~~~~~~~~~~ set of archiver functions for creating archives from repository content :created_on: Jan 21, 2011 :copyright: (c) 2010-2011 by Marcin Kuzminski, Lukasz Balcerzak. """ class BaseArchiver(object): def __init__(self): self.archive_file = self._get_archive_file() def addfile(self): """ Adds a file to archive container """ pass def close(self): """ Closes and finalizes operation of archive container object """ self.archive_file.close() def _get_archive_file(self): """ Returns container for specific archive """ raise NotImplementedError() class TarArchiver(BaseArchiver): pass class Tbz2Archiver(BaseArchiver): pass class TgzArchiver(BaseArchiver): pass class ZipArchiver(BaseArchiver): pass def get_archiver(self, kind): """ Returns instance of archiver class specific to given kind :param kind: archive kind """ archivers = { 'tar': TarArchiver, 'tbz2': Tbz2Archiver, 'tgz': TgzArchiver, 'zip': ZipArchiver, } return archivers[kind]()