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__/historypack.cpython-39.pyc
a

�+�bK�@s�ddlmZddlZddlmZmZddlmZmZddl	m
Z
ddlmZm
Z
mZdZe�e�Zd	Zd
Ze�e�ZdZdZd
ZdZdZdZdZdZdZd
ZGdd�dej�Z Gdd�dej�Z!Gdd�dej"�Z#dS)�)�absolute_importN)�hex�sha1nodeconstants)�pycompat�util)�hashutil�)�basepack�	constants�shallowutils!20sQQII�s!20sQs!20s20s20s20sH�R�s.histidxs	.histpack��c@s6eZdZeZeZdd�Zd
dd�Zdd�Zdd	�ZdS)�historypackstorecCst|�S�N)�historypack��self�path�r�E/usr/lib64/python3.9/site-packages/hgext/remotefilelog/historypack.py�getpack0szhistorypackstore.getpackNc	Cs~|jD].}z|j|||d�WSty2Yq0q|��D].}z|j|||d�WStyjYq>0q>t||f��dS)N��known)�packs�getancestors�KeyError�refresh)r�name�noder�packrrrr3s
zhistorypackstore.getancestorsc	Csv|jD]*}z|�||�WSty.Yq0q|��D]*}z|�||�WStybYq:0q:t||f��dSr)r�getnodeinforr)rr r!r"rrrr#Bs
zhistorypackstore.getnodeinfocCstd|t|�f��dS)Ns&cannot add to historypackstore (%s:%s)��RuntimeErrorr�r�filenamer!�p1�p2�linknode�copyfromrrr�addQs�zhistorypackstore.add)N)	�__name__�
__module__�__qualname__�INDEXSUFFIX�
PACKSUFFIXrrr#r,rrrrr,s
rcs�eZdZeZeZdgZ�fdd�Zdd�Zddd�Zd	d
�Z	d dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zd!dd�Zdd�Zdd�Zdd�Z�ZS)"rrcs tt|��|�t|_t|_dSr)�superr�__init__�INDEXFORMAT2�INDEXFORMAT�INDEXENTRYLENGTH2�INDEXENTRYLENGTHr��	__class__rrr3]szhistorypack.__init__c	CsHg}|D]:\}}z|�||�Wqty@|�||f�Yq0q|Sr)�	_findnoder�append)r�keys�missingr r!rrr�
getmissingbszhistorypack.getmissingNcCs\|r||vrgS|j|||d�}i}|D]\}}}}	}
|||	|
f||<q(|sXt||f��|S)z�Returns as many ancestors as we're aware of.

        return value: {
           node: (p1, p2, linknode, copyfrom),
           ...
        }
        r)�
_getancestorsr)rr r!r�	ancestors�results�ancnoder(r)r*r+rrrrlszhistorypack.getancestorscCs|�||�dd�S)Nr)r:)rr r!rrrr#�szhistorypack.getnodeinfoccs�|durt�}|�|�}|\}}}}}	|h}
d}||kr�|
s>q�|�||�\}}
|t7}|
rh|t|
�7}|t}||
vr0|
�|�|t}|t}|t	j
kr�||vr�|
�|�|t	j
kr�||vr�|
�|�||||t|
fVq0dS�Nr)
�set�_findsection�
_readentry�PACKENTRYLENGTH�len�ANC_NODE�remove�
ANC_P1NODE�
ANC_P2NODEr�nullidr,�ANC_LINKNODE)rr r!r�sectionr'�offset�size�nodeindexoffset�
nodeindexsize�pending�o�entryr+rB�p1node�p2noderrrr?�s.



zhistorypack._getancestorscCsR|j}t�t|||t��}d}|t}|dkrJ|t7}||||�}||fSrC)�_data�struct�unpack�
PACKFORMATrG�ANC_COPYFROM)rrP�datarVr+�copyfromlenrrrrF�s�zhistorypack._readentrycCstd|t|�f��dS)Ns!cannot add to historypack (%s:%s)r$r&rrrr,�s�zhistorypack.addcCs�|jdkrF|�||�}|D](\}}}}}||kr|||||fSqnf|�|�}	|	dd�\}
}|�||
|
|t�}|dur�t�t|�\}}
|�|
�\}}|dd�|fSt	d|t
|�f��dS)Nrrrs unable to find history for %s:%s)ZVERSIONr?rE�_bisect�NODEINDEXENTRYLENGTHrZr[�NODEINDEXFORMATrFrr)rr r!r@rBrWrXr*r+rOrRrSrVrPrrrr:�s$

