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 :  /usr/lib64/python3.9/site-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

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

�+�b�-�@s�ddlmZddlZddlZddlZddlZddlmZddlm	Z	m
Z
mZddlm
Z
ddlmZmZmZmZmZmZmZmZmZddlmZmZdd	lmZe�d
�Zej Z dZ!dd
�Z"dd�Z#Gdd�de$�Z%Gdd�de$�Z&dd�Z'dd�Z(hd�Z)Gdd�de$�Z*z
ej+Z*Wne,�y*Yn0e�-ej.�Gdd�de$��Z/d@dd�Z0dd �Z1d!d"�Z2d#d$�Z3d%d&�Z4e�-ej.�Gd'd(�d(e$��Z5Gd)d*�d*ej6�Z7d+Z8Gd,d-�d-e9�Z:e�-ej;�Gd.d/�d/e$��Z<e�-ej=�Gd0d1�d1e$��Z>e�-ej?�Gd2d3�d3e$��Z@e�-ejA�Gd4d5�d5e$��ZBe�-ej?�Gd6d7�d7e$��ZCe�-ejA�Gd8d9�d9e$��ZDGd:d;�d;e5�ZEGd<d=�d=eD�ZFGd>d?�d?e<�ZGdS)A�)�absolute_importN�)�_)�bin�hex�nullrev)�getattr)	�encoding�error�match�mdiff�pathutil�policy�pycompat�revlog�util)�
repositoryr)�	constants�parsersi�ccs�|r|dd�dkrtd��d}|��D]�}|durD||krDtd��|}|�d�\}}t|�}|dd�}|tvr�|dd�}|d8}nd}|d|kr�td	��|t|�|fVq(dS)
N����
�"Manifest did not end in a newline.�#Manifest lines not in sorted order.�r���Invalid manifest line)�
ValueError�
splitlines�split�len�_manifestflagsr)�nodelen�data�prev�l�f�n�nl�flags�r*�8/usr/lib64/python3.9/site-packages/mercurial/manifest.py�_parse0s"
r,cCsLg}g}|D],\}}}|�|�|�d|t|�|f�qt|�d�|�S)N�%s%s%s
r)�appendr�_checkforbidden�join)�it�files�linesr&r'�flr*r*r+�_textKs
r5c@s(eZdZdd�Zdd�Zdd�ZeZdS)�lazymanifestitercCsd|_||_dS�Nr)�pos�lm��selfr9r*r*r+�__init__Yszlazymanifestiter.__init__cCs|S�Nr*�r;r*r*r+�__iter__]szlazymanifestiter.__iter__cCsrz|j�|j�\}}Wnty,t�Yn0|dkrL|jd7_|dS|jd7_|�d|�}|||�S)Nrrrr)r9�_getr8�
IndexError�
StopIteration�find)r;r#r8�zeroposr*r*r+�next`s
zlazymanifestiter.nextN��__name__�
__module__�__qualname__r<r?rE�__next__r*r*r*r+r6Xsr6c@s(eZdZdd�Zdd�Zdd�ZeZdS)�lazymanifestiterentriescCs||_d|_dSr7)r9r8r:r*r*r+r<psz lazymanifestiterentries.__init__cCs|Sr=r*r>r*r*r+r?tsz lazymanifestiterentries.__iter__cCsz|j�|j�\}}Wnty,t�Yn0|dkrH|jd7_|S|�d|�}|�d|�}|dksx|dksx||kr�t�d��||d|�}|tvr�||d}n||d}d}|d|jj	kr�t�d��t
||jj|j|d|�}|jd7_|||�||fS)Nrrrrrrr)r9r@r8rArBrCr
�StorageErrorr!�_nodelen�	unhexlify�	extrainfo)r;r#r8rD�nlposr)�hlen�hashvalr*r*r+rEws.


�zlazymanifestiterentries.nextNrFr*r*r*r+rKosrKcCs,t||||��}|r(|t|d@�7}|S)N�)r�chr)r#Zextrar8�length�sr*r*r+rN�srNcCs||k||kSr=r*)�a�br*r*r+�_cmp�srY>r�t�x�lc@s�eZdZdZd,dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd-d d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�ZdS).�
_lazymanifesta�A pure python manifest backed by a byte string.  It is supplimented with
    internal lists as it is modified, until it is compacted back to a pure byte
    string.

    ``data`` is the initial manifest data.

    ``positions`` is a list of offsets, one per manifest entry.  Positive
    values are offsets into ``data``, negative values are offsets into the
    ``extradata`` list.  When an entry is removed, its entry is dropped from
    ``positions``.  The values are encoded such that when walking the list and
    indexing into ``data`` or ``extradata`` as appropriate, the entries are
    sorted by filename.

    ``extradata`` is a list of (key, hash, flags) for entries that were added or
    modified since the manifest was created or compacted.
    NFcCsz||_|dur@|�|�|_dgt|j�|_||_g|_d|_n6|dd�|_|dd�|_|dd�|_||_||_dS)NrF)rM�	findlines�	positionsr rOr#�	extradata�hasremovals)r;r"r#r_rOr`rar*r*r+r<�s	z_lazymanifest.__init__cCs�|sgS|�d�}|dks*|dd�dkr2td��dg}|d|�d��}|t|�dkr�|dkr�|�|d�||d|�d|d��}||kr�td��|}|�d|d�}qJ|S)Nrrrrrrr)rCrr r.)r;r#r8r_r$Znextsr*r*r+r^�s
z_lazymanifest.findlinescCs0|j|}|dkr|j|fS|j|ddfS)Nrrr)r_r#r`)r;�indexr8r*r*r+r@�s

z_lazymanifest._getcCs8|dkr$|j||j�d|d��S|j|ddS)Nrrr)r#rCr`)r;r8r*r*r+�_getkey�sz_lazymanifest._getkeycCspd}t|j�d}||krl||d}|j|}|�|�}t||�}|dkrP|S|dkrb|d}q|d}qdS)Nrrrr�r r_rcrY�r;�key�firstZlastZmidpointZnextpos�	candidate�rr*r*r+�bsearch�s




z_lazymanifest.bsearchcCsxd}t|j�d}||krp||d}|j|}|�|�}t||�}|dkrT|dfS|dkrf|d}q|d}q|dfS)NrrrTFrdrer*r*r+�bsearch2�s




z_lazymanifest.bsearch2cCs|�|�dkS�Nr)rj�r;rfr*r*r+�__contains__sz_lazymanifest.__contains__c
Cs�t|t�std��|�|�}|dkr(t�|�|�\}}|dkrN|d|dfS|�d|�}|�d|�}|dks~|dks~||kr�t�d��||d}||d|�}|t	vr�|d8}nd}|d|j
kr�t�d��t||j||d|�}	|	|fS)	Ns'getitem: manifest keys must be a bytes.rrrrrrr)
�
isinstance�bytes�	TypeErrorrj�KeyErrorr@rCr
rLr!rMrNrO)
r;rf�needler#r8rDrPrQr)rRr*r*r+�__getitem__s*




