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/mercurial/utils/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib64/python3.9/site-packages/mercurial/utils/__pycache__/storageutil.cpython-39.opt-1.pyc
a

�+�b�C�	@sddlmZddlZddlZddlmZddlmZmZm	Z	ddl
mZmZm
Z
mZddlmZddlmZdd	lmZe�e	j�Zd
Zdd�Ze�d
�Zdd�Zdd�Zdd�Zdd�Z dd�Z!dd�Z"d%dd�Z#dd�Z$dd�Z%dddddej&d d df	d!d"�Z'd#d$�Z(dS)&�)�absolute_importN�)�_)�bin�nullrev�sha1nodeconstants)�dagop�error�mdiff�pycompat)�
repository)�sidedata)�hashutil�cCs^|tjkrt��}|�|�n.||kr0|}|}n|}|}t�|�}|�|�|�|�|��S)z�Compute the SHA-1 for revision data and its parents.

    This hash combines both the current file contents and its history
    in a manner that makes it easy to distinguish nodes with the same
    content in the revision graph.
    )r�nullid�	_nullhash�copy�updater�sha1�digest)�text�p1�p2�s�a�b�r�A/usr/lib64/python3.9/site-packages/mercurial/utils/storageutil.py�hashrevisionsha1$s



r�
cCsf|dd�dkrdSt�|d���}|d|�}i}|��D]}|�dd�\}}|||<q<||dfS)z�Parse metadata header from revision data.

    Returns a 2-tuple of (metadata, offset), where both can be None if there
    is no metadata.
    Nrr)NNs: r)�METADATA_RE�search�start�
splitlines�split)rrZmtext�meta�l�k�vrrr�	parsemetaAs
r)cs,t��}d��fdd�|D��}d||fS)z2Add metadata to fulltext to produce revision text.�c3s|]}d|�|fVqdS)s%s: %s
Nr)�.0r'�r%rr�	<genexpr>Vr*zpackmeta.<locals>.<genexpr>s
%s
%s)�sorted�join)r%r�keysZmetatextrr,r�packmetaSsr1cCst|�d}|od|vS)Nrscensored)r))rr%rrr�iscensoredtextZsr2cCs*|�d�s|S|�dd�}||dd�S)z�Extract just the revision data from source text.

    Returns ``text`` unless it has a metadata header, in which case we return
    a new buffer without hte metadata.
    rrN)�
startswith�index)r�offsetrrr�filtermetadata_s
r6cCsV|�|�dtjkrdSt|�|��d}|rRd|vrRd|vrR|dt|d�fSdS)z�Resolve file revision copy metadata.

    Returns ``False`` if the file has no copy metadata. Otherwise a
    2-tuple of the source filename and node.
    rFscopyscopyrev)�parentsrrr)�revisionr)�store�noder%rrr�filerevisioncopiedlsr;cCsr|�d�rd|}n|}|�|�\}}t|||�}||kr>dS|�|�|��rV|dkS|�|�rn|�|�|kSdS)ahDetermines whether file data is equivalent to a stored node.

    Returns True if the passed file data would hash to the same value
    as a stored revision and False otherwise.

    When a stored revision is censored, filedata must be empty to have
    equivalence.

    When a stored revision has copy metadata, it is ignored as part
    of the compare.
    rs

Tr*F)r3r7r�
iscensored�revZrenamed�read)r9r:ZfiledataZrevisiontextrrZcomputednoderrr�filedataequivalent�s


r?cCs@d}|dur.||krd}||7}||kr2|}n|}t�|||�S)z)Iterate over revision numbers in a store.rN���)rZxrange)Zstorelenr"�stop�steprrr�iterrevs�srCc	Cst|t�r@z|�|�WSty>t�d||td���Yn0t|�dvrrz|�|�|WStjypYn0t|�dvr�zt	|�}|�|�|WSt
y�Yn0zBt|�}d||kr�t�z|�|�WWStt
fy�Yn0Wnttf�yYn0t�||td���dS)a�Resolve the file node for a value.

    ``store`` is an object implementing the ``ifileindex`` interface.

    ``fileid`` can be:

    * A 20 or 32 byte binary node.
    * An integer revision number
    * A 40 or 64 byte hex node.
    * A bytes that can be parsed as an integer representing a revision number.

    ``identifier`` is used to populate ``error.LookupError`` with an identifier
    for the store.

    Raises ``error.LookupError`` on failure.
    s%dsno match found)�� )�(�@N)
�
isinstance�intr:�
IndexErrorr	�LookupErrorr�lenr=r�	TypeError�
ValueError�
OverflowError)r9ZfileidZ
identifierZrawnoder=rrr�fileidlookup�s>
�



rPcCs�t�}|d}i}t�}|D]&}	||	�}
|
||	<|
|kr|�|
�q|r�|d8}|�|�}||krn|�|�n
|�|�||�D].}|tkr�||�}
|
||<|
|kr�|�|
�q�qD||fS)a�Resolve information needed to strip revisions.

    Finds the minimum revision number that must be stripped in order to
    strip ``minlinkrev``.

    Returns a 2-tuple of the minimum revision number to do that and a set
    of all revision numbers that have linkrevs that would be broken
    by that strip.

    ``tiprev`` is the current tip-most revision. It is ``len(store) - 1``.
    ``headrevs`` is an iterable of head revisions.
    ``linkrevfn`` is a callable that receives a revision and returns a linked
    revision.
    ``parentrevsfn`` is a callable that receives a revision number and returns
    an iterable of its parent revision numbers.
    r)�set�add�pop�remover)Z
minlinkrevZtiprevZheadrevsZ	linkrevfnZparentrevsfnZ
brokenrevsZ
strippointZheadsZfuturelargelinkrevs�headZheadlinkrevZlinkrev�pZplinkrevrrr�resolvestripinfo�s,

