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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/mercurial/__pycache__/bundlerepo.cpython-310.pyc
o

�]Lb,]�@sbdZddlmZddlZddlZddlmZddlmZm	Z	ddl
mZmZm
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZddlm Z dd	lm!Z"Gd
d�dej�Z#Gdd
�d
e#e
j
�Z$Gdd�de#ej%�Z&Gdd�dej�Z'Gdd�dej(�Z)Gdd�dej*�Z+dd�Z,Gdd�de-�Z.d#dd�Z/dd�Z0Gdd�de-�Z1	 d$d!d"�Z2dS)%z�Repository class for viewing uncompressed bundles.

This provides a read-only repository interface to bundles as if they
were part of the actual repository.
�)�absolute_importN�)�_)�hex�nullrev)�bundle2�changegroup�	changelog�cmdutil�	discovery�encoding�error�exchange�filelog�	localrepo�manifest�mdiff�pathutil�phases�pycompat�revlog�revlogutils�util�vfs)�urlutil)�	constantscsXeZdZdd�Zddd�Zdd�Zd�fdd	�	Zd
d�Zdd
�Zdd�Z	dd�Z
�ZS)�bundlerevlogcCsLt�|�}tjj||||d�||_t|�}|d|_t�|_|�	�D]�}|\}}	}
}}}
}}t|
�}|�
�|}|j�|�rJ|j�
|j�|��q#||krQt}n||�}|	|
fD]}|j�|�skt�||jtd���qY|j�|�s{t||jtd���|�|�}tj||||||�|	�|�|
�|d�}|j�|�|j�
|�|d7}q#dS)N)�target�radixrsunknown parentsunknown delta base)�flags�data_offset�data_compressed_length�data_delta_base�link_rev�parent_rev_1�parent_rev_2�node_id)�vfsmod�readonlyvfsr�__init__�bundle�len�
repotiprev�set�
bundlerevs�	deltaiter�tell�index�has_node�add�revrr
�LookupError�
display_idrr�entry�append)�self�openerrr�
cgunpacker�
linkmapper�n�	deltadata�node�p1�p2�cs�	deltabase�deltar�sidedata�size�start�linkrev�p�baserev�e�rL�6/usr/lib/python3/dist-packages/mercurial/bundlerepo.pyr)8sR

���
�

�zbundlerevlog.__init__NcCs<||jkrtj�||�S|j�|�|��|j�|�|��S�N)r,r�_chunkr*�seekrG�read�length)r9r4�dfrLrLrMrOps
zbundlerevlog._chunkcCsr||jkr||jkr|j|d}||kr|�|�Sn||jkr-||jkr-tj�|||�St�|�|�|�|��S)z1return or calculate a delta between two revisions�)r,r1rOr�revdiffr�textdiff�rawdata)r9�rev1�rev2�revbrLrLrMrUys
�zbundlerevlog.revdiffcs�|dur	|�|�}d}d}g}|}||jkr7|jr&|jd|kr&|jd}n|�|�|j|d}||jks|tkr>d}n|durUtt|�j|�	|�||d�}|\}	}}|rYd}|rk|�
|���}
t�
||
g�}|s[|||fS)NFr�rT�)�_df)r4r,�_revisioncacher8r1r�superr�_rawtextr?rO�popr�patches)r9r?r4r]�	validated�rawtext�chain�iterrev�r�__rD��	__class__rLrMr`�s6




�
�
�
zbundlerevlog._rawtextcO�t�rN��NotImplementedError�r9�args�kwargsrLrLrM�addrevision��zbundlerevlog.addrevisioncOrkrNrlrnrLrLrM�addgroup�rrzbundlerevlog.addgroupcOrkrNrlrnrLrLrM�strip�rrzbundlerevlog.stripcCrkrNrl�r9rLrLrM�	checksize�rrzbundlerevlog.checksizerN)�__name__�
__module__�__qualname__r)rOrUr`rqrsrtrv�
__classcell__rLrLrirMr7s
8	rc@�eZdZdd�ZdS)�bundlechangelogcCs6tj�||�dd�}t�||tjdf|j||�dS)NcSs|SrNrL)�xrLrLrM�<lambda>�sz*bundlechangelog.__init__.<locals>.<lambda>)r	r)r�revlog_constants�KIND_CHANGELOGr)r9r:r;r<rLrLrMr)�s�zbundlechangelog.__init__N�rwrxryr)rLrLrLrMr|��r|cs*eZdZ		ddd�Z�fdd�Z�ZS)�bundlemanifestNr\cCsdtjj||||d�t�||tj|f|jj||�|dur*i}|jj	dkr*t
|j�}||_||_dS)N)�trees03)
r�manifestrevlogr)rr�KIND_MANIFESTLOG�_revlogrr*�version�_getfilestarts�
_dirlogstarts�_linkmapper)r9�
nodeconstantsr:r;r<�dirlogstarts�dirrLrLrMr)�s	�

zbundlemanifest.__init__csJ||jvr|j�|j|�t|j|j|j|j|j|d�Stt|��|�S)N)r�)	r�r*rPr�r�r:r�r_�dirlog)r9�drirLrMr��s
�zbundlemanifest.dirlog)Nr\)rwrxryr)r�rzrLrLrirMr��s

�r�c@r{)�
bundlefilelogcCs2tj�|||�t|tj|f|jj||d�|_dS)N)rrr;r<)rr)rr�KIND_FILELOGr�r)r9r:�pathr;r<rLrLrMr)�s�zbundlefilelog.__init__Nr�rLrLrLrMr��r�r�c@r{)�
bundlepeercC�dS�NFrLrurLrLrM�canpush�rrzbundlepeer.canpushN)rwrxryr�rLrLrLrMr��r�r�cs4eZdZ�fdd�Zdd�Zdd�Zdd�Z�ZS)	�bundlephasecachecs8tt|�j|i|��t�|d�rt�|j�|_dSdS)Nr:)r_r�r)r�safehasattrr'r(r:rnrirLrMr)�s�zbundlephasecache.__init__cCrkrNrlrurLrLrM�write�rrzbundlephasecache.writecCrkrNrl)r9�fprLrLrM�_write�rrzbundlephasecache._writecCs||j|<|��d|_dS)NT)�
phaseroots�
invalidate�dirty)r9�phase�newroots�trrLrLrM�_updaterootss

zbundlephasecache._updateroots)rwrxryr)r�r�r�rzrLrLrirMr��s
r�csFi}t�ji�D]}|d}���||<t�fdd�i�D]}qq|S)Nsfilenamecs
��d�SrN)�
deltachunkrL�r;rLrMr~
s
z _getfilestarts.<locals>.<lambda>)�iter�
filelogheaderr0)r;�filespos�	chunkdata�fname�chunkrLr�rMr�s�r�cs�eZdZdZdd�Zdd�Zd&dd�Zejd	d
��Z	ejdd��Z
d
d�Zejdd��Zdd�Z
ejdd��Zejdd��Zdd�Z�fdd�Zdd�Zdd�Zdd �Zd!d"�Zd'�fd$d%�	Z�ZS)(�bundlerepositorya%A repository instance that is a union of a local repo and a bundle.

    Instances represent a read-only repository composed of a local repository
    with the contents of a bundle file applied. The repository instance is
    conceptually similar to the state of a repository after an
    ``hg unbundle`` operation. However, the contents of the bundle are never
    applied to the actual base repository.

    Instances constructed directly are not usable as repository objects.
    Use instance() or makebundlerepository() to create instances.
    c	CsR||_||_|j�dddd�d|_t�|d�}t�|j||�}t	|t