z_lazymanifest.__getitem__cCs�|�|�\}}|st�|j|}|jd|�|j|dd�|_|jd|�|j|dd�|_|dkr�|jd|�d|j|dd�|_d|_dS)NrrrT)rkrrr_rOr#ra)r;rfrs�found�curr*r*r+�__delitem__-s
""&z_lazymanifest.__delitem__cCsRt|t�std��t|t�r(t|�dkr0td��|d}t|t�rNt|�dvrVtd��|d}t|t�rtt|�dkr~td|��|�|�\}}|r�|j|}|dkr�|||df|j|d<n(|j�|||df�t|j�|j|<nf|j�|||df�|jd|�t|j�g|j|d�|_|j	d|�dg|j	|d�|_	dS)	Ns-setitem: manifest keys must be a byte string.rs1Manifest values must be a tuple of (node, flags).r)�� s-node must be a 20-byte or 32-byte byte stringrs'flags must a 0 or 1 byte string, got %r)
rorprq�tupler rkr_r`r.rO)r;rf�valuerRr)rsrur8r*r*r+�__setitem__:s8
�

��� �z_lazymanifest.__setitem__cCst|j|j|j|j|j|j�Sr=)r]rMr#r_rOr`rar>r*r*r+�copy]s�z_lazymanifest.copyc	Cs�t|j�dkr|jsdSg}d}d}dgt|j�|_|t|j�k�r�|j|dk�r|j|}|}||j|<|d7}|t|j�ks�|j|dkr�q�|jr�|j�d||j|�dkr�q�||j||7}|j|}qd|j�d|�}|dkr�|d7}|||7}|�|j||��q6|t|j�kr6|j|dkr6|j|}|j|d}|�|�|��||j|<d}t|d�dk�r~d}t|d�|k�r�t	|d|d�|j|<|t|d�7}|d7}�qq6d	�
|�|_d
|_g|_dS)Nrrs
rrrx�ryrF)r r`rar_rOr#rCr.�_pack�ordr0)	r;r%�i�offsetrvZlast_cutZend_cut�trQr*r*r+�_compacthsV

���

z_lazymanifest._compactcCs(|d}|ddt|�|ddS)Nrrrrr)r)r;�dr'r*r*r+r�sz_lazymanifest._packcCs|��|jSr=)r�r#r>r*r*r+�text�sz_lazymanifest.textcCs�i}|��D]V\}}}||vr0||fdf||<q||}||f|krV||f|f||<q|rd||<q|��D]"\}}}||vrld||ff||<ql|S)z2Finds changes between the current manifest and m2.�NrN)�iterentries)r;�m2�clean�diff�fn�e1r)�e2r*r*r+r��s
z_lazymanifest.diffcCst|�Sr=)rKr>r*r*r+r��sz_lazymanifest.iterentriescCst|�Sr=�r6r>r*r*r+�iterkeys�sz_lazymanifest.iterkeyscCst|�Sr=r�r>r*r*r+r?�sz_lazymanifest.__iter__cCs
t|j�Sr=)r r_r>r*r*r+�__len__�sz_lazymanifest.__len__cCs8t|jd�}|��D]\}}}||�r||f||<q|Sr�)r]rMr�)r;Zfilterfn�cr&r'r4r*r*r+�
filtercopy�s
z_lazymanifest.filtercopy)NNNF)F)rGrHrI�__doc__r<r^r@rcrjrkrnrtrwr|r}r�rr�r�r�r�r?r�r�r*r*r*r+r]�s2�
	
#;
r]c@s�eZdZd<dd�Zdd�Zdd�Zdd	�Zd
d�ZeZdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zd=dd�Zedd��Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd>d(d)�Zd*d+�Zd?d,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Z dS)@�manifestdictrcCs||_t||�|_dSr=)rMr]�_lm)r;r"r#r*r*r+r<�szmanifestdict.__init__cCs|j|dSr7�r�rmr*r*r+rt�szmanifestdict.__getitem__cCs
|j|Sr=r�rmr*r*r+rC�szmanifestdict.findcCs
t|j�Sr=�r r�r>r*r*r+r��szmanifestdict.__len__cCst|j�dkSr7r�r>r*r*r+�__nonzero__�szmanifestdict.__nonzero__cCs||�|�f|j|<dSr=)r)r�)r;rf�noder*r*r+r|�szmanifestdict.__setitem__cCs|durdS||jvS�NFr�rmr*r*r+rn�szmanifestdict.__contains__cCs|j|=dSr=r�rmr*r*r+rw�szmanifestdict.__delitem__cCs
|j��Sr=)r�r?r>r*r*r+r?�szmanifestdict.__iter__cCs
|j��Sr=)r�r�r>r*r*r+r�szmanifestdict.iterkeyscCst|���Sr=��listr�r>r*r*r+�keysszmanifestdict.keysNcsP|dur>t�|dd��}t��|����fdd�|�|�D�S�fdd�|D�S)�7Set of files in this manifest that are not in the otherNcSsdSr=r*)�path�msgr*r*r+�<lambda>	rz)manifestdict.filesnotin.<locals>.<lambda>csh|]}|�vr|�qSr*r*��.0r&)�sm2r*r+�	<setcomp>rz*manifestdict.filesnotin.<locals>.<setcomp>csh|]}|�vr|�qSr*r*r�)r�r*r+r�r)�matchmodZbadmatch�set�walk)r;r�rr*)r�r�r+�
filesnotins
zmanifestdict.filesnotincCs
t�|�Sr=�r
�dirsr>r*r*r+�_dirsszmanifestdict._dirscCs|jSr=�r�r>r*r*r+r�szmanifestdict.dirscCs
||jvSr=r�)r;�dirr*r*r+�hasdirszmanifestdict.hasdircs:|��}t|�dko8|��p8|��o8t�fdd�|D��S)znChecks whether we can correctly and quickly iterate over matcher
        files instead of over manifest files.�dc3s|]}|�vVqdSr=r*)r�r�r>r*r+�	<genexpr>rz.manifestdict._filesfastpath.<locals>.<genexpr>)r2r Zisexact�prefix�all)r;rr2r*r>r+�_filesfastpaths
�zmanifestdict._filesfastpathccs�|��r t|�D]
}|VqdSt|���}|�|�rVt|�D]}||vr>|Vq>dS|D]$}||vrp|�|�||�rZ|VqZ|�d�t|�D]}|�|�s�|�	|d�q�dS)z�Generates matching file names.

        Equivalent to manifest.matches(match).iterkeys(), but without creating
        an entirely new manifest.

        It also reports nonexistent files by marking them bad with match.bad().
        Nr)
�always�iterr�r2r��sorted�remove�discardr��bad�r;rr&�fsetr�r*r*r+r�!s&



zmanifestdict.walkcCsn|��r|��S|�|�rRt|j�}|j}|��D]}||vr2|||j|<q2|St|j�}|j�|�|_|S)z6generate a new manifest filtered by the match argument)r�r}r�r�rMr�r2r�)r;r�mr9r�r*r*r+�_matchesFs


zmanifestdict._matchesFcCs6|r&|�|�}|�|�}|j||d�S|j�|j|�S)�zFinds changes between the current manifest and m2.

        Args:
          m2: the manifest to which this manifest should be compared.
          clean: if true, include files unchanged between these manifests
                 with a None value in the returned dictionary.

        The result is returned as a dict with filename as key and
        values of the form ((n1,fl1),(n2,fl2)), where n1/n2 is the
        nodeid in the current/other manifest and fl1/fl2 is the flag
        in the current/other manifest. Where the file does not exist,
        the nodeid will be None and the flags will be the empty
        string.
        �r�)r�r�r�)r;r�rr��m1r*r*r+r�Ws


zmanifestdict.diffcCs&|tvrtd��|||f|j|<dS)N�Invalid manifest flag set.)r!rqr�)r;rf�flagr*r*r+�setflaglszmanifestdict.setflagcCs,z|j|dWSty&|YS0dSr7�r�rr)r;rf�defaultr*r*r+�getqszmanifestdict.getcCs*z|j|dWSty$YdS0dS)Nrrr�rmr*r*r+r)wszmanifestdict.flagscCst|j�}|j��|_|Sr=)r�rMr�r})r;r�r*r*r+r}}s
zmanifestdict.copycCsdd�|j��D�S)Ncss|]}|dd�VqdS�Nrr*�r��xr*r*r+r��rz%manifestdict.items.<locals>.<genexpr>�r�r�r>r*r*r+�items�szmanifestdict.itemscCsdd�|j��D�S)Ncss|]}|dd�VqdSr�r*r�r*r*r+r��rz)manifestdict.iteritems.<locals>.<genexpr>r�r>r*r*r+�	iteritems�szmanifestdict.iteritemscCs
|j��Sr=r�r>r*r*r+r��szmanifestdict.iterentriescCs
|j��Sr=)r�r�r>r*r*r+r��szmanifestdict.textcCsRg}d}d}dg}d}t�|�}t|�}t|�tk�r&|D]�\}	}
t||	|�\}}|
sx|j|	\}}
d|	t|�|
f}n||kr�tt	d�|	��d}|dur�||kr�||kr�||kr�|}|r�|�
|�q:|dur�|�
||d�|�g�|}|}|g}q:|du�r|�
||d�|�g�t||�\}}n$t
|���}t�t�|�t�|��}||fS)z�Given a base manifest text as a bytearray and a list of changes
        relative to that text, compute a delta that can be used by revlog.
        Nrrr-s!failed to remove %s from manifest)r�bufferr�r �FASTDELTA_TEXTDIFF_THRESHOLD�_msearchr�r�AssertionErrorrr.r0�
_addlistdelta�	bytearrayr�rZtextdiff)r;�base�changesZdeltaZdstartZdendZdline�startZaddbufr&Ztodelete�end�hr4r%�	deltatext�	arraytextr*r*r+�	fastdelta�sH

�
�zmanifestdict.fastdelta)r)N)NF)N)!rGrHrIr<rtrCr�r��__bool__r|rnrwr?r�r�r��
propertycacher�r�r�r�r�r�r�r�r�r)r}r�r�r�r�r�r*r*r*r+r��s<


	%

r�c	s���fdd�}|s||fSt���|s*�}||kr�||d}|}|dkrh�|d|�dkrh|d8}qB||d�}t�||��|kr�||dd�d}q*|}q*||d�}�||�}||kr�||dd�}||dfS||fSd	S)
aEreturn a tuple (start, end) that says where to find s within m.

    If the string is found m[start:end] are the line containing
    that string.  If start == end the string was not found and
    they indicate the proper sorted insertion point.

    m should be a buffer, a memoryview or a byte string.
    s is a byte stringcs*|�kr&�||d�|kr&|d7}q|S)Nrr*)r�r��Zlenmr�r*r+�advance�s
z_msearch.<locals>.advancerrrrr�(N)r rp)	r�rV�lo�hir�Zmidr�r�rur*r�r+r��s*



r�cCs6|D],}d|vsd|vrt�td�t�|���qdS)z'Check filenames for illegal characters.r�
s)'\n' and '\r' disallowed in filenames: %rN)r
rLrr�bytestr)r%r&r*r*r+r/�s��r/cCsjd}t�}|D].\}}}||||�7}|r8|t|�7}|}q|||d�7}d�dd�|D��}||fS)Nrrcss,|]$\}}}t�d||t|��|VqdS)s>lllN)�struct�packr )r�r�r��contentr*r*r+r�
s�z _addlistdelta.<locals>.<genexpr>)r�r0)Zaddlistr�ZcurrentpositionZ
newaddlistr�r�r�r�r*r*r+r��s
�r�cCs0d|vr$|�dd�\}}|d|fSd|fSdS)N�/rr)r)r&r��subpathr*r*r+�_splittopdirsr�cCsdSr=r*�rVr*r*r+r�rr�c@s�eZdZd^dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
e
Zdd�Ze
jdd��Zdd�Zdd�Zdd�Zdd�Zdd�ZeZd d!�Zd"d#�Zd$d%�Zd&d'�Zd_d)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Z d7d8�Z!d9d:�Z"d`d;d<�Z#e$d=d>��Z%d?d@�Z&dAdB�Z'dCdD�Z(dEdF�Z)dGdH�Z*dIdJ�Z+dKdL�Z,dadNdO�Z-dPdQ�Z.dRdS�Z/dTdU�Z0dVdW�Z1dXdY�Z2dZd[�Z3dbd\d]�Z4d(S)c�treemanifestrcCsl||_||_|jj|_|jj|_t|_t|_d|_	i|_
i|_i|_i|_
|rhdd�}|�||�d|_	dS)NFcSstd��dS)Ns4treemanifest constructor only accepts flat manifests)r�)�subdir�submr*r*r+�readsubtree0s�z*treemanifest.__init__.<locals>.readsubtreeT)�_dir�
nodeconstants�nullid�_noder"rM�_noop�	_loadfunc�	_copyfunc�_dirtyr��	_lazydirs�_files�_flags�parse)r;r�r�r�r�r*r*r+r<!s

