https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/hgext/remotefilelog/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/hgext/remotefilelog/__pycache__/remotefilectx.cpython-310.pyc
o

�]Lb�K�@s�ddlmZddlZddlZddlmZmZmZddlm	Z	m
Z
mZmZm
Z
ddlmZe
jZdZGdd	�d	e
j�ZGd
d�de
je�ZdS)�)�absolute_importN)�bin�hex�nullrev)�ancestor�context�error�phases�util�)�shallowutilg�?cs�eZdZ					d)�fdd�	Zdd�Zedd��Zd*dd	�Zd
d�Zedd
��Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zd+dd�Zdd�Zdd �Zd+d!d"�Zd#d$�Z�fd%d&�Zd'd(�Z�ZS),�
remotefilectxNcsJ|tkr|j}|rt|�dkrt|�}tt|��||||||�||_dS)N�()r�nullid�lenr�superr
�__init__�_ancestormap)�self�repo�path�changeid�fileid�filelog�	changectx�ancestormap��	__class__��C/usr/lib/python3/dist-packages/hgext/remotefilelog/remotefilectx.pyrs

�
zremotefilectx.__init__cCs|j�|j�S�N)�_filelog�size�	_filenode�rrrrr".szremotefilectx.sizecCs`d|jvr|jSd|jvr|j��Sd|jvr,|�|j|j|j|j�}|j	�
�j�|�S|��S)N�	_changeid�
_changectx�_descendantrev)
�__dict__r%r&�rev�_adjustlinknode�_pathr!r#r'�_repo�
unfiltered�	changelog�linkrev)r�linknoderrrr%1s



�zremotefilectx._changeidcCst|j|j||j|d�S)zMopens an arbitrary revision of the file without
        opening a new filelog)rrr)r
r,r+r!)rrrrrr�filectxAs�zremotefilectx.filectxcCs|jSr )�_linkrevr$rrrr/Lszremotefilectx.linkrevc
Cs�|j|jjkr	tS|��}||j\}}}}|jjj�|�}|dur$|S|j}|j}|j�	�j}	|jj
}
tt|	�ddd�D]#}|	�
|�}|	�|�}||dvra||
|d���|�kra|Sq>dS)Nrr����)r#r,rrrr.�index�get_revr+r-�manifestlog�ranger�node�read�readfast�get)
rr�p1�p2r0�copyfromr)rr�cl�mflr9�datarrrr2Os*
��zremotefilectx._linkrevcCsb|��}t|�}d|vpd|v}|s|��|kr|S|j|j|j|j|��dd�}|jj�|�S)areturn the rev of the changeset which introduced this file revision

        This method is different from linkrev because it take into account the
        changeset the filectx was created from. It ensures the returned
        revision is one of its ancestors. This prevents bugs from
        'linkrev-shadowing' when a file revision is used by multiple
        changesets.
        r%r&T��	inclusive)	r/�varsr)r*r+r!r#r,r.)r�lkr�attrs�noctxr0rrr�introrevos	�zremotefilectx.introrevc
	Cs�|��}||j\}}}}|sdS||f}|��|��kr|S|��}|j}|j��D]}	z
||	�|�kr9WdSWq+tj	yDYq+w|S)a#check if file was actually renamed in this changeset revision

        If rename logged in file revision, we report copy for changeset only
        if file revisions linkrev points back to the changeset in question
        or both changeset parents contain different file revisions.
        N)
rr#r)r/rr&�parents�filenoder�LookupError)
rrr=r>r0r?�renamed�name�fnode�prrrrM�s$��zremotefilectx.renamedcCs|��}|o	|dS)Nr)rM)r�copyrrr�
copysource�szremotefilectx.copysourcecCs|js|���|j�|_|jSr )rrrr#r$rrrr�szremotefilectx.ancestormapcCs�|j}|��}||j\}}}}g}||jkr4|p|j}|�|�}	t||||	|d�}
|��|
_|�	|
�||jkrT|j}|�|�}	t||||	|d�}|��|_|�	|�|S)N)rrr)
r,rr#rr+�filer
r)r'�append)rrrr=r>r0r?�resultsr�flog�p1ctx�p2ctxrrrrJ�s*



�




�

zremotefilectx.parentsc	CsH|�|�}|d|d}}||vr"|||���|�kr"|�|�SdS)zBreturns the node for <path> in <ancrev> if content matches <fnode>rr4N)r:r;r<r9)	r�ancrevr@rArrO�ancctx�manifestnode�filesrrr�_nodefromancrev�s


zremotefilectx._nodefromancrevFcs0|j}|��j�|j}|��}||d}	|dur(dd�|jd��D�}
d}n|g}
|�|
|	�r3|	Sd��fdd�|
D��t|�|t	�
|j�t	�|j�d�}|jj
d
i|��|j}d}
�j|
|d�}|D]/}|�|�|||�}|dury|S|
s�|�||�tjkr�|�||||
|�}|r�|Sd}
qf|	S)a�return the first ancestor of <srcrev> introducing <fnode>

        If the linkrev of the file revision does not point to an ancestor of
        srcrev, we'll walk down the ancestors until we find one introducing
        this file revision.

        :repo: a localrepository object (used to access changelog and manifest)
        :path: the file path
        :fnode: the nodeid of the file revision
        :filelog: the filelog of this path
        :srcrev: the changeset revision we search ancestors from
        :inclusive: if true, the src revision will also be checked

        Note: This is based on adjustlinkrev in core, but it's quite different.

        adjustlinkrev depends on the fact that the linkrev is the bottom most
        node, and uses that as a stopping point for the ancestor traversal. We
        can't do that here because the linknode is not guaranteed to be the
        bottom most one.

        In our code here, we actually know what a bunch of potential ancestor
        linknodes are, so instead of stopping the cheap-ancestor-traversal when
        we get to a linkrev, we stop when we see any of the known linknodes.
        �NcSsg|]}|���qSr)r))�.0rPrrr�
<listcomp>�sz1remotefilectx._adjustlinknode.<locals>.<listcomp>T� csg|]	}t��|���qSr)rr9)r_r)�r@rrr`�s)�revsrO�filepath�user�reponame�linkrevfixup�adjusting linknode
FrC)rgrh)r,r-r.r7rrJ�_verifylinknode�joinrr�getusername�ui�getreponame�log�_phasecache�	ancestorsr]�phaser	�public�_forceprefetch)rrrrO�srcrevrDrrArr0rc�commonlogkwargs�pc�
seenpublic�iterancrY�lnoderrbrr*�sD


�
��zremotefilectx._adjustlinknodecCsNd}t��}z�zX|jj|t|�fgdd�d|_|��|d}|�||�rCd}|WWt��|}	|jjd|dfd|	d	i|��Sd
}WWt��|}	|jjd|dfd|	d	i|��dSt	y�}
z#d|
}WYd}
~
Wt��|}	|jjd|dfd|	d	i|��dSd}
~
wwt��|}	|jjd|dfd|	d	i|��w)N�T)�forcer^s#remotefilelog prefetching succeededrg�
�elapsedi�s#remotefilelog prefetching not founds%remotefilelog prefetching failed (%s))
�time�fileservice�prefetchrrrrirlrn�	Exception)rrrrOrcru�logmsg�startr0r}�errrrssh*������
����
������zremotefilectx._forceprefetchcsF|sdSz|j��j�t��fdd�|D��WStjy"YdSw)a�
        Check if a linknode is correct one for the current history.

        That is, return True if the linkrev is the ancestor of any of the
        passed in revs, otherwise return False.

        `revs` is a list that usually has one element -- usually the wdir parent
        or the user-passed rev we're looking back from. It may contain two revs
        when there is a merge going on, or zero revs when a root node with no
        parents is being created.
        Fc3s"�|]}�����|��VqdSr )�
isancestorr9)r_�r�r@r0rr�	<genexpr>qs� z0remotefilectx._verifylinknode.<locals>.<genexpr>)r,r-r.�anyrrL)rrcr0rr�rri`s�zremotefilectx._verifylinknodec
cs��g}t�|f�}t�}|r=|��}|��|vrq|�|���|�|�|��}d}|D]
}|s3|s8|�|�d}q-|s|�d�t|ddd�d�}|D]}	|	VqMdS)NTFrcSs|��Sr )r/)�xrrr�<lambda>�sz)remotefilectx.ancestors.<locals>.<lambda>)�reverse�key)	�collections�deque�set�poprK�addrTrJ�sorted)
r�followfirstrp�queue�seen�currentrJ�firstrPrrrrrpys,�

�
�zremotefilectx.ancestorsc
s�|��|��kr|��|vr||��S|��|vr&|��|vr&||��S|��|vr8|��|vr8||��S|���|�����fdd�}|��|��f}|��|��f}t�|||�}|ro|\}}t|j||�d�}	|	SdS)NcsD|\}}��|�p
��|�}|sgS|dp||df||dfgS)Nr4rr)r<)r��f�nrP��amap�bmaprrrJ�s
 z'remotefilectx.ancestor.<locals>.parents)rr)rrrKr�genericancestorr
r,)
r�fc2�actxrJ�a�b�resultr�r�r�rr�rr�s"zremotefilectx.ancestorcs"|}|�dd�}|r#|��}|��|kr#t|j|j||j|j|jd�}g}t	�}t
�|f�}|�|�
��|rr|��}	|	��|��krP|�|	��t|	���f�|rW|	|vrWq5|	��D]}
|
�
�|vro|�|
�
��|�|
�q[|s7|jj�dt|��|r�|jj�|�tt|�j|i|��S)N�prefetchskip)rrrrs1remotefilelog: prefetching %d files for annotate
)r�rIr)r
r,r+r#r!rr�r�r�r�r9rKrTrrrJrl�debugrrr�r�annotate)r�args�kwargs�introctxr�rI�fetchr�r�r��parentrrrr��sJ�
��
��zremotefilectx.annotatecCsgSr rr$rrr�children�szremotefilectx.children)NNNNNr )F)�__name__�
__module__�__qualname__rr"�
propertycacher%r1r/r2rIrMrRrrJr]r*rsrirprr�r��
__classcell__rrrrr
s6�




LE
",r
cs.eZdZd�fdd�	Zdd�Zdd�Z�ZS)	�remoteworkingfilectxNcs d|_tt|��||||�dSr )rrr�r)rrrr�
workingctxrrrr�s
�zremoteworkingfilectx.__init__cCs
t�|�Sr )r
rJr$rrrrJ�s
zremoteworkingfilectx.parentsc
Cs.|js�|j}|jj}|��}|r|}n
||dj�||jj�f}||jjf}t	|�dkr9||dj�||jj�f}i}|d|jjkr[|jj
|d|dd�}|�|���
|d��|d|jjkr{|jj
|d|dd�}|�|���
|d��d}	|r�|d}	|d|d|jj|	f|d<||_|jS)Nrr)rrz)rr+r&�_parentsrM�	_manifestr<r,rrr1�updaterr)
rr�pclrMr=r>�mrWrXr?rrrr�s.z remoteworkingfilectx.ancestormap)NN)r�r�r�rrJrr�rrrrr��sr�)�
__future__rr�r~�mercurial.noderrr�	mercurialrrrr	r
�rr��FASTLOG_TIMEOUT_IN_SECSr1r
�workingfilectxr�rrrr�<module>sQ

https://t.me/RX1948 - 2025