rWFc
!
#s:|j}
|j�|dkr(�fdd�|D�}n@|dkrR�fdd�|D�}t�||j�}nt�fdd�|D��}d	}|	tjksz|r�|�|d
�d
}t�}|D�]�}|t	kr�q�|
|�}|�|�\}}|r�||�}nt	}|	tjkr�|}n~|	tj
kr�t	}nn|	tjkr�|}n^|t	k�rH||v�r|}n.|�r2|||fv�r2|}n|d	u�rB|}nt	}n|d	u�rX|}nt	}|t	k�r||�r||||��s|t	}d	}d	}d	}|
�rn|�|��s�|�|��rz|�
|�}Wn.tj�y�}z|j}WYd	}~n
d	}~00|t	k�rn|�r�||�}nt|�
|��}n`|t	k�r:|	tjk�r:|�
|�}|�|�n4|�rL|||�}nt�|�
|�|�
|��}|�|�d	}d}|�r�z|�|�}Wntj�y�i}Yn0tj||||d�\}}|�r�t�|�}|�r�||�nd
}d
} |�r| tO} ||d
|d
@B}|||
|�|
|�|
|�|||||| d�
V|}q�d	S)a	Generic implementation of ifiledata.emitrevisions().

    Emitting revision data is subtly complex. This function attempts to
    encapsulate all the logic for doing so in a backend-agnostic way.

    ``store``
       Object conforming to ``ifilestorage`` interface.

    ``nodes``
       List of revision nodes whose data to emit.

    ``resultcls``
       A type implementing the ``irevisiondelta`` interface that will be
       constructed and returned.

    ``deltaparentfn`` (optional)
       Callable receiving a revision number and returning the revision number
       of a revision that the internal delta is stored against. This delta
       will be preferred over computing a new arbitrary delta.

       If not defined, a delta will always be computed from raw revision
       data.

    ``candeltafn`` (optional)
       Callable receiving a pair of revision numbers that returns a bool
       indicating whether a delta between them can be produced.

       If not defined, it is assumed that any two revisions can delta with
       each other.

    ``rawsizefn`` (optional)
       Callable receiving a revision number and returning the length of the
       ``store.rawdata(rev)``.

       If not defined, ``len(store.rawdata(rev))`` will be called.

    ``revdifffn`` (optional)
       Callable receiving a pair of revision numbers that returns a delta
       between them.

       If not defined, a delta will be computed by invoking mdiff code
       on ``store.revision()`` results.

       Defining this function allows a precomputed or stored delta to be
       used without having to compute on.

    ``flagsfn`` (optional)
       Callable receiving a revision number and returns the integer flags
       value for it. If not defined, flags value will be 0.

    ``deltamode``
       constaint on delta to be sent:
       * CG_DELTAMODE_STD  - normal mode, try to reuse storage deltas,
       * CG_DELTAMODE_PREV - only delta against "prev",
       * CG_DELTAMODE_FULL - only issue full snapshot.

       Whether to send fulltext revisions instead of deltas, if allowed.

    ``nodesorder``
    ``revisiondata``
    ``assumehaveparentrevisions``
    ``sidedata_helpers`` (optional)
        If not None, means that sidedata should be included.
        See `revlogutil.sidedata.get_sidedata_helpers`.
    snodescsg|]}�|��qSrr�r+�n�Zfrevrr�
<listcomp>}r*z!emitrevisions.<locals>.<listcomp>slinearcsh|]}�|��qSrrrXrZrr�	<setcomp>r*z emitrevisions.<locals>.<setcomp>c3s|]}�|�VqdS)NrrXrZrrr-�r*z emitrevisions.<locals>.<genexpr>Nr)rr)r9�sidedata_helpersr
r=r)
r:Zp1nodeZp2nodeZbasenode�flags�baserevisionsizer8�deltar
�protocol_flags)r:r=rZ	linearizeZ
parentrevsr.rZCG_DELTAMODE_PREVrQrZCG_DELTAMODE_FULLZCG_DELTAMODE_P1r<Zrawdatar	ZCensoredNodeErrorZ	tombstonerLrRr
Ztextdiffr
�sidedatamodZrun_sidedata_helpersZserialize_sidedata�CG_FLAG_SIDEDATA)!r9ZnodesZ
nodesorderZ	resultclsZ
deltaparentfnZ
candeltafnZ	rawsizefnZ	revdifffnZflagsfnZ	deltamodeZrevisiondataZassumehaveparentrevisionsr]ZfnodeZrevsZprevrevZ	availabler=r:Zp1revZp2revZdeltaparentrev�baserevr8r`r_�eZserialized_sidedataZsidedata_flagsZold_sidedatar
r^rarrZr�
emitrevisions(s�Q










��
�

�

�
rfcCsrt�d�}t|�|krdS||�}t|�|}|d|�t�||�krJdSd}t|�}||kop||||�|kS)aRDetermine if a delta represents censored revision data.

    ``baserev`` is the base revision this delta is encoded against.
    ``baselenfn`` is a callable receiving a revision number that resolves the
    length of the revision fulltext.

    Returns a bool indicating if the result of the delta represents a censored
    revision.
    s>lllFNs
censored:)�struct�calcsizerLr
Zreplacediffheader)r`rdZ	baselenfnZhlenZoldlenZnewlenrRZaddlenrrr�deltaiscensoreds
ri)rN))Z
__future__r�rergZi18nrr:rrr�rr	r
rZ
interfacesrZrevlogutilsr
rbZutilsrrrrrcr�compiler r)r1r2r6r;r?rCrPrWZCG_DELTAMODE_STDrfrirrrr�<module>sB

%
89�
k

Youez - 2016 - github.com/yon3zu
LinuXploit