�zhistorypack._findnodecCs�|j}t�|���}t�|j|d|j��d}|j}|||j	}|j
}t�|d|j
�D]}|||j	}	|	|kr\q�q\|}	|�|||	|j�}
|
s�t|��t�|j|
�}|\}}
}}}|j||tj�}t�d|�d}|tj7}|j|||�}||k�rtd||f��||7}t�d|j|
|
tj��d}|
tj7}
|j|
|
|�}|
|7}
||k�rztd||f��|
t7}
|
}|tj|t}|||||fS)Nrr�!Hs&found file name %s when looking for %s)�paramsr�sha1�digestrZr[ZfanoutstructZfanoutprefixZ_fanouttableZ
indexstartZ	_indexendr�xrangeZfanoutcountr`r7rr5�_indexr
�FILENAMESIZErY�ENTRYCOUNTSIZE)rr rd�namehashZ	fanoutkeyZfanout�startZindexend�i�endrV�rawentry�xrPrQrRrSZ
rawnamelenZ
actualnamelenZ
actualnameZfilenamelengthZnodelistoffsetZnodelistsizerrrrE�sn���

�

���


���zhistorypack._findsectionc
Cs�|}|j||t�}|j||t�}||krB|j|||�S||kr\|j|||�S|||kr�|||d}||||}|j||t�}	|	|kr�|j|||�S||	kr�|}q\||	kr\|}q\dS)Nr)rh�
NODELENGTH)
rr!rlrnZentrylenZ	origstartZ	startnodeZendnodeZmidZmidnoderrrr`s$zhistorypack._bisectcCs |D]\}}|�|||�qdSr)Zmarkhistoryentry)r�ledger�optionsr'r!rrr�
markledger"szhistorypack.markledgercCsd|j�|g�}t|�}dd�|D�}t||�dkr`|j|jvr`tj|jdd�tj|j	dd�dS)NcSsh|]}|jr|j|jf�qSr)Zhistoryrepackedr'r!��.0�errr�	<setcomp>)sz&historypack.cleanup.<locals>.<setcomp>rT)Z
ignoremissing)
Zsources�getrDrHrZcreatedrZ
unlinkpathZ	indexpath�packpath)rrr�entriesZallkeysZrepackedkeysrrr�cleanup&s�zhistorypack.cleanupccs(|��D]\}}}}}}||fVqdSr)�iterentries)r�f�nrprrr�__iter__2szhistorypack.__iter__c	csd}||jk�r|j}t�d|||tj��d}|tj7}||||�}||7}t�d|||t��d}|t7}t�|�D]t}t�t	|||t
��}|t
7}||||t�}||t7}||t|t
|t|t|fV|jt
7_q�|��qdS)Nrrcr�!I)ZdatasizerYrZr[r
rirjrrgr\rGr]rIrKrLrNZ_pagedinZ
freememory)	rrPr^Zfilenamelenr'ZrevcountrmrVr+rrrr}6sB��
����	zhistorypack.iterentries)N)N)N)r-r.r/r0r1�SUPPORTED_VERSIONSr3r>rr#r?rFr,r:rEr`rtr|r�r}�
__classcell__rrr8rrWs"