j�r[||_d|_
d}|jdd�D]}|jdkrC|rAtd	��|}|�||�q4|sSt�td
���|�dtj�n/t	|tj�r|��rx|j|jdd
d�}t�|j|||j�}||_||_
nt�td�t|���i|_|jj d|_!t"�#|dt"j$dd�||j!d�D��dS)N�phasesspublishFs
bundlerepo�rbT)�seekable�changegroups#can't process multiple changegroupssNo changegroups foundrs.hg10un�HG10UN)�headersbundle type %s cannot be readrcS�g|]}|���qSrL�r?��.0�ctxrLrLrM�
<listcomp>X�z-bundlerepository.__init__.<locals>.<listcomp>)%�_tempparent�_url�ui�	setconfig�tempfiler�	posixfiler�
readbundle�
isinstancer�
unbundle20�_bundlefile�_cgunpacker�	iterparts�typerm�_handlebundle2partr
�AbortrrP�os�SEEK_SETr�cg1unpacker�
compressed�_writetempbundlerQr�_cgfilesposr	r,�firstnewrevr�retractboundary�draft)r9�
bundlepath�url�
tempparent�fr*�cgpart�partrLrLrMr)sP
����zbundlerepository.__init__cCsv|jdkrdS|}|j�dd�}t�|�}||vr$td�}t�||��|��r1|�	|j
d|�}t�||d�|_dS)Nr�sversions01s#Unsupported changegroup version: %ss.cg%sunsUN)
r��params�getr�supportedincomingversionsrr
r�r�r�rQ�getunbundlerr�)r9r*r��cgstreamr��legalcgvers�msgrLrLrMr�[s

z#bundlerepository._handlebundle2partr\cCs~|jjd|d�\}}||_t�|d��}|�|�	|d�}|s!n|�|�qWd�n1s1wY|jj|jdd�S)	zWrite a temporary file to disks
hg-bundle-)�prefix�suffix�wbTiNr�)�mode)r�mkstempr�r��fdopenr��open)r9�readfnr�r��fdtemp�temp�fptempr�rLrLrMr�js

��z!bundlerepository._writetempbundlecCst||j�SrN)r��_phasedefaultsrurLrLrM�_phasecacheyszbundlerepository._phasecachecCs(|j��t|j|j�}|j��|_|SrN)r��changelogheaderr|�svfsr0�manstart)r9�crLrLrMr	}s
zbundlerepository.changelogcC�dSrNrLrurLrLrM�_refreshchangelog�sz"bundlerepository._refreshchangelogcCsZ|j�|j�|j��|��jj}t|j|j	|j|�}|j�
�|_t�
|j	|||���SrN)r�rPr��manifestheader�
unfilteredr	r4r�r�r�r0�	filestartr�manifestlog�narrowmatch)r9r<�	rootstorerLrLrMr��s
��zbundlerepository.manifestlogcCs8|j�|j�|j��|j��D]}q|j��|_dS)zgConsumes the manifest portion of the bundle, setting filestart so the
        file portion can be read.N)r�rPr�r�r/r0r�)r9rDrLrLrM�_consumemanifest�s

z!bundlerepository._consumemanifestcCs|j|jSrN)r	r�rurLrLrMr��szbundlerepository.manstartcCs|jd|jvr|��|jS)Nr�)r��__dict__r�r�rurLrLrMr��s
zbundlerepository.filestartcCs|jSrN)r�rurLrLrMr��szbundlerepository.urlcsj|js|j�|j�t|j�|_||jvr-|j�|j|�|��jj}t|j	||j|�St
t|��|�SrN)
r�r�rPr�r�r�r	r4r�r�r_r��file)r9r�r<rirLrMr��s
zbundlerepository.filecCs>|j��|jdur|j�|j�|jrt�|jd�dSdS)z'Close assigned bundle file immediately.NT)r��closer�r�unlinkr��shutil�rmtreerurLrLrMr��s

�zbundlerepository.closecCr�r�rLrurLrLrM�cancopy�rrzbundlerepository.cancopycCst|�SrN)r�rurLrLrM�peer��zbundlerepository.peercCst��SrN)r�getcwdrurLrLrMr�rzbundlerepository.getcwdNcs�|dur|j}|j�|�}|j�|�}td�}|jj|kr'|j�|t|��|jj|kr7|j�|t|��tt	|��
||�S)Ns9setting parent to node %s that only exists in the bundle
)�nullidr	r4rr,r��warnrr_r��
setparents)r9r@rA�p1rev�p2revr�rirLrMr�szbundlerepository.setparents)r\rN)rwrxry�__doc__r)r�r�r�unfilteredpropertycacher�r	r�r�r�r�r�r�r�r�r�rrrrzrLrLrirMr�s0<



	

r�cCs�|r	t�td���|�dd�}|st�t���}|durd}|r=t��}||kr+d}nt�	|�}|�
|�r=|t|�d�}t�
|�}|��}|jdkrd|�dd�}t|�dkr_||d}	}
n
|\}	}
n||}	}
t||	|
�S)Ns#cannot create new bundle repositorysbundlesmainreporootr\�+rr)r
r�r�configr
�findreporrr�normasprefix�
startswithr+rr��	localpath�scheme�split�makebundlerepository)r�r��create�intents�
createopts�
parentpath�cwd�u�s�repopath�
bundlenamerLrLrM�instance�s.