ztreemanifest.__init__cCs
|j|Sr=�r�)r;r�r*r*r+�_subpath8sztreemanifest._subpathcCs`|j}|j}t�|j�D]<\}\}}}|rB|||�|���||<q|||�|�||<qi|_dSr=)r�r�rr�r�r})r;Zselfdirsr�r�r�r��docopyr*r*r+�_loadalllazy;s�ztreemanifest._loadalllazycCs\|j�|�}|rX|\}}}|r:||�|�|���|j|<n||�|�|�|j|<|j|=dSr=)r�r�r�r}r�)r;r��vr�r�r�r*r*r+�	_loadlazyGs
ztreemanifest._loadlazycCsD|sdS|dks|dkr$|��dS|j}|D]}||d�q.|S)N�all�thisr�)rr)r;�visitZloadlazy�kr*r*r+�_loadchildrensetlazyQsz!treemanifest._loadchildrensetlazycCs�g}t�|j�D]2\}}|j�|�}|r8|d|dkr|�|�qt�|j�D]\}}||jvrP|�|�qP|D]}|�|�|�|�qrdS)amload items in t1 and t2 if they're needed for diffing.

        The criteria currently is:
        - if it's not present in _lazydirs in either t1 or t2, load it in the
          other (it may already be loaded or it may not exist, doesn't matter)
        - if it's present in _lazydirs in both, compare the nodeid; if it
          differs, load it in both
        rN)rr�r�r�r.r)r;�t1�t2Z
toloadlazyr�Zv1Zv2r*r*r+�
_loaddifflazy]s	

ztreemanifest._loaddifflazycCs:|��t|j�}|��|j��D]}||��7}q$|Sr=)�_loadr r�rr��valuesr�)r;�sizer�r*r*r+r�ss
ztreemanifest.__len__cCs
|��Sr=��_isemptyr>r*r*r+r�{sztreemanifest.__nonzero__cCsX|��|js,|jr0tdd�|j��D��r0dS|��|jpVtdd�|j��D��S)Ncss|]}|��VqdSr=r�r�r�r*r*r+r��rz(treemanifest._isempty.<locals>.<genexpr>Fcss|]}|��VqdSr=rrr*r*r+r��r)rr�r��anyrrr�r>r*r*r+r�s��ztreemanifest._isemptycCs*d|jt|j�t|jtu�|jt|�fS)Ns;<treemanifest dir=%s, node=%s, loaded=%r, dirty=%r at 0x%x>)r�rr��boolr�r�r��idr>r*r*r+�__repr__�s���ztreemanifest.__repr__cCs|jS)z}The directory that this tree manifest represents, including a
        trailing '/'. Empty string for the repo root directory.r�r>r*r*r+r��sztreemanifest.dircCs|jS)z�This node of this instance. nullid for unsaved instances. Should
        be updated when the instance is read or written from a revlog.
        �r�r>r*r*r+r��sztreemanifest.nodecCs||_d|_dSr�)r�r��r;r�r*r*r+�setnode�sztreemanifest.setnodeccsv|��|��tt�|j��|j����D]D\}}||jvr\|�|�||j	�
|d�fVq,|��D]
}|Vqdq,dSr�)rrr��	itertools�chainr�r�r�r�r�r�r�)r;�pr'r�r*r*r+r��s�
ztreemanifest.iterentriesccst|��|��tt�|j��|j����D]B\}}||jvrP|�|�|fVq,t	�
|�D]\}}||fVqZq,dSr=)rrr�rrr�r�r�r�rr�)r;rr'r&Zsnr*r*r+r��s�
ztreemanifest.itemsccs\|��|��tt�|j|j��D]2}||jvr@|�|�Vq$|j|D]
}|VqJq$dSr=)rrr�rrr�r�r�)r;rr&r*r*r+r��s
ztreemanifest.iterkeyscCst|���Sr=r�r>r*r*r+r��sztreemanifest.keyscCs|��Sr=)r�r>r*r*r+r?�sztreemanifest.__iter__cCsZ|durdS|��t|�\}}|rL|�|�||jvr<dS|j|�|�S||jvSdSr�)rr�rr�rnr��r;r&r�r�r*r*r+rn�s

ztreemanifest.__contains__NcCsT|��t|�\}}|rB|�|�||jvr0|S|j|�||�S|j�||�SdSr=)rr�rr�r�r�)r;r&r�r�r�r*r*r+r��s

ztreemanifest.getcCs@|��t|�\}}|r2|�|�|j|�|�S|j|SdSr=)rr�rr�rtr�rr*r*r+rt�s
ztreemanifest.__getitem__cCsj|��t|�\}}|r@|�|�||jvr0dS|j|�|�S||jvsT||jvrXdS|j�|d�SdSr�)rr�rr�r)r�r�r�rr*r*r+r)�s

ztreemanifest.flagscCsN|��t|�\}}|r2|�|�|j|�|�S|j||j�|d�fSdSr�)rr�rr�rCr�r�r�rr*r*r+rCs
ztreemanifest.findcCsn|��t|�\}}|rJ|�|�|j|�|�|j|��rd|j|=n|j|=||jvrd|j|=d|_dS�NT)	rr�rr�rwrr�r�r�rr*r*r+rws


ztreemanifest.__delitem__cCsl|��t|�\}}|rX|�|�||jvrDt|j|�|��|j|<|j|�||�n
||j|<d|_	dSr)
rr�rr�r�r�r�r|r�r�)r;r&r'r�r�r*r*r+r|s

�

ztreemanifest.__setitem__cCsF|jtur"|jt}|_||�n |jturB|jt}|_||�dSr=)r�r�r�)r;Zlf�cfr*r*r+r2s


ztreemanifest._loadcCs||tvrtd��|��t|�\}}|rh|�|�||jvrTt|j|�|��|j|<|j|�	||�n
||j
|<d|_dS)z/Set the flags (symlink, executable) for path f.r�TN)r!rqrr�rr�r�r�r�r�r�r�)r;r&r)r�r�r*r*r+r�:s

�

ztreemanifest.setflagcs\t�j�j�}�j|_�j|_�jturP�fdd�}�jturH||�qX||_n�j|_|S)Ncsh���dd�t��j�D�|_|j}t��j�D]\}}|��||<q2t��j�|_t��j�|_dS)NcSs"i|]\}\}}}|||df�qS�Tr*)r�r�r'rir�r*r*r+�
<dictcomp>Ss�z8treemanifest.copy.<locals>._copyfunc.<locals>.<dictcomp>)	rrr�r�r�r}�dictr�r�)rVZsdirsr�rr>r*r+r�Qs
�z$treemanifest.copy.<locals>._copyfunc)r�r�r�r�r�r�r�r�)r;r}r�r*r>r+r}Ks


ztreemanifest.copycsN|r*|��s*��|�}|�|�}|�|�St�����fdd����|��S)r�cs�|j|jkr|js|jsdS|��|����||�t�|j�D]6\}}||jvrl|j|}�||�qD��|���qD|j	D]}||j	vr���
|�|��q�dSr=)r�r�rr
rr�r��updater�r��addr�)rr	r�r�r�r���_filesnotinr2r;r*r+r$ns



z,treemanifest.filesnotin.<locals>._filesnotin)r�r�r�r�)r;r�rr�r*r#r+r�es



ztreemanifest.filesnotincCs
t�|�Sr=r�r>r*r*r+�_alldirs�sztreemanifest._alldirscCs|jSr=)r%r>r*r*r+r��sztreemanifest.dirscCs\|��t|�\}}|r@|�|�||jvr<|j|�|�SdS|d}||jvpZ||jvS)NFr�)rr�rr�r�r�)r;r�Ztopdirr�Zdirslashr*r*r+r��s

ztreemanifest.hasdirccs�|��r t|�D]
}|VqdSt|���}|�|�D]}||vrL|�|�|Vq6|�d�t|�D]}|�|�sf|�	|d�qfdS)zxGenerates matching file names.

        It also reports nonexistent files by marking them bad with match.bad().
        Nr)
r�r�r�r2�_walkr�r�r�r�r�r�r*r*r+r��s


ztreemanifest.walkccs�|�|jdd��}|sdS|��|�|�}tt|j�t|j��D]X}||jvrn|�|�}||�r�|VqF|r�|dd�|vrF|j|�	|�D]
}|Vq�qFdS)z5Recursively generates matching file names for walk().Nr)
�visitchildrensetr�rrr�r�r�r�r�r&)r;rrr�fullpr&r*r*r+r&�s


ztreemanifest._walkcCs|��r|��S|�|�S)zCrecursively generate a new manifest filtered by the match argument.)r�r}�_matches_inner)r;rr*r*r+r��sztreemanifest._matchesc	Cs|��r|��S|�|jdd��}|dkr4|��St|j|j�}|sJ|S|��|jD]T}|dkrn||vrnqX|�|�}||�s�qX|j||j|<||j	vrX|j	||j	|<qX|�
|�}t�|j
�D]:\}}|r�|dd�|vr�q�|�|�}|��s�||j
|<q�|���sd|_|S)NrrrT)r�r}r'r�r�r�rr�r�r�rrr�r�r)rr�)	r;rr�retr�r(r�r�r�r*r*r+r)�s8





ztreemanifest._matches_innercCs
t��dSr=)�FastdeltaUnavailable)r;r�r�r*r*r+r��sztreemanifest.fastdeltaFc	s�|r.|��s.��|�}|�|�}|j|�d�Si�t�j������fdd�}g}|�||�|r||��\}}||||�q^�S)r�r�csd|j|jkr|js|jsdS|��|����||�t�|j�D]$\}}|j�|��}|�||f�qDt�|j�D] \}}||jvrv|��|f�qvt�|j	�D]r\}}|j
�|d�}|j	�|d�}	|j
�|d�}
||	ks�||
k�r||f|	|
ff�|�|�<q��r�d�|�|�<q�t�|j	�D]:\}}	||j	v�r$|j
�|d�}
d|	|
ff�|�|�<�q$dS)zicompares two tree manifests and append new tree-manifests which
            needs to be compared to stackNrr�)r�r�rr
rr�r�r�r.r�r�r�)rr	�stackr�r�r�r��n1�fl1Zn2Zfl2�r��	emptytree�resultr;r*r+�_iterativediff	s.
z)treemanifest.diff.<locals>._iterativediff)r�r�r�r�r��pop)	r;r�rr�r�r2Zstacklsrr	r*r/r+r��s


ztreemanifest.diffcCs|jo|jo|j|jkSr=)r�r�)r;r�r*r*r+�unmodifiedsince0sztreemanifest.unmodifiedsincecCs||j}t|j|�D]d\}}}|dkr<|d}||df||<qd|vr^|||<|rv|�||�q||j|<|r||j|<qdS)NrZr�F)r�r,rMr�r�r�)r;r�r�Zselflazyr&r'r4r*r*r+r�3s
ztreemanifest.parsecCs|��t|���S)z3Get the full data of this manifest as a bytestring.)rr5r�r>r*r*r+r�Jsztreemanifest.textcsb����j�dd�t��j�D�}�fdd��jD�}��fdd��jD�}tt|||��S)z�Get the full data of this directory as a bytestring. Make sure that
        any submanifests have been written first, so their nodeids are correct.
        cSs&g|]\}}|dd�|ddf�qS)NrrrZr*)r�r�rr*r*r+�
<listcomp>Usz(treemanifest.dirtext.<locals>.<listcomp>cs&g|]}|dd��j|jdf�qS)NrrZ)r�r�)r�r�r>r*r+r5Xrcs g|]}|�j|�|�f�qSr*)r�r��r)r;r*r+r5Yr)	rr)rr�r�r�r�r5r�)r;Zlazydirsr�r2r*r6r+�dirtextOs
�ztreemanifest.dirtextcs��fdd�}||_dS)Ncs|�����d|_dSr�)r�r�r���gettextr�r*r+�_load_for_read]sz)treemanifest.read.<locals>._load_for_read)r�)r;r9r�r:r*r8r+�read\sztreemanifest.readcs�|��|��|��t|j���fdd�}|�|jdd��}|�|�}|dks\|dkr`d}t�|j�D]V\}}|r�|dd�|vr�ql|||�}	|||�}
|	|jj	kr�|
|	}	}
|||	|
|�qldS)Ncs(|j�|�}|r|dS|j�|��jSr7)r�r�r�r�)r�r�Zld�r0r*r+�getnodeisz+treemanifest.writesubtrees.<locals>.getnoderrr)
rr�r�r'r�rrr�r�r�)r;r�r��writesubtreerr=rr�r��subp1�subp2r*r<r+�
writesubtreescs"




