o
    Þñhj
  ã                   @   sh   d dl mZmZmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZ d dlZdZG dd	„ d	eeeƒZdS )
é    )Ú
CompoundDBÚ	ObjectDBWÚ
FileDBBase)ÚLooseObjectDB)ÚPackedDB)ÚReferenceDB)ÚInvalidDBRootN)ÚGitDBc                       sf   e Zd ZdZeZeZeZ	dZ
dZej dd¡Z‡ fdd„Z‡ fdd	„Zd
d„ Zdd„ Zdd„ Z‡  ZS )r	   a  A git-style object database, which contains all objects in the 'objects'
    subdirectory

    ``IMPORTANT``: The usage of this implementation is highly discouraged as it fails to release file-handles.
    This can be a problem with long-running processes and/or big repositories.
    ÚpackÚ ÚinfoÚ
alternatesc                    s   t ƒ  |¡ dS )z/Initialize ourselves on a git objects directoryN)ÚsuperÚ__init__)ÚselfÚ	root_path©Ú	__class__© ú@/var/www/vscode/kcb/lib/python3.10/site-packages/gitdb/db/git.pyr   (   s   zGitDB.__init__c                    sÈ   |dks|dkr\t ƒ | _d }| j| jf| j| jf| j| jffD ]!\}}|  |¡}t	j
 |¡r@| j ||ƒ¡ || ju r@| jd }q| jsJt|  ¡ ƒ‚|d urSt|dƒsWJ dƒ‚|| _d S tƒ  |¡ d S )NÚ_dbsÚ	_loose_dbéÿÿÿÿÚstorez(First database needs store functionality)Úlistr   Ú	packs_dirÚ	PackDBClsÚ	loose_dirÚ
LooseDBClsÚalternates_dirÚReferenceDBClsÚdb_pathÚosÚpathÚexistsÚappendr   r   Úhasattrr   r   Ú_set_cache_)r   ÚattrÚloose_dbÚsubpathÚdbclsr#   r   r   r   r'   ,   s$   


þ


€
zGitDB._set_cache_c                 C   ó   | j  |¡S ©N)r   r   )r   Úistreamr   r   r   r   L   ó   zGitDB.storec                 C   s
   | j  ¡ S r-   )r   Úostream)r   r   r   r   r0   O   s   
zGitDB.ostreamc                 C   r,   r-   )r   Úset_ostream)r   r0   r   r   r   r1   R   r/   zGitDB.set_ostream)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r    r   r   r"   r#   Újoinr   r   r'   r   r0   r1   Ú__classcell__r   r   r   r   r	      s     r	   )Úgitdb.db.baser   r   r   Úgitdb.db.looser   Úgitdb.db.packr   Úgitdb.db.refr   Ú	gitdb.excr   r"   Ú__all__r	   r   r   r   r   Ú<module>   s   