rcCs�|rdt�|�|f}nd|}ztj||dd�}d}Wn&tjyBt��}z
tj||dd�}Wn
ty?t	�
|��wYnwGdd�dt|j�}||_t�
||||�|S)	z?Make a bundle repository object based on repo and bundle paths.sbundle:%s+%ss	bundle:%sF)rNTc@seZdZdS)z5makebundlerepository.<locals>.derivedbundlerepositoryN)rwrxryrLrLrLrM�derivedbundlerepository!sr)r�
expandpathrrr
�	RepoErrorr�mkdtemp�	Exceptionr�r�r�rjr))r�rr�r��repor�rrLrLrMrs(

���rc@s$eZdZdd�Zdd�Zdd�ZdS)�bundletransactionmanagercCr�rNrLrurLrLrM�transaction+rrz$bundletransactionmanager.transactioncCrkrNrlrurLrLrMr�.rrzbundletransactionmanager.closecCrkrNrlrurLrLrM�release1rrz bundletransactionmanager.releaseN)rwrxryr$r�r%rLrLrLrMr#*sr#Fcstj|�||d�}|\}}}	|s)z	|rt�|�Wn	ty"Ynw|g�jfSt|���fdd�|	D�}	d�d����}
|sC|
�s,|�dd�}d|voPd|v}|o]��	d	�o]��	d�}
|
r���
��&}|�d	d
||	tj
|dd�d
d����}t�||��|�}�Wd�n1s�wYn���	d	�r���
��}|�d	d
||	d����}Wd�n1s�wYnK|dur��	d�s��
��}|�d|d
d����}Wd�n1s�wYd}	n ��
��}|�d||	d
d����}Wd�n1s�wY|
�r
d}nd}t�||||�}�|�rd�|
�s,t|j|j|�}
�|��}|
�r3|
��}
|
j�||	�}��r{dd���jd�D�}��
��}|�dddi���}Wd�n	1�scwYtj��d|d�}t�|_t�||����fdd�}|
||fS)aDobtains a bundle of changes incoming from peer

    "onlyheads" restricts the returned changes to those reachable from the
      specified heads.
    "bundlename", if given, stores the bundle to this file path permanently;
      otherwise it's stored to a temp file and gets deleted again when you call
      the returned "cleanupfn".
    "force" indicates whether to proceed on unrelated repos.

    Returns a tuple (local, csets, cleanupfn):

    "local" is a local repo from which to obtain the actual incoming
      changesets; it is a bundlerepo for the obtained bundle when the
      original "peer" is remote.
    "csets" lists the incoming changeset node ids.
    "cleanupfn" must be called without arguments when you're done processing
      the changes; it closes both the original "peer" and the one returned
      here.
    )�heads�forcecsg|]}|�vr|�qSrLrL)r�r})�	commonsetrLrMr�Vsz$getremotechanges.<locals>.<listcomp>Nsdevelslegacy.exchangesbundle2sbundle1s	getbundlesincomingsclient)�roleT)�source�common�headss
bundlecapsscg)r*r+r,schangegroupsubsetr�)snodesr*)sbasesr,r*sHG10BZr�cSr�rLr�r�rLrLrMr��r�slistkeyss	namespacer�)r�r&cs&�r����r
t������dSrN)r�r�r�rL)r*�
bundlereporrLrM�cleanup�s

z!getremotechanges.<locals>.cleanup) r�findcommonincomingr�r��OSErrorr�r-�local�
configlist�capable�commandexecutor�callcommandr�
caps20to10�resultr�writechunks�_forwardchunksr�writebundler�baseui�rootr&r�r	�findmissingr��
pulloperationr#�	trmanager�_pullapplyphases)r�r"r�	onlyheadsrr'�tmp�common�incoming�rheadsr�legexc�forcebundle1�
canbundle2rK�b2r��cg�
bundletype�csets�	reponodes�remotephases�pullopr.rL)r*r-r(rrM�getremotechanges5s�

��
��
����

���

�����	
����	
����

�
�����
rP)NN)NNF)3r�
__future__rr�r��i18nrr?rr�rrr	r
rrr
rrrrrrrrrrrrr'�utilsrrrrr|r�r�r��	localpeerr��
phasecacher�r��objectr�rrr#rPrLrLrLrM�<module>s.Tw(


Q"&�

https://t.me/RX1948 - 2025