ztreemanifest.writesubtreesccsz|r|�|jdd��sdS|r2||jdd��r8|V|��|��t�|j�D] \}}|j|d�D]
}|VqhqTdS)z�Returns an iterator of the subtrees of this manifest, including this
        manifest itself.

        If `matcher` is provided, it only returns subtrees that match.
        Nr)�matcher)�visitdirr�rrrr�r��walksubtrees)r;rBr�r�Zsubtreer*r*r+rD}sztreemanifest.walksubtrees)rr)N)N)NF)N)5rGrHrIr<r�rrrr
r�r�r�rr	Z	strmethodrr�r�rr�r�r�r�r�r?rnr�rtr)rCrwr|rr�r}r�r�r%r�r�r�r&r�r)r�r�r4r�r�r7r;rArDr*r*r*r+r�sb









)
=
r�cs�eZdZdZdZ�fdd�Z�fdd�Zdd�Z�fd	d
�Z�fdd�Z	�fd
d�Z
�fdd�Z�fdd�Z�fdd�Z
d�fdd�	Zd�fdd�	Z�ZS)�manifestfulltextcachez�File-backed LRU cache for the manifest cache

    File consists of entries, up to EOF:

    - 20 bytes node, 4 bytes length, <length> manifest data

    These are written in reverse cache order (oldest to newest).

    smanifestfulltextcachecs&tt|��|�d|_d|_d|_dSr�)�superrEr<r��_read�_opener)r;�max��	__class__r*r+r<�szmanifestfulltextcache.__init__c	s�|js|jdurdSz�|�|j���}tt|�j}|�d�}t|�dkrHq�zt�	d|�d��d}Wntj