B
rcsVeZdZdZeZeZdgZd�fdd�	Zdd�Zdd�Z	d�fd
d�	Z
dd
�Z�ZS)�mutablehistorypacka�
A class for constructing and serializing a histpack file and index.

    A history pack is a pair of files that contain the revision history for
    various file revisions in Mercurial. It contains only revision history (like
    parent pointers and linknodes), not any revision content information.

    It consists of two files, with the following format:

    .histpack
        The pack itself is a series of file revisions with some basic header
        information on each.

        datapack = <version: 1 byte>
                   [<filesection>,...]
        filesection = <filename len: 2 byte unsigned int>
                      <filename>
                      <revision count: 4 byte unsigned int>
                      [<revision>,...]
        revision = <node: 20 byte>
                   <p1node: 20 byte>
                   <p2node: 20 byte>
                   <linknode: 20 byte>
                   <copyfromlen: 2 byte>
                   <copyfrom>

        The revisions within each filesection are stored in topological order
        (newest first). If a given entry has a parent from another file (a copy)
        then p1node is the node from the other file, and copyfrom is the
        filepath of the other file.

    .histidx
        The index file provides a mapping from filename to the file section in
        the histpack. In V1 it also contains sub-indexes for specific nodes
        within each file. It consists of three parts, the fanout, the file index
        and the node indexes.

        The file index is a list of index entries, sorted by filename hash (one
        per file section in the pack). Each entry has:

        - node (The 20 byte hash of the filename)
        - pack entry offset (The location of this file section in the histpack)
        - pack content size (The on-disk length of this file section's pack
                             data)
        - node index offset (The location of the file's node index in the index
                             file) [1]
        - node index size (the on-disk length of this file's node index) [1]

        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 [00, 01, 02,..., FD, FE, FF]. Example: the pointer in slot 4F
        points to the index position of the first revision whose node starts
        with 4F. This saves log(2^16) bisect steps.

        dataidx = <fanouttable>
                  <file count: 8 byte unsigned> [1]
                  <fileindex>
                  <node count: 8 byte unsigned> [1]
                  [<nodeindex>,...] [1]
        fanouttable = [<index offset: 4 byte unsigned int>,...] (2^16 entries)

        fileindex = [<file index entry>,...]
        fileindexentry = <node: 20 byte>
                         <pack file section offset: 8 byte unsigned int>
                         <pack file section size: 8 byte unsigned int>
                         <node index offset: 4 byte unsigned int> [1]
                         <node index size: 4 byte unsigned int>   [1]
        nodeindex = <filename>[<node index entry>,...] [1]
        filename = <filename len : 2 byte unsigned int><filename value> [1]
        nodeindexentry = <node: 20 byte> [1]
                         <pack file node offset: 8 byte unsigned int> [1]

    [1]: new in version 1.
    rcsDtt|�j|||d�i|_i|_i|_t|_t|_	t
|_
t|_dS)N)�version)r2r�r3�files�entrylocations�fileentriesr4r5r6r7rbra)rZuirzr�r8rrr3�szmutablehistorypack.__init__cCs<|pd}t�dt|��}|j�|g��||||||f�dS)N�rc)rZr"rHr��
setdefaultr;)rr'r!r(r)r*r+r_rrrr,�s
�zmutablehistorypack.addc
s4t|j�D�]"}|j|}|j��}dd�|D���fdd�}ttt�dd�|D�|���}|�dt	�
dt|��|t	�
d	t|��f�tj
t|�d
}g}|j�|i�}||}	|D].}
|	||
<d�|
}|�|�|	t|�7}	q�d�|�}|t|�7}|�|�||f|j|<t�|���}
|
|j|
<q
dS)
NcSsi|]}|d|�qS)rrrurrr�
<dictcomp>�r�z-mutablehistorypack._write.<locals>.<dictcomp>csD�|\}}}}}}g}|tjkr,|�|�|tjkr@|�|�|Sr)rrMr;)r!rpr(r)�parents�Zentrymaprr�
parentfunc�s



z-mutablehistorypack._write.<locals>.parentfunccss|]}|dVqdS)rNrrurrr�	<genexpr>�r�z,mutablehistorypack._write.<locals>.<genexpr>s%s%s%srcr�rs%s%s%s%s%s%sr�)�sortedr�Zpackfp�tell�list�reversedrZ	sortnodesZwriterawrZr"rHr
rir�r�r;�joinr�rrerfr{)
rr'r{Zsectionstartr�ZsortednodesZ
sectionlenZ
rawstringsZ	locationsrPr!�rawZrawdatarr�r�_write�sB

	�����	


zmutablehistorypack._writeNcs$|jr
dS|��tt|�j|d�S)N)rr)Z_closedr�r2r��close)rrrr8rrr��szmutablehistorypack.closec	Cs@|j}|j}|j}|j}dd�t�|j�D�}t|�}t�	d�}||t
|�||}	g}
g}d}|D]�\}
}}}|j|}t
|�|}t�||
|||	|�}|�
t�tjt
|��|�|	tjt
|�7}	tt�|��D]$\}}|�
t�|||��|d7}q�|	t
|�|7}	|
�
|�qht�d|�}d�|
�|d�|�S)Ncss,|]$\}\}}t�|���|||fVqdSr)rrerf)rvr'rPrQrrrr�
s
�z1mutablehistorypack.createindex.<locals>.<genexpr>s!Qrrr�)r5r7rbrarZ	iteritemsr�r�rZ�calcsizerHr�r"r;r
ZFILENAMESTRUCTrir�)rZ
nodelocationsZindexoffsetZfileindexformatZfileindexlengthZnodeindexformatZnodeindexlengthr�ZindexlensizerRZfileindexentriesZnodeindexentriesZ	nodecountrkr'rPrQrSror!�locationZnodecountrawrrr�createindexsb
�
�
���
�	��
���zmutablehistorypack.createindex)r)N)
r-r.r/�__doc__r0r1r�r3r,r�r�r�r�rrr8rr�`sK8r�)$Z
__future__rrZZmercurial.noderrZ	mercurialrrZmercurial.utilsr�r	r
rr4r�r6rqrbrar\rGrjr0r1rIrKrLrNr]Z
basepackstorerrZmutablebasepackr�rrrr�<module>s2

+

Youez - 2016 - github.com/yon3zu
LinuXploit