403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /lib64/python3.9/site-packages/hgext/remotefilelog/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib64/python3.9/site-packages/hgext/remotefilelog/__pycache__/datapack.cpython-39.pyc
a

�+�b2>�@s�ddlmZddlZddlZddlmZmZddlmZddl	m
Z
mZddlm
Z
mZmZdZd	Zd
ZdZdZGd
d�de
j�ZGdd�de
j
�ZGdd�de
j�ZdS)�)�absolute_importN)�hex�sha1nodeconstants)�_)�pycompat�util�)�basepack�	constants�shallowutil�������s.dataidxs	.datapackcsTeZdZeZeZ�fdd�Zdd�Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�Z�ZS)�
datapackstorecstt|��||�dS�N)�superr�__init__)�selfZui�path��	__class__��B/usr/lib64/python3.9/site-packages/hgext/remotefilelog/datapack.pyr#szdatapackstore.__init__cCst|�Sr)�datapack)rrrrr�getpack&szdatapackstore.getpackcCstd��dS)Ns)must use getdeltachain with datapackstore��RuntimeError�r�name�noderrr�get)szdatapackstore.getc	Csz|jD]*}z|�||�WSty.Yq0q|��D]*}z|�||�WStybYq:0q:t|t|�f��dSr)�packs�getmeta�KeyError�refreshr�rrr�packrrrr",s
zdatapackstore.getmetac	Csz|jD]*}z|�||�WSty.Yq0q|��D]*}z|�||�WStybYq:0q:t|t|�f��dSr)r!�getdeltar#r$rr%rrrr';s
zdatapackstore.getdeltac	Csz|jD]*}z|�||�WSty.Yq0q|��D]*}z|�||�WStybYq:0q:t|t|�f��dSr)r!�
getdeltachainr#r$rr%rrrr(Js
zdatapackstore.getdeltachaincCstd��dS)Nscannot add to datapackstorer�rrr�datarrr�addYszdatapackstore.add)
�__name__�
__module__�__qualname__�INDEXSUFFIX�
PACKSUFFIXrrr r"r'r(r+�
__classcell__rrrrrsrc@s�eZdZeZeZdZdZdgZdd�Zdd�Z	dd	�Z
d
d�Zdd
�Zd dd�Z
dd�Zdd�Zdd�Zd!dd�Zdd�Zdd�Zdd�ZdS)"rs!20siQQ�(�cCs2g}|D]$\}}|�|�}|s|�||f�q|Sr)�_find�append)r�keys�missingrr�valuerrr�
getmissinghs
zdatapack.getmissingcCstd|t|�f��dS)Ns,must use getdeltachain with datapack (%s:%s))rrrrrrr qs�zdatapack.getc
Cs�|�|�}|dur"t|t|�f��|\}}}}|j|||�}d}|t�d||�dd7}|d7}|t�d||�dd7}t�d||�d}|d7}t�||||��}	|	S)	Nr�!Hr3r2�!Q��!I�)r4r#r�_data�struct�unpack_fromr�
parsepackmeta)
rrrr8�deltabaseoffset�offset�size�rawentry�metalen�metarrrr"vs
zdatapack.getmetacCs`|�|�}|dur"t|t|�f��|\}}}}|j||dd�}|\}}}	}
}|��|
||	|fS)NT)r")r4r#r�
_readentry�
freememory)rrrr8rCrDrE�entry�filename�
deltabasenode�deltarHrrrr'�s
zdatapack.getdeltacCs�|�|�}|dur"t|t|�f��|j}|g}|d}|j}|tkr�|tkr�|j|}t�	|j
|j|||��}|d}|�|�q<g}	|D]4\}}}
}|�
|
|�\}}}
}|	�||||
|f�q�|��|	S)Nr)r4r#r�params�INDEXENTRYLENGTH�FULLTEXTINDEXMARK�NOBASEINDEXMARK�
indexstartr@�unpack�INDEXFORMAT�_indexr5rIrJ)rrrr8rO�chainrC�entrylen�locZ
deltachainrDrErLrMrNrrrr(�s.
��
�zdatapack.getdeltachainFcCs*|j|||�}|jt|�7_d}t�d|dd��d}||||�}||}|t}	|||	�}
||	|	t�}|	t}|||d�}
t�d|
�d}||d|d|�}|�|�}|�r|d|}t�d||�d}||d|d|�}t�	|�}||
|||fS||
||fSdS)Nr3r:rr<r;r=r>)
r?�_pagedin�lenr@rT�
NODELENGTH�_decompressrArrB)rrDrEr"rFZ
lengthsize�filenamelenrLZ	nodestartZdeltabasestartrrMZ
deltastart�rawdeltalen�deltalenrNZ	metastartrG�rawmetarHrrrrI�s*

zdatapack._readentrycCs
t�|�Sr)�zlib�
decompress�rr*rrrr]�szdatapack._decompresscCstd||f��dS)Nscannot add to datapack (%s:%s)rr)rrrr+�szdatapack.addcCs`|j}t�|j|d|j��d}|j}|||j}|j}t�	|d|j
�D]}|||j}||krNqrqN|}|j}	|	||t�}
|	||t�}|j
}|
|kr�|	|||�}
n�||kr�|	|||�}
n�|||k�rN|||d}|||j|}|	||t�}||k�r0|	|||�}
�qR||k�r@|}q�||kr�|}q�dSt�|j|
�S)Nrrr3)rOr@rTZfanoutstructZfanoutprefixZ_fanouttablerSZ	_indexendrZxrangeZfanoutcountrVr\rPrU)rrrOZ	fanoutkeyZfanout�startZindexend�i�end�indexZ	startnodeZendnoderXrKZmidZmidnoderrrr4�sF��

zdatapack._findNcCs |D]\}}|�|||�qdSr)Z
markdataentry)r�ledger�optionsrLrrrr�
markledgerszdatapack.markledgercCsd|j�|g�}t|�}dd�|D�}t||�dkr`|j|jvr`tj|jdd�tj|j	dd�dS)NcSs$h|]}|js|jr|j|jf�qSr)ZdatarepackedZgcedrLr)�.0�errr�	<setcomp>sz#datapack.cleanup.<locals>.<setcomp>rT)Z
ignoremissing)
Zsourcesr �setr[rZcreatedrZ
unlinkpathZ	indexpathZpackpath)rri�entriesZallkeysZrepackedkeysrrr�cleanups�zdatapack.cleanupccs$|��D]\}}}}||fVqdSr)�iterentries)r�f�n�	deltabaser`rrr�__iter__szdatapack.__iter__ccs*d}|j}||jk�r&|}t�d|||d��d}|d7}||||�}||7}|||tj�}|tj7}|||tj�}|tj7}|||d�}t�d|�d}	|d7}t|�||||	���}
||	7}t�d||�d}|d|7}||||
fV|j	||7_	|�
�r
|j}q
dS)	Nrr:r3rr<r;r=r>)r?Zdatasizer@rTr
ZNODESIZEr[r]rArZrJ)rrDr*Z	oldoffsetr^rLrrur_r`ZuncompressedlenrGrrrrr"s2