yzYq�Yn0t|�|��}t|�|kr�q�|||�q0Wd�n1s�0YWnty�Yn0d|_d|_
dS)Nrx�>L�rTF)rGrH�_filerFrEr|r;r r��unpackr
r��IOErrorr�)r;�fpr�r�r
r{rJr*r+r;�s(

.zmanifestfulltextcache.readcCs�|jr|jdurdSz�|j|jdddd��h}|jj}|j|jvrp|�|j�|�t�	dt
|j���|�|j�||jur|q�|j}q4Wd�n1s�0YWnty�Yn0dS)N�wT)Z
atomictemp�
checkambigrL)
r�rHrN�_headr$rf�_cache�writer�r�r r{rP)r;rQr�r*r*r+rV�s"
�
*	zmanifestfulltextcache.writecs|js|��tt|���Sr=)rGr;rFrEr�r>rJr*r+r��szmanifestfulltextcache.__len__cs|js|��tt|��|�Sr=)rGr;rFrErn�r;rrJr*r+rn�sz"manifestfulltextcache.__contains__cs|js|��tt|���Sr=)rGr;rFrEr?r>rJr*r+r?�szmanifestfulltextcache.__iter__cs>|js|��|j�|�|ju}tt|��|�}|r:d|_|Sr)	rGr;rUr�rTrFrErtr�)r;rZsetdirtyr{rJr*r+rt�sz!manifestfulltextcache.__getitem__cs*|js|��tt|��||�d|_dSr)rGr;rFrEr|r�)r;rrrJr*r+r|�sz!manifestfulltextcache.__setitem__cs(|js|��tt|��|�d|_dSr)rGr;rFrErwr�rWrJr*r+rw�sz!manifestfulltextcache.__delitem__Ncs"|js|��tt|�j||d�S)N)r�)rGr;rFrEr�)r;rr�rJr*r+r�szmanifestfulltextcache.getFcs*tt|���|r d|_|��d|_dS)NTF)rFrE�clearr�rVrG�r;�clear_persisted_datarJr*r+rXs
zmanifestfulltextcache.clear)N)F)rGrHrIr�rNr<r;rVr�rnr?rtr|rwr�rX�
__classcell__r*r*rJr+rE�s

