Ë
    ùmxi-(  ã                   óþ   — d dgZ ddlmZ ddlmZ ddlmZ ddl	m
Z
mZmZmZ ddlmZ ddlmZmZmZ dd	lmZmZmZ er$dd
l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"m#Z# ed   Z$ G d„ d e
«      Z% G d„ de%«      Z&y)ÚObjectÚIndexObjecté    N)ÚWorkTreeRepositoryUnsupported)Ú	LazyMixinÚ
bin_to_hexÚjoin_path_nativeÚstream_copyé   )Úget_object_type_by_name)ÚAnyÚTYPE_CHECKINGÚUnion)ÚAnyGitObjectÚGitObjectTypeStringÚPathLike)ÚOStream)Ú	Reference)ÚRepo)ÚBlob)Ú	Submodule)ÚTree)r   r   r   c                   ó‚  ‡ — e Zd ZU dZdZdZej                  ej                  ej                  ej                  fZdZdZeedf   ed<   	 ddd	ed
dfˆ fd„Zedddeedf   d
efd„«       Zeddded
efd„«       Zded
dfˆ fd„Zded
efd„Zded
efd„Zd
efd„Zd
efd„Zd
efd„Z e!d
efd„«       Z"e!dd„«       Z#dd„Z$ˆ xZ%S )r   ar  Base class for classes representing git object types.

    The following four leaf classes represent specific kinds of git objects:

    * :class:`Blob <git.objects.blob.Blob>`
    * :class:`Tree <git.objects.tree.Tree>`
    * :class:`Commit <git.objects.commit.Commit>`
    * :class:`TagObject <git.objects.tag.TagObject>`

    See :manpage:`gitglossary(7)` on:

    * "object": https://git-scm.com/docs/gitglossary#def_object
    * "object type": https://git-scm.com/docs/gitglossary#def_object_type
    * "blob": https://git-scm.com/docs/gitglossary#def_blob_object
    * "tree object": https://git-scm.com/docs/gitglossary#def_tree_object
    * "commit object": https://git-scm.com/docs/gitglossary#def_commit_object
    * "tag object": https://git-scm.com/docs/gitglossary#def_tag_object

    :note:
        See the :class:`~git.types.AnyGitObject` union type of the four leaf subclasses
        that represent actual git object types.

    :note:
        :class:`~git.objects.submodule.base.Submodule` is defined under the hierarchy
        rooted at this :class:`Object` class, even though submodules are not really a
        type of git object. (This also applies to its
        :class:`~git.objects.submodule.root.RootModule` subclass.)

    :note:
        This :class:`Object` class should not be confused with :class:`object` (the root
        of the class hierarchy in Python).
    Ú(0000000000000000000000000000000000000000s                       )ÚrepoÚbinshaÚsizeNÚtyper   r   r   Úreturnc                 ó„   •— t         ‰| �  «        || _        || _        t	        |«      dk(  sJ d|t	        |«      fz  «       ‚y)zýInitialize an object by identifying it by its binary sha.

        All keyword arguments will be set on demand if ``None``.

        :param repo:
            Repository this object is located in.

        :param binsha:
            20 byte SHA1
        é   z,Require 20 byte binary sha, got %r, len = %iN)ÚsuperÚ__init__r   r   Úlen)Úselfr   r   Ú	__class__s      €úG/home/htdocs/ttos/venv/lib/python3.12/site-packages/git/objects/base.pyr"   zObject.__init__d   sO   ø€ ô 	‰ÑÔØˆŒ	ØˆŒÜ�6‹{˜bÒ ð 	
Ð"PØÜ�‹KðT
ñ #
ó 	
Ñ ó    Úidr   c                 ó6   — |j                  t        |«      «      S )a)  
        :return:
            New :class:`Object` instance of a type appropriate to the object type behind
            `id`. The id of the newly created object will be a binsha even though the
            input id may have been a :class:`~git.refs.reference.Reference` or rev-spec.

        :param id:
            :class:`~git.refs.reference.Reference`, rev-spec, or hexsha.

        :note:
            This cannot be a ``__new__`` method as it would always call :meth:`__init__`
            with the input id which is not necessarily a binsha.
        )Ú	rev_parseÚstr)Úclsr   r(   s      r&   Únewz
Object.neww   s   € ð �~‰~œc "›gÓ&Ð&r'   Úsha1c                 óì   — || j                   k(  r t        d«      ||«      S |j                  j                  |«      } t        |j                  «      ||j
                  «      }|j                  |_        |S )zª
        :return:
            New object instance of a type appropriate to represent the given binary sha1

        :param sha1:
            20 byte binary sha1.
        s   commit)ÚNULL_BIN_SHAr   ÚodbÚinfor   r   r   )r,   r   r.   ÚoinfoÚinsts        r&   Únew_from_shazObject.new_from_shaˆ   se   € ð �3×#Ñ#Ò#à5Ô*¨9Ó5°d¸DÓAÐAà—‘—‘˜dÓ#ˆØ2Ô& u§z¡zÓ2°4¸¿¹ÓFˆØ—J‘JˆŒ	Øˆr'   Úattrc                 ó°   •— |dk(  rA| j                   j                  j                  | j                  «      }|j                  | _        yt
        ‰| �  |«       y)zRetrieve object information.r   N)r   r1   r2   r   r   r!   Ú_set_cache_)r$   r6   r3   r%   s      €r&   r8   zObject._set_cache_š   s>   ø€ à�6Š>Ø—I‘I—M‘M×&Ñ& t§{¡{Ó3ˆEØŸ
™
ˆD�Iä‰GÑ Õ%r'   Úotherc                 óN   — t        |d«      sy| j                  |j                  k(  S )z3:return: ``True`` if the objects have the same SHA1r   F©Úhasattrr   ©r$   r9   s     r&   Ú__eq__zObject.__eq__¢   s"   € ä�u˜hÔ'ØØ�{‰{˜eŸl™lÑ*Ð*r'   c                 óN   — t        |d«      sy| j                  |j                  k7  S )z::return: ``True`` if the objects do not have the same SHA1r   Tr;   r=   s     r&   Ú__ne__zObject.__ne__¨   s"   € ä�u˜hÔ'ØØ�{‰{˜eŸl™lÑ*Ð*r'   c                 ó,   — t        | j                  «      S )zE:return: Hash of our id allowing objects to be used in dicts and sets)Úhashr   ©r$   s    r&   Ú__hash__zObject.__hash__®   s   € ä�D—K‘KÓ Ð r'   c                 ó   — | j                   S )z=:return: String of our SHA1 as understood by all git commands)ÚhexsharC   s    r&   Ú__str__zObject.__str__²   s   € à�{‰{Ðr'   c                 óP   — d| j                   j                  ›d| j                  ›d�S )z::return: String with pythonic representation of our objectz<git.z "z">)r%   Ú__name__rF   rC   s    r&   Ú__repr__zObject.__repr__¶   s   � à"&§.¡.×"9Ó"9¸4¿;»;ÐGÐGr'   c                 óJ   — t        | j                  «      j                  d«      S )z6:return: 40 byte hex version of our 20 byte binary shaÚascii)r   r   ÚdecoderC   s    r&   rF   zObject.hexshaº   s   € ô ˜$Ÿ+™+Ó&×-Ñ-¨gÓ6Ð6r'   c                 ó`   — | j                   j                  j                  | j                  «      S )z³
        :return:
            File-object compatible stream to the uncompressed raw data of the object

        :note:
            Returned streams must be read in order.
        )r   r1   Ústreamr   rC   s    r&   Údata_streamzObject.data_streamÀ   s!   € ð �y‰y�}‰}×#Ñ# D§K¡KÓ0Ð0r'   c                 ó|   — | j                   j                  j                  | j                  «      }t	        ||«       | S )zªWrite our data directly to the given output stream.

        :param ostream:
            File-object compatible stream object.

        :return:
            self
        )r   r1   rO   r   r	   )r$   ÚostreamÚistreams      r&   Ústream_datazObject.stream_dataË   s/   € ð —)‘)—-‘-×&Ñ& t§{¡{Ó3ˆÜ�G˜WÔ%Øˆr'   )r   r   )rR   r   r   r   )&rI   Ú
__module__Ú__qualname__Ú__doc__ÚNULL_HEX_SHAr0   ÚdbtypÚstr_blob_typeÚstr_tree_typeÚstr_commit_typeÚstr_tag_typeÚTYPESÚ	__slots__r   r   r   Ú__annotations__Úbytesr"   Úclassmethodr+   r   r-   r5   r8   r   Úboolr>   r@   ÚintrD   rG   rJ   ÚpropertyrF   rP   rT   Ú__classcell__©r%   s   @r&   r   r   &   sl  ø… ñðB €LØ€Lð 	×ÑØ×ÑØ×ÑØ×Ñð	€Eð +€Ià-1€Dˆ%Ð# TÐ)Ñ
*Ó1ðð
˜Vð 
¨Uð 
°tõ 
ð& ð'�vð ' 5¨¨kÐ)9Ñ#:ð '¸|ò 'ó ð'ð  ð ð ¨eð ¸ò ó ðð"& ð &¨õ &ð+˜Cð + Dó +ð+˜Cð + Dó +ð!˜#ó !ð˜ó ðH˜#ó Hð ð7˜ò 7ó ð7ð
 ò1ó ð1÷r'   c                   ó¦   ‡ — e Zd ZdZdZdZ	 	 ddddededef   dede	f   d	df
ˆ fd
„Z
d	efd„Zded	dfˆ fd„Zed	efd„«       Zed	e	fd„«       Zˆ xZS )r   a}  Base for all objects that can be part of the index file.

    The classes representing git object types that can be part of the index file are
    :class:`~git.objects.tree.Tree` and :class:`~git.objects.blob.Blob`. In addition,
    :class:`~git.objects.submodule.base.Submodule`, which is not really a git object
    type but can be part of an index file, is also a subclass.
    )ÚpathÚmoderi   Nr   r   r   rj   r   c                 óL   •— t         ‰| �  ||«       |�|| _        |�|| _        yy)a¥  Initialize a newly instanced :class:`IndexObject`.

        :param repo:
            The :class:`~git.repo.base.Repo` we are located in.

        :param binsha:
            20 byte sha1.

        :param mode:
            The stat-compatible file mode as :class:`int`.
            Use the :mod:`stat` module to evaluate the information.

        :param path:
            The path to the file in the file system, relative to the git repository
            root, like ``file.ext`` or ``folder/other.ext``.

        :note:
            Path may not be set if the index object has been created directly, as it
            cannot be retrieved without knowing the parent tree.
        N)r!   r"   rj   ri   )r$   r   r   rj   ri   r%   s        €r&   r"   zIndexObject.__init__ç   s3   ø€ ô6 	‰Ñ˜˜vÔ&ØÐØˆDŒIØÐØˆD�Ið r'   c                 ó,   — t        | j                  «      S )zˆ
        :return:
            Hash of our path as index items are uniquely identifiable by path, not by
            their data!
        )rB   ri   rC   s    r&   rD   zIndexObject.__hash__  s   € ô �D—I‘I‹Ðr'   r6   c                 ó’   •— |t         j                  v r%t        d|›dt        | «      j                  ›d�«      ‚t
        ‰| �  |«       y )NzAttribute 'z<' unset: path and mode attributes must have been set during z object creation)r   r_   ÚAttributeErrorr   rI   r!   r8   )r$   r6   r%   s     €r&   r8   zIndexObject._set_cache_  sA   ø€ Ø”;×(Ñ(Ñ(å âœ˜d›×,Ó,ð.óð ô
 ‰GÑ Õ%r'   c                 ó@   — t        j                  | j                  «      S )zA:return: Name portion of the path, effectively being the basename)ÚospÚbasenameri   rC   s    r&   ÚnamezIndexObject.name  s   € ô �|‰|˜DŸI™IÓ&Ð&r'   c                 ó˜   — | j                   j                  �*t        | j                   j                  | j                  «      S t	        d«      ‚)a&  
        :return:
            Absolute path to this index object in the file system (as opposed to the
            :attr:`path` field which is a path relative to the git repository).

            The returned path will be native to the system and contains ``\`` on
            Windows.
        z"working_tree_dir was None or empty)r   Úworking_tree_dirr   ri   r   rC   s    r&   ÚabspathzIndexObject.abspath   s;   € ð �9‰9×%Ñ%Ð1Ü# D§I¡I×$>Ñ$>ÀÇ	Á	ÓJÐJä/Ð0TÓUÐUr'   )NN)rI   rU   rV   rW   r_   Ú_id_attribute_ra   r   rd   r   r"   rD   r+   r8   re   rr   ru   rf   rg   s   @r&   r   r   Ù   s¾   ø„ ñð !€Ið €Nð "&Ø&*ñàðð ðð �D˜#�IÑð	ð
 �D˜(�NÑ#ðð 
õðB˜#ó ð& ð &¨õ &ð ð'�cò 'ó ð'ð ðV˜ò Vó ôVr'   )'Ú__all__Úos.pathri   rp   Ú	gitdb.typÚtyprY   Úgit.excr   Úgit.utilr   r   r   r	   Úutilr   Útypingr   r   r   Ú	git.typesr   r   r   Ú
gitdb.baser   Úgit.refs.referencer   Úgit.repor   Úblobr   Úsubmodule.baser   Útreer   ÚIndexObjUnionr   r   © r'   r&   ú<module>rˆ      sp   ðð �]Ð
#€å å å 1ß IÓ Iå )÷ -Ñ ,ç AÑ AáÝ"å,ÝåÝ)ÝàÐ1Ñ2€ô
pˆYô pôfTV�&õ TVr'   