�zdatapack.iterentries)F)N)r,r-r.r/r0rUrP�SUPPORTED_VERSIONSr9r r"r'r(rIr]r+r4rkrqrvrrrrrrr]s$	!
!-
rc@sDeZdZdZeZeZejZejZdgZ	dd�Z
d
dd�Zdd	�ZdS)�mutabledatapacka�A class for constructing and serializing a datapack file and index.

    A datapack is a pair of files that contain the revision contents for various
    file revisions in Mercurial. It contains only revision contents (like file
    contents), not any history information.

    It consists of two files, with the following format. All bytes are in
    network byte order (big endian).

    .datapack
        The pack itself is a series of revision deltas with some basic header
        information on each. A revision delta may be a fulltext, represented by
        a deltabasenode equal to the nullid.

        datapack = <version: 1 byte>
                   [<revision>,...]
        revision = <filename len: 2 byte unsigned int>
                   <filename>
                   <node: 20 byte>
                   <deltabasenode: 20 byte>
                   <delta len: 8 byte unsigned int>
                   <delta>
                   <metadata-list len: 4 byte unsigned int> [1]
                   <metadata-list>                          [1]
        metadata-list = [<metadata-item>, ...]
        metadata-item = <metadata-key: 1 byte>
                        <metadata-value len: 2 byte unsigned>
                        <metadata-value>

        metadata-key could be METAKEYFLAG or METAKEYSIZE or other single byte
        value in the future.

    .dataidx
        The index file consists of two parts, the fanout and the index.

        The index is a list of index entries, sorted by node (one per revision
        in the pack). Each entry has:

        - node (The 20 byte node of the entry; i.e. the commit hash, file node
                hash, etc)
        - deltabase index offset (The location in the index of the deltabase for
                                  this entry. The deltabase is the next delta in
                                  the chain, with the chain eventually
                                  terminating in a full-text, represented by a
                                  deltabase offset of -1. This lets us compute
                                  delta chains from the index, then do
                                  sequential reads from the pack if the revision
                                  are nearby on disk.)
        - pack entry offset (The location of this entry in the datapack)
        - pack content size (The on-disk length of this entry's pack data)

        The fanout is a quick lookup table to reduce the number of steps for
        bisecting the index. It is a series of 4 byte pointers to positions
        within the index. It has 2^16 entries, which corresponds to hash
        prefixes [0000, 0001,..., FFFE, FFFF]. Example: the pointer in slot
        4F0A points to the index position of the first revision whose node
        starts with 4F0A. This saves log(2^16)=16 bisect steps.

        dataidx = <fanouttable>
                  <index>
        fanouttable = [<index offset: 4 byte unsigned int>,...] (2^16 entries)
        index = [<index entry>,...]
        indexentry = <node: 20 byte>
                     <deltabase location: 4 byte signed int>
                     <pack entry offset: 8 byte unsigned int>
                     <pack entry size: 8 byte unsigned int>

    [1]: new in version 1.
    r3cCs
t�|�Sr)rb�compressrdrrr�	_compress�szmutabledatapack._compressNc
Cs�t|�dkrttd�|��t|�dkr8ttd�|��||jvrFdS|�|�}d�t�dt|��|||t�dt|��|f�}t�	|�}|t�dt|��7}||7}|j
��}t|�}	|||	f|j|<|�|�dS)	Nisname too long %srsnode should be 20 bytes %s�r:r;r=)
r[rrrprz�joinr@r&rZ
buildpackmetaZpackfp�tellZwriteraw)
rrrrMrN�metadataZrawdatararDrErrrr+�s.

��

zmutabledatapack.addcCsptdd�t�|j�D��}d}|j}|D]B\}}}}	|tjkrDt}
n|�|t	�}
t
�|||
||	�}||7}q(|S)Ncss$|]\}\}}}||||fVqdSrr)rlrtZdb�o�srrr�	<genexpr>�sz.mutabledatapack.createindex.<locals>.<genexpr>r{)�sortedrZ	iteritemsrprUrZnullidrQr rRr@r&)rZ
nodelocationsZindexoffsetrpZrawindexZfmtrrurDrEZdeltabaselocationrKrrr�createindex�s
�
�
zmutabledatapack.createindex)N)
r,r-r.�__doc__r/r0rrUrPrwrzr+r�rrrrrxNsF
&rx)Z
__future__rr@rbZmercurial.noderrZmercurial.i18nrZ	mercurialrr�r	r
rr\rQrRr/r0Z
basepackstorerrZmutablebasepackrxrrrr�<module>s>r

Youez - 2016 - github.com/yon3zu
LinuXploit