rE�c@seZdZdZdS)r+z;Exception raised when fastdelta isn't usable on a manifest.N)rGrHrIr�r*r*r*r+r+sr+c@s2eZdZdZdBdd�Zdd�Zed	d
��ZdCdd�Zd
d�Z	dDdd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�ZdEd%d&�ZdFd'd(�Zd)d*�Zd+d,�Zd-d.�Zdddejdfd/d0�ZdGd1d2�Zd3d4�Zd5d6�Zd7d8�Z d9d:�Z!d;d<�Z"dHd=d>�Z#ed?d@��Z$e$j%dAd@��Z$dS)I�manifestrevlogznA revlog that stores manifest texts. This is responsible for caching the
    full-text manifest contents.
    rNFc
Cs�||_d}d}t|dd�}|dur:|�d|�}|�dd�}|p@||_t|�|_|rRd}	|rfd||	}	||_|rx||_n
d	|i|_tj|t	j
|jf|	t|�d
t|j
�dd�d�|_|jj|_|jj|_dS)
a�Constructs a new manifest revlog

        `indexfile` - used by extensions to have two manifests at once, like
        when transitioning between flatmanifeset and treemanifests.

        `treemanifest` - used to indicate this is a tree manifest revlog. Opener
        options can also be used to make this a tree manifest revlog. The opener
        option takes precedence, so if it is set to True, we ignore whatever
        value is passed in to the constructor.
        rMF�optionsN�manifestcachesize�treemanifests
00manifestsmeta/rTspersistent-nodemap)�target�radixrSZmmaplargeindexZupperboundcompZpersistentnodemap)r�rr��_treeondiskrE�_fulltextcache�tree�_dirlogcacher�revlog_constantsZKIND_MANIFESTLOGr�MAXCOMPRESSIONr^�_revlogrbZ
_generaldelta)
r;r��openerreZdirlogcacher��	cachesizeZoptiontreemanifest�optsrbr*r*r+r<s8



�
zmanifestrevlog.__init__cs^t�|d�sdS|j|j_|�|j�dur.dSt�|��t�|����fdd�}|�	|�dS)z1Persist the manifestfulltextcache on lock releases	_wlockrefNcsJ|sdS��}��}|dus$|dur(dS|j�d�|ur<dS|j��dSr�)�manifestlog�
getstoragerdrV)�success�repor;�ZmanifestrevlogrefZreporefr*r+�persistmanifestcachefszEmanifestrevlog._setupmanifestcachehooks.<locals>.persistmanifestcache)
rZsafehasattrZ	wcachevfsrdrHZ_currentlockZ	_wlockref�weakref�refZ
_afterlock)r;rprrr*rqr+�_setupmanifestcachehooksZs


z'manifestrevlog._setupmanifestcachehookscCs|jSr=)rdr>r*r*r+�
fulltextcachevszmanifestrevlog.fulltextcachecCs(|j��|jj|d�|j|i|_dS�N)rZ)ri�clearcachesrdrXrerfrYr*r*r+rxzs
zmanifestrevlog.clearcachescCs<|r||jvr2t|j|j||j|jd�}||j|<|j|S)N)r�)rfr]r�rjrc)r;r�Zmfrevlogr*r*r+�dirlogs
�
zmanifestrevlog.dirlogc
Cs0z�||jvrt��t|�t�dd�t|�D�dd�t|�D��}
|�|j||
�\}}|j�|�|f}
t	�
|�}|j�||||||
�}|j�|�}Wn�t�y|j
r�||j|�}||j|�}|j|||||||	d�}d}n0|��}|j�|||||�}|j�|�}t|�}Yn0|du�r,||j|<|S)aadd some manifest entry in to the manifest log

        input:

          m:           the manifest dict we want to store
          transaction: the open transaction
          p1:          manifest-node of p1
          p2:          manifest-node of p2
          added:       file added/changed compared to parent
          removed:     file removed compared to parent

        tree manifest input:

          readtree:    a function to read a subtree
          match:       a filematcher for the subpart of the tree manifest
        cSsg|]}|df�qS)Fr*r�r*r*r+r5�rz&manifestrevlog.add.<locals>.<listcomp>cSsg|]}|df�qSrr*r�r*r*r+r5�r�rN)rvr+r/�heapq�merger�r�ri�revrr��addrevisionr�rcre�_addtreer�r�)r;r��transaction�link�p1�p2�added�removed�readtreerZworkr�r�Z
cachedeltar�r}r'r�r�r*r*r+r"�s<
�
��

zmanifestrevlog.addcs��jdkr&|�|�s|�|�r&|��S����fdd�}|�||||�|��}	d}
�jdkr�|	|��krt|��}
n|	|��kr�|��}
|
s��j�|	��|��|���}�j�|�}
|�|
�|
S)Nrcs.��|���}|j|��||dd�|d�	dS)N�r�r)ryr�r")r�r?r@rZsublog�r�r�r;r�r*r+r>�s�z-manifestrevlog._addtree.<locals>.writesubtree)rer4r�rAr7rir~r)r;r�r�r�r�r�r�rr>r�r'r}r*r�r+r�s,
��

�
zmanifestrevlog._addtreecCs
t|j�Sr=)r rir>r*r*r+r�szmanifestrevlog.__len__cCs
|j��Sr=)rir?r>r*r*r+r?szmanifestrevlog.__iter__cCs|j�|�Sr=)rir}rr*r*r+r}	szmanifestrevlog.revcCs|j�|�Sr=)rir��r;r}r*r*r+r�szmanifestrevlog.nodecCs|j�|�Sr=)ri�lookup�r;r{r*r*r+r�szmanifestrevlog.lookupcCs|j�|�Sr=)ri�
parentrevsr�r*r*r+r�szmanifestrevlog.parentrevscCs|j�|�Sr=)ri�parentsrr*r*r+r�szmanifestrevlog.parentscCs|j�|�Sr=)ri�linkrevr�r*r*r+r�szmanifestrevlog.linkrevcCs
|j��Sr=)ri�	checksizer>r*r*r+r�szmanifestrevlog.checksizecCs|jj||d�S�N)�_df)ri�revision�r;r�r�r*r*r+r�szmanifestrevlog.revisioncCs|jj||d�Sr�)ri�rawdatar�r*r*r+r�!szmanifestrevlog.rawdatacCs|j�||�Sr=)ri�revdiff)r;Zrev1Zrev2r*r*r+r�$szmanifestrevlog.revdiffcCs|j�||�Sr=)ri�cmp)r;r�r�r*r*r+r�'szmanifestrevlog.cmpcCs|j�|�Sr=)ri�deltaparentr�r*r*r+r�*szmanifestrevlog.deltaparentcCs|jj||||||d�S)N)�
nodesorder�revisiondata�assumehaveparentrevisions�	deltamode�sidedata_helpers)ri�
emitrevisions)r;Znodesr�r�r�r�r�r*r*r+r�-s	�zmanifestrevlog.emitrevisionscCs|jj||||||d�S)N)�alwayscache�
addrevisioncb�duplicaterevisioncb)ri�addgroup)r;ZdeltasZ
linkmapperr�r�r�r�r*r*r+r�?s	�zmanifestrevlog.addgroupcCs|j�|�Sr=)ri�rawsizer�r*r*r+r�Qszmanifestrevlog.rawsizecCs|j�|�Sr=)ri�
getstrippoint)r;�minlinkr*r*r+r�Tszmanifestrevlog.getstrippointcCs|j�||�Sr=)ri�strip)r;r�r�r*r*r+r�Wszmanifestrevlog.stripcCs
|j��Sr=)rir2r>r*r*r+r2Zszmanifestrevlog.filescKs,t|t�st�d��|jj||jfi|��S)Ns"expected manifestrevlog to clone())ror]r
�ProgrammingErrorri�clone)r;�trZ
destrevlog�kwargsr*r*r+r�]s

