ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib64/python3.11/site-packages/git/refs/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/git/refs/__pycache__/log.cpython-311.pyc

�

�܋ft.��:�ddlmZddlZddlZddlmZddlmZmZm	Z	ddl
mZmZm
Z
mZmZmZmZddlmZddlmZmZmZmZmZddlmZerddlmZdd	lm Z dd
l!m"Z"m#Z#ddgZ$Gd
�dee%e%eee&e&fe%f��Z'Gd�dee'e��Z(dS)�)�mmapN)�defenc)�
parse_date�Serializable�altz_to_utctz_str)�Actor�LockedFD�LockFile�assure_directory_exists�to_native_path�
bin_to_hex�file_contents_ro_filepath)�Iterator�List�Tuple�Union�
TYPE_CHECKING)�PathLike)�SymbolicReference)�BytesIO)�GitConfigParser�SectionConstraint�RefLog�RefLogEntryc�>�eZdZdZejd��ZdZdefd�Z	defd�Z
edefd���Zedefd���Z
edefd	���Zedeeeffd
���Zedefd���Zeded
edededededdfd���Zededdfd���ZdS)rz:Named tuple allowing easy access to the revlog data fieldsz^[0-9A-Fa-f]{40}$��returnc�*�|���S)z0Representation of ourselves in git reflog format)�format��selfs �]/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/git/refs/log.py�__repr__zRefLogEntry.__repr__/s���{�{�}�}��c��|j}|j}d�|j|j|j|j|dt|d��|j��S)z8:return: a string suitable to be placed in a reflog filez{} {} {} <{}> {!s} {}	{}
r�)	�actor�timer�	oldhexsha�	newhexsha�name�emailr�message)r!�actr(s   r"rzRefLogEntry.format3sW���j���y��,�3�3��N��N��H��I���G��d�1�g�&�&��L�
�
�	
r$c��|dS)z=The hexsha to the commit the ref pointed to before the changerrr s r"r)zRefLogEntry.oldhexshaA�
���A�w�r$c��|dS)z@The hexsha to the commit the ref now points to, after the changer&rr s r"r*zRefLogEntry.newhexshaFr0r$c��|dS)z Actor instance, providing access�rr s r"r'zRefLogEntry.actorKr0r$c��|dS)zetime as tuple:

        * [0] = int(time)
        * [1] = int(timezone_offset) in time.altzone format�rr s r"r(zRefLogEntry.timePs
���A�w�r$c��|dS)z<Message describing the operation that acted on the reference�rr s r"r-zRefLogEntry.messageXr0r$r)r*r'r(�	tz_offsetr-c�|�t|t��std|z���t|||||f|f��S)z&:return: New instance of a RefLogEntryzNeed actor instance, got %s)�
isinstancer�
ValueErrorr)�clsr)r*r'r(r8r-s       r"�newzRefLogEntry.new]sI���%��'�'�	D��:�U�B�C�C�C��I�y�%�$�	�9J�G�T�U�U�Ur$�linec��|�t��}|�dd��}t|��dkr|dd}}n8t|��dkr|\}}nt	dt|��z���|dd�}|dd	�}||fD].}|j�|��st	d
|������/|�dd��}	|	d
krt	d���tj
|d|	dz���}
t||	dzd���\}}t|||
||f|f��S)z�:return: New RefLogEntry instance from the given revlog line.
        :param line: line bytes without trailing newline
        :raise ValueError: If line could not be parsed�	r&rNr3z5Line must have up to two TAB-separated fields. Got %s�(�)�QzInvalid hexsha: �>�R���zMissing token: >)
�decoder�split�lenr;�repr�_re_hexsha_only�match�findr�_from_stringrr)
r<r>�line_str�fields�info�msgr)r*�hexsha�	email_endr'r(r8s
             r"�	from_linezRefLogEntry.from_linemsr��
�;�;�v�&�&������a�(�(���v�;�;�!����q�	�4�#�D�D�
��[�[�A�
�
��I�D�#�#��W�Z^�_g�Zh�Zh�h�i�i�i���"��I�	���B��K�	� �)�,�	C�	C�F��&�,�,�V�4�4�
C� �j���!A�B�B�B�
C�
�I�I�c�2�&�&�	���?�?��/�0�0�0��"�4��Y��]�(:�#;�<�<��$�T�)�a�-�/�/�%:�;�;���i��I�y�%�$�	�9J�C�P�Q�Q�Qr$N)�__name__�
__module__�__qualname__�__doc__�re�compilerK�	__slots__�strr#r�propertyr)r*rr'r�intr(r-�classmethodr=�bytesrUrr$r"rr(s�������D�D� �b�j�!4�5�5�O��I��#�����
��
�
�
�
���3�����X����3�����X����u�����X����e�C��H�o�����X���������X���
V��
V��
V��	
V�
�
V��

V��
V�
�
V�
V�
V��[�
V��R�U�R�}�R�R�R��[�R�R�Rr$c�~��eZdZdZdZd deedfddf�fd�
Zd deedffd�Zd!d�Z	e
deddfd	���Ze
d
ddefd���Z
e
d
eedefdeefd���Ze
dededdfd���Zdeddfd�Ze
	d"deedddfdedededededdfd���Zd#d�Zd$d�Zd$d�Z�xZS)%ra\A reflog contains RefLogEntrys, each of which defines a certain state
    of the head in question. Custom query methods allow to retrieve log entries
    by date or by other criteria.

    Reflog entries are ordered, the first added entry is first in the list, the last
    entry, i.e. the last change of the head or reference, is last in the list.)�_pathN�filepathrc�X��tt|���|��}|S�N)�superr�__new__)r<rd�inst�	__class__s   �r"rhzRefLog.__new__�s%����V�S�!�!�)�)�#�.�.���r$c�D�||_|�|���dSdS)z�Initialize this instance with an optional filepath, from which we will
        initialize our data. The path is also used to write changes back using
        the write() methodN)rc�_read_from_file)r!rds  r"�__init__zRefLog.__init__�s1����
���� � �"�"�"�"�"� �r$c���	t|jdd���}n#t$rYdSwxYw	|�|��|���dS#|���wxYw)NT)�stream�
allow_mmap)rrc�OSError�_deserialize�close)r!�fmaps  r"rlzRefLog._read_from_file�s~��	�,�T�Z��QU�V�V�V�D�D���	�	�	��F�F�	����
	����d�#�#�#��J�J�L�L�L�L�L��D�J�J�L�L�L�L���s��
(�(�A�A-c��||��S)z�
        :return: a new RefLog instance containing all entries from the reflog
            at the given filepath
        :param filepath: path to reflog
        :raise ValueError: If the file could not be read or was corrupted in some wayr)r<rds  r"�	from_filezRefLog.from_file�s���s�8�}�}�r$�refrc�f�tj|jjdt	|j����S)z�
        :return: string to absolute path at which the reflog of the given ref
            instance would be found. The path is not guaranteed to point to a valid
            file though.
        :param ref: SymbolicReference instance�logs)�osp�join�repo�git_dirr�path)r<rws  r"r~zRefLog.path�s'���x���(�&�.���2J�2J�K�K�Kr$rorc#�K�tj}t|t��r't	|��}t|t
��sJ�n|}	|���}|sdS||�����V��8)a
        :return: Iterator yielding RefLogEntry instances, one for each line read
            sfrom the given stream.
        :param stream: file-like object containing the revlog in its native format
            or string instance pointing to a file to readTN)rrUr:r]rr�readline�strip)r<ro�	new_entry�_streamr>s     r"�iter_entrieszRefLog.iter_entries�s����� �)�	��f�c�"�"�	�/��7�7�G��g�t�,�,�,�,�,�,��G�	*��#�#�%�%�D��
����)�D�J�J�L�L�)�)�)�)�)�		*r$�indexrc���t|d��5}|dkrPt�|���|�����cddd��St|dz��D].}|���}|std|dz�d�����/t�|�����cddd��S#1swxYwYdS)a
        :return: RefLogEntry at the given index

        :param filepath: full path to the index file from which to read the entry

        :param index: python list compatible index, i.e. it may be negative to
            specify an entry counted from the end of the list

        :raise IndexError: If the entry didn't exist

        .. note:: This method is faster as it only parses the entry at index, skipping
            all other lines. Nonetheless, the whole file has to be read if
            the index is negative
        �rbrNr&zIndex file ended at line z , before given index was reached)�openrrU�	readlinesr��ranger��
IndexError)r<rdr��fp�ir>s      r"�entry_atzRefLog.entry_at�sD�� �(�D�
!�
!�	7�R��q�y�y�"�,�,�R�\�\�^�^�E�-B�-H�-H�-J�-J�K�K�	7�	7�	7�	7�	7�	7�	7�	7�
�5�1�9�%�%�
h�
h���{�{�}�}���h�$�%f��1��%f�%f�%f�g�g�g�h�
�(�(������6�6�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7����	7�	7�	7�	7�	7�	7s�A
C!�(A,C!�!C%�(C%c��t|��}t|d���|�dd���}	|�|��|���dS#t
$r|����wxYw)z�Write the contents of the reflog instance to a file at the given filepath.

        :param filepath: path to file, parent directories are assumed to existT��is_file)�writeroN)r	rr��
_serialize�commit�	Exception�rollback)r!rd�lfdr�s    r"�to_filezRefLog.to_file�s����x� � ����$�7�7�7�7�
�X�X�D��X�
.�
.��	��O�O�B�����J�J�L�L�L�L�L���	�	�	��L�L�N�N�N��	���s�)A$�$ BT�
config_readerrr�	oldbinsha�	newbinshar-r�c	��t|��dkst|��dkrtd���t|d���|�d��d}t	|t
��r|}ntj|��}tt|���	d��t|���	d��|ttj����tj
f|f��}	|r�t|��}
|
���t!|d��}	|�|	����t(����|���|
���n-#|���|
���wxYw|	S)	aAppend a new log entry to the revlog at filepath.

        :param config_reader: configuration reader of the repository - used to obtain
            user information. May also be an Actor instance identifying the committer directly or None.
        :param filepath: full path to the log file
        :param oldbinsha: binary sha of the previous commit
        :param newbinsha: binary sha of the current commit
        :param message: message describing the change to the reference
        :param write: If True, the changes will be written right away. Otherwise
            the change will not be written

        :return: RefLogEntry objects which was appended to the log

        :note: As we are append-only, concurrent access is not a problem as we
            do not interfere with readers.�z&Shas need to be given in binary formatTr��
r�ascii�ab)rIr;rrHr:r�	committerrr
rGr_�_timer(�altzoner
�_obtain_lock_or_raiser�r�r�encoderrs�
_release_lock)r<r�rdr�r�r-r��
first_liner��entry�lf�fds            r"�append_entryzRefLog.append_entrys���4�y�>�>�R���3�y�>�>�R�#7�#7��E�F�F�F���$�7�7�7�7��]�]�4�(�(��+�
��m�U�+�+�	7�%�I�I���
�6�6�I���9�%�%�,�,�W�5�5��9�%�%�,�,�W�5�5���U�Z�\�\�"�"�E�M�2��
�
�
���	#��(�#�#�B��$�$�&�&�&��h��%�%�B�
#���������.�.�v�6�6�7�7�7����
�
�
�� � �"�"�"�"�����
�
�
�� � �"�"�"�"�����s�?F*�**Gc�f�|j�td���|�|j��|S)zUWrite this instance's data to the file we are originating from

        :return: selfNzBInstance was not initialized with a path, use to_file(...) instead)rcr;r�r s r"r�zRefLog.writeHs4���:���a�b�b�b����T�Z� � � ��r$c��|j}|D]7}||����t�����8|Srf)r�rr�r)r!ror��es    r"r�zRefLog._serializeUsH������	-�	-�A��E�!�(�(�*�*�#�#�F�+�+�,�,�,�,��r$c�V�|�|�|����|Srf)�extendr�)r!ros  r"rrzRefLog._deserialize^s'�����D�%�%�f�-�-�.�.�.��r$rf)rN)T)rr)rorrr)rVrWrXrYr\rrrhrmrlr`rvr]r~rrrr�r_r�r�rra�boolr�r�r�rr�
__classcell__)rjs@r"rr�s]�������R�R��I���u�X�t�^�4���������#�#��x��~�!6�#�#�#�#����� ����h�����[���L�*�L�s�L�L�L��[�L��*�%��Y��(<�"=�*�(�;�BW�*�*�*��[�*�*�7��7��7��7�7�7��[�7�<���T�����"��6�6��U�$5�7J�D�P�Q�6��6��	6�
�6��
6��6�
�6�6�6��[�6�p���������������r$))rrZr(r��
git.compatr�git.objects.utilrrr�git.utilrr	r
rrr
r�os.pathr~rz�typingrrrrr�	git.typesr�git.refsr�ior�
git.configrr�__all__r]r_rrrr$r"�<module>r�s��������	�	�	�	���������������������
������������������������
?�>�>�>�>�>�>�>�>�>�>�>�>�>��������>�*�*�*�*�*�*�������=�=�=�=�=�=�=�=��]�
#��dR�dR�dR�dR�dR�%��S�%��s�C�x��#�=�>�dR�dR�dR�NR�R�R�R�R�T�+�
��R�R�R�R�Rr$

Zerion Mini Shell 1.0