zmanifestrevlog.clonecCs|jj|||||d�S)N)�exclusivefiles�sharedfiles�revisionscount�trackedsize�
storedsize)ri�storageinfo)r;r�r�r�r�r�r*r*r+r�cs�zmanifestrevlog.storageinfocCs|jjSr=�rirjr>r*r*r+rjsszmanifestrevlog.openercCs||j_dSr=r�r�r*r*r+rjws)rNF)F)NN)N)N)FNN)FFFFF)&rGrHrIr�r<ru�propertyrvrxryr"rr�r?r}r�r�r�r�r�r�r�r�r�r�r�rZCG_DELTAMODE_STDr�r�r�r�r�r2r�r�rj�setterr*r*r*r+r]sj�
>

�
L*

�
�
�

r]c@sLeZdZdZdd�Zdd�Zddd�Zd	d
�Zddd
�Zdd�Z	dd�Z
dS)rma�A collection class representing the collection of manifest snapshots
    referenced by commits in the repository.

    In this situation, 'manifest' refers to the abstract concept of a snapshot
    of the list of files in the given commit. Consumers of the output of this
    class do not care about the implementation details of the actual manifests
    they receive (i.e. tree or flat or lazily loaded, etc).cCsz|j|_d}d}t|dd�}|dur<|�d|�}|�d|�}||_||_|j�|�||_i|_t�	|�|jd<||_
dS)NFrMr^r`r_r)r�rr��_treemanifests�
_rootstoreru�_narrowmatch�_dirmancacher�lrucachedict�
_cachesize)r;rjrpZ	rootstore�narrowmatchZusetreemanifestrkrlr*r*r+r<�szmanifestlog.__init__cCs|�d|�S)zgRetrieves the manifest instance for the given node. Throws a
        LookupError if not found.
        r)r�rr*r*r+rt�szmanifestlog.__getitem__TcCs�||j�|d�vr |j||S|j��sL|j�|dd��sLt|j||�S|r�|jjrz|rl|�	|��
|�t|||�}q�t�
td�|��n.|r�|j�
|�|jr�t|d|�}n
t||�}||jjkr�|j�|�}|s�t�|j�}||j|<|||<|S)z�Retrieves the manifest instance for the given node. Throws a
        LookupError if not found.

        `verify` - if True an exception will be thrown if the node is not in
                   the revlog
        r*Nrs9cannot ask for manifest directory '%s' in a flat manifestr)r�r�r�r�rC�excludeddirmanifestctxr�r�rcrnr}�treemanifestctxr
ZAbortrr��manifestctxr�rr�r�)r;rer��verifyr�Zmancacher*r*r+r��s:
���

zmanifestlog.getcCs|j�|�Sr=)r�ry)r;rer*r*r+rn�szmanifestlog.getstorageFcCs|j��|jj|d�dSrw)r�rXr�rxrYr*r*r+rx�s
zmanifestlog.clearcachescCs|j�|�Sr=)r�r}rr*r*r+r}�szmanifestlog.revcCs|jjj|d�S)N)r�)r�ri�
update_caches)r;r�r*r*r+r��szmanifestlog.update_cachesN)T)F)rGrHrIr�r<rtr�rnrxr}r�r*r*r*r+rm|s
/
rmc@s6eZdZdd�Zdd�Zdd�Zdd�Zdd
d�Zd	S)
�memmanifestctxcCs||_t|jj�|_dSr=)�_manifestlogr�r�r"�
_manifestdict)r;rmr*r*r+r<�szmemmanifestctx.__init__cCs|j�d�Sr��r�rnr>r*r*r+�_storage�szmemmanifestctx._storagecCst|j�}|����|_|Sr=�r�r�r;r}r��r;Zmemmfr*r*r+r}�s
zmemmanifestctx.copycCs|jSr=)r�r>r*r*r+r;�szmemmanifestctx.readNc
Cs |��j|j|||||||d�S)Nrz)r�r"r�)r;r�r�r�r�r�r�rr*r*r+rV�s�zmemmanifestctx.write)N�rGrHrIr<r�r}r;rVr*r*r*r+r��s
r�c@s`eZdZdZdd�Zdd�Zdd�Zdd	�Zed
d��Z	dd
�Z
ddd�Zddd�Zdd�Z
dS)r�zxA class representing a single revision of a manifest, including its
    contents, its parent revs, and its linkrev.
    cCs||_d|_||_dSr=)r��_datar�)r;rmr�r*r*r+r<szmanifestctx.__init__cCs|j�d�Sr�r�r>r*r*r+r�szmanifestctx._storagecCs|jSr=rr>r*r*r+r�szmanifestctx.nodecCst|j�}|����|_|Sr=r�r�r*r*r+r}s
zmanifestctx.copycCs|���|j�Sr=�r�r�r�r>r*r*r+r�szmanifestctx.parentscCs�|jdur�|jj}|j|jkr,t|j�|_nV|��}|j|jvrTt	�
|j|j�}n |�|j�}t|�}||j|j<t|j|�|_|jSr=)
r�r�r�r�r�r�r"r�rvrr�r�r�)r;Znc�storer�r�r*r*r+r;s
zmanifestctx.readFcCsD|��}|�|j�}|�|�}|tkr<||�|�vr<|��S|��S)aCalls either readdelta or read, based on which would be less work.
        readdelta is called if the delta is against the p1, and therefore can be
        read quickly.

        If `shallow` is True, nothing changes since this is a flat manifest.
        )r�r}r�r�rr��	readdeltar;�r;�shallowr�rir�r*r*r+�readfast/s
zmanifestctx.readfastcCs:|��}|�|j�}t�|�|�|�|��}t|jj	|�S)a
Returns a manifest containing just the entries that are present
        in this manifest, but not in its p1 manifest. This is efficient to read
        if the revlog delta is already p1.

        Changing the value of `shallow` has no effect on flat manifests.
        )
r�r}r�r�	patchtextr�r�r�r�r")r;r�r�rir�r*r*r+r�=szmanifestctx.readdeltacCs|���|�Sr=�r;rCrmr*r*r+rCIszmanifestctx.findN)F)F)rGrHrIr�r<r�r�r}r�r�r;r�r�rCr*r*r*r+r��s



r�c@s8eZdZd
dd�Zdd�Zdd�Zdd	�Zddd�Zd
S)�memtreemanifestctxrcCs||_||_t|j�|_dSr=)r�r�r�r��
_treemanifest)r;rmr�r*r*r+r<Oszmemtreemanifestctx.__init__cCs|j�d�Sr�r�r>r*r*r+r�Tszmemtreemanifestctx._storagecCs t|j|jd�}|j��|_|S�N�r�)r�r�r�r�r}r�r*r*r+r}Wszmemtreemanifestctx.copycCs|jSr=)r�r>r*r*r+r;\szmemtreemanifestctx.readNc	s.�fdd�}���j�j||||||||d�	S)Ncs�j�||���Sr=�r�r�r;)r�r�r>r*r+r�`sz*memtreemanifestctx.write.<locals>.readtreer�)r�r"r�)	r;r�r�r�r�r�r�rr�r*r>r+rV_s�zmemtreemanifestctx.write)r)Nr�r*r*r*r+r�Ms

r�c@s\eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zedd��Z	ddd�Z
ddd�Zdd�ZdS)r�cCs||_||_d|_||_dSr=)r�r�r�r�)r;rmr�r�r*r*r+r<rsztreemanifestctx.__init__cCsB|jj}|��s4|�|jdd��s4t|jj|j�S|j�|j�Srl)r�r�r�rCr��excludedmanifestrevlogr�rn)r;r�r*r*r+r��s
�ztreemanifestctx._storagecs��jdurڈ����j�jjjkr2t�jj��_n��jr�t�jj�jd�}��fdd�}�fdd�}|�	||�|�
�j�|�_nV�j�jvr�t�
�j�j�}n ���j�}t|�}|�j�j<t�jj�j|d��_�jS)Nr�cs���j�Sr=)r�r�r*�r;r�r*r+r9�sz%treemanifestctx.read.<locals>.gettextcs�jj||dd���S)NF)r�r�)r�r�r>r*r+r��sz)treemanifestctx.read.<locals>.readsubtree)r�r�)r�r�r�r�r�r�r�rcr�r;rrvrr�r�r�)r;r�r9r�r�r�r*r�r+r;�s(
�ztreemanifestctx.readcCs|jSr=rr>r*r*r+r��sztreemanifestctx.nodecCs"t|j|jd�}|����|_|Sr�)r�r�r�r;r}r�r�r*r*r+r}�sztreemanifestctx.copycCs|���|j�Sr=r�r>r*r*r+r��sztreemanifestctx.parentsFcCs�|��}|r>|�|j�}t�|�|�|�|��}t|jj	|�S|�|�|j��}|j
�|j|�
|����}|��}t|j
j|jd�}t�|�|��D]0\}	\\}
}\}}
|r�|||	<|
r�|�|	|
�q�|SdS)aReturns a manifest containing just the entries that are present
        in this manifest, but not in its p1 manifest. This is efficient to read
        if the revlog delta is already p1.

        If `shallow` is True, this will read the delta for this directory,
        without recursively reading subdirectory manifests. Instead, any
        subdirectory entry will be reported as it appears in the manifest, i.e.
        the subdirectory will be reported among files and distinguished only by
        its 't' flag.
        r�N)r�r}r�rr�r�r�r�r�r"r�r�r�r�r;r�rr�r�r�)r;r�r�rir�Zr0Zm0r�Zmdr&Zn0Zfl0r-r.r*r*r+r��s$ztreemanifestctx.readdeltacCsf|��}|�|j�}|�|�}|tkr@||�|�vr@|j|d�S|rZt|jj	|�
|j��S|��SdS)a#Calls either readdelta or read, based on which would be less work.
        readdelta is called if the delta is against the p1, and therefore can be
        read quickly.

        If `shallow` is True, it only returns the entries from this manifest,
        and not any submanifests.
        )r�N)r�r}r�r�rr�r�r�r�r"r�r;r�r*r*r+r��s
�ztreemanifestctx.readfastcCs|���|�Sr=r�rmr*r*r+rC�sztreemanifestctx.findN)F)F)
rGrHrIr<r�r;r�r}r�r�r�r�rCr*r*r*r+r�ps	!


r�cs(eZdZdZ�fdd�Zdd�Z�ZS)�excludeddira�Stand-in for a directory that is excluded from the repository.

    With narrowing active on a repository that uses treemanifests,
    some of the directory revlogs will be excluded from the resulting
    clone. This is a huge storage win for clients, but means we need
    some sort of pseudo-manifest to surface to internals so we can
    detect a merge conflict outside the narrowspec. That's what this
    class is: it stands in for a directory whose node is known, but
    whose contents are unknown.
    cs0tt|��||�||_||jd<d|jd<dS)NrrZ)rFr�r<r�r�r��r;r�r�r�rJr*r+r<�s
zexcludeddir.__init__cCs|Sr=r*r>r*r*r+r}	szexcludeddir.copy)rGrHrIr�r<r}r[r*r*rJr+r��s
r�c@s2eZdZdZdd�Zdd�Zddd�Zd	d
�ZdS)
r�zBcontext wrapper for excludeddir - see that docstring for rationalecCs||_||_||_dSr=)r�r�r�r�r*r*r+r<	szexcludeddirmanifestctx.__init__cCst|j|j|j�Sr=)r�r�r�r�r>r*r*r+r;	szexcludeddirmanifestctx.readFcCs|��Sr=)r;)r;r�r*r*r+r�	szexcludeddirmanifestctx.readfastcGst�d|j��dS)Ns.attempt to write manifest from excluded dir %s�r
r�r�)r;�argsr*r*r+rV	s�zexcludeddirmanifestctx.writeN)F)rGrHrIr�r<r;r�rVr*r*r*r+r�		s

r�c@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)r�a\Stand-in for excluded treemanifest revlogs.

    When narrowing is active on a treemanifest repository, we'll have
    references to directories we can't see due to the revlog being
    skipped. This class exists to conform to the manifestrevlog
    interface for those directories and proactively prevent writes to
    outside the narrowspec.
    cCs||_||_dSr=)r�r�)r;r�r�r*r*r+r<(	szexcludedmanifestrevlog.__init__cCst�d|j��dS)Ns(attempt to get length of excluded dir %sr�r>r*r*r+r�,	s�zexcludedmanifestrevlog.__len__cCst�d|j��dS)Ns'attempt to get rev from excluded dir %sr�rr*r*r+r}1	s�zexcludedmanifestrevlog.revcCst�d|j��dS)Ns+attempt to get linkrev from excluded dir %sr�rr*r*r+r�6	s�zexcludedmanifestrevlog.linkrevcCst�d|j��dS)Ns(attempt to get node from excluded dir %sr�r�r*r*r+r�;	s�zexcludedmanifestrevlog.nodecOsdSr=r*)r;r�r�r*r*r+r"@	szexcludedmanifestrevlog.addN)
rGrHrIr�r<r�r}r�r�r"r*r*r*r+r�	s	r�)rN)HZ
__future__rr{rr�rsZi18nrr�rrrrr�r	r
rr�rr
rrrZ
interfacesrZ
interfaceutilZrevlogutilsrrgZ	importmodrr�r�r,r5�objectr6rKrNrYr!r]Zlazymanifest�AttributeErrorZimplementerZ
imanifestdictr�r�r/r�r�r�r�r�rErh�	Exceptionr+Zimanifeststorager]ZimanifestlogrmZimanifestrevisionwritabler�Zimanifestrevisionstoredr�r�r�r�r�r�r*r*r*r+�<module>sz,

%6

k
+
t
g
b

O
"
{

Youez - 2016 - github.com/yon3zu
LinuXploit