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__/changegroup.cpython-310.pyc
o

�]Lb��@s�ddlmZddlZddlZddlZddlmZddlmZm	Z	m
Z
ddlmZddl
mZmZmZmZmZmZmZmZddlmZdd	lmZdd
lmZddlmZe�d�Z e�d
�Z!e�d�Z"e�d�Z#dZ$ej%Z%dd�Z&dd�Z'dd�Z(dd�Z)dOdd�Z*Gdd�de+�Z,Gdd�de,�Z-Gdd �d e-�Z.Gd!d"�d"e.�Z/Gd#d$�d$e+�Z0d%d&�Z1d'd(�Z2d)d*�Z3		+				dPd,d-�Z4Gd.d/�d/e+�Z5	+	+			dQd0d1�Z6	+	+			dQd2d3�Z7	+	+			dQd4d5�Z8	+	+			dQd6d7�Z9e6e,fe7e-fe8e.fe9e/fd8�Z:d9d:�Z;d;d<�Z<d=d>�Z=d?d@�Z>dAdB�Z?				+	+			dRdCdD�Z@dOdEdF�ZAdGdH�ZB	dSdIdJ�ZC	+			dTdKdL�ZD	dOdMdN�ZEdS)U�)�absolute_importN�)�_)�hex�nullrev�short)�open)�error�match�mdiff�phases�pycompat�requirements�scmutil�util)�
repository)�sidedata)�	constants)�storageutils20s20s20s20ss20s20s20s20s20ss>20s20s20s20s20sHs>B20s20s20s20s20sHslfscCsJt|d�}t�d|�d}|dkr|rt�td�|��dSt||d�S)z-return the next chunk from stream as a string��>lr�invalid chunk length %d�)�readexactly�struct�unpackr	�Abortr)�stream�d�l�r �7/usr/lib/python3/dist-packages/mercurial/changegroup.py�getchunk0s
r"cCst�d|d�S)z*return a changegroup chunk header (string)rr�r�pack)�lengthr r r!�chunkheader;�r&cCst�dd�S)zBreturn a changegroup chunk header (string) for a zero-length chunkrrr#r r r r!�
closechunk@sr(cCstt|��|S)z3Obtain a changegroup chunk header for a named path.)r&�len)�pathr r r!�_fileheaderEr'r+c	Cs�d}d}zN|r|r|�|d�}nt|dd�}ntjddd�\}}t�|d�}|}|D]}|�|�q*d}|W|dur>|��|durR|rL|rL|�|�St�|�SS|dur[|��|duro|ri|ri|�|�wt�|�ww)z�Write chunks to a file and return its filename.

    The stream is assumed to be a bundle file.
    Existing files will not be overwritten.
    If no filename is specified, a temporary file is created.
    Nswbis
hg-bundle-s.hg)�prefix�suffix�wb)rr
�mkstemp�os�fdopen�write�close�unlink)�ui�chunks�filename�vfs�fh�cleanup�fd�cr r r!�writechunksJs8���r=c@s�eZdZdZeZejZdZdZ	d%dd�Z
dd�Zd	d
�Zdd�Z
d
d�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd%dd �Zejddfd!d"�Zd#d$�ZdS)&�cg1unpackera�Unpacker for cg1 changegroup streams.

    A changegroup unpacker handles the framing of the revision data in
    the wire format. Most consumers will want to use the apply()
    method to add the changes from the changegroup to a repository.

    If you're forwarding a changegroup unmodified to another consumer,
    use getchunks(), which returns an iterator of changegroup
    chunks. This is mostly useful for cases where you need to know the
    data stream has ended by observing the end of the changegroup.

    deltachunk() is useful only if you're applying delta data. Most
    consumers should prefer apply() instead.

    A few other public methods exist. Those are used only for
    bundlerepo and some debug commands - their use is discouraged.
    �01rNcCsh|durd}|tjjvrt�td�|��|dkrd}tj�|�}|�|�|_||_	|p-i|_
d|_dS)N�UNs#unknown stream compression type: %ssBZs_truncatedBZ)r�compengines�supportedbundletypesr	rr�
forbundletype�decompressorreader�_stream�_type�extras�callback)�selfr9�algrG�
compenginer r r!�__init__�s

zcg1unpacker.__init__cCs|jduo	|jdkS)Nr@)rF�rIr r r!�
compressed�szcg1unpacker.compressedcC�|j�|�S�N)rE�read)rIrr r r!rQ��zcg1unpacker.readcCrOrP)rE�seek)rI�posr r r!rS�rRzcg1unpacker.seekcC�
|j��SrP)rE�tellrMr r r!rV��
zcg1unpacker.tellcCrUrP)rEr3rMr r r!r3�rWzcg1unpacker.closecCsTt|jd�}t�d|�d}|dkr|rt�td�|��dS|jr&|��|dS)Nrrrr)rrErrr	rrrH)rIrrr r r!�_chunklength�szcg1unpacker._chunklengthcC�iS)z*v10 does not have a changelog header chunkr rMr r r!�changelogheader��zcg1unpacker.changelogheadercCrY)z)v10 does not have a manifest header chunkr rMr r r!�manifestheader�r[zcg1unpacker.manifestheadercCs$|��}|siSt|j|�}d|iS)zBreturn the header of the filelogs chunk, v10 only has the filename�filename)rXrrE)rIr�fnamer r r!�
filelogheader�s
zcg1unpacker.filelogheaderc
Cs8|\}}}}|dur
|}n|}d}d}	|||||||	fS�Nrr )
rI�headertuple�prevnode�node�p1�p2�cs�	deltabase�flags�protocol_flagsr r r!�_deltaheader�szcg1unpacker._deltaheaderc
	Csp|��}|siSt|j|j�}|j�|�}t|j||j�}|�||�}|\}}}}	}
}}||||
|	||i|f	SrP)rXrrE�deltaheadersize�deltaheaderrrj)
rIrbr�
headerdata�header�deltarcrdrergrfrhrir r r!�
deltachunk�szcg1unpacker.deltachunkccs��d}|d|jkrUd}	t|�}|s#|dkr|d7}n|r"|d7}n%d}tt|��Vd}|t|�krG|d}|||�V|}|t|�ks4q
t�V|d|jks
dSdS)a"returns all the chunks contains in the bundle

        Used when you need to forward the binary stream to a file or another
        network API. To do so, it parse the changegroup data, otherwise it will
        block in case of sshrepo because it don't know the end of the stream.
        r�TrFiN)�_grouplistcountr"r&r)r()rI�parts�	noentries�chunkrT�nextr r r!�	getchunks�s.�
���zcg1unpacker.getchunkscCsH|j|_|��|��}|j�d�}|j||||d�|��d|_dS)Nr��
addrevisioncb)�	incrementrHr\�	deltaiter�manifestlog�
getstorage�addgroup�complete)rI�repo�revmap�trp�progry�deltas�storager r r!�_unpackmanifestss
zcg1unpacker._unpackmanifestsc(	s�����tj�jvptj�jvo|jdko|dk}|r'tj�|p"t�dd�}	nd}	��fdd�}
�fdd	�}�z�|j�	d
|�}|j�	d|��j
	d4d
dit�|j����j
���|�t�����t�|�}�j�td��t����jjtd�td�|d�}
|
j|_t��g���fdd�}��fdd�}|��|��}�j||
|d||d�s��jjddd�t��}t��}|�}|
��~d�d|_i�
i�	�j�td���jjtd�td�|d�}
d}|	r�tj|	dvr�
fdd�}|j �|||
|d�i}�j�!d d!��r8�j
��j"}t�#�|�D]$}��$|�j%}||�&�}t�'|�D]\}}|�	|t���(|��q&�qd}|	�rKtj)|	dv�rK�	fd"d#�}�j�td$��t*�||||||d�\}}|	�r�tj+|	dv�ru��,||	�|d��
�-�D]\}\} }!|�,||	| |!��qy�	�-�D]\}"\} }!|"�,||	| |!��q�|j.�	d%d&�|j.�	d'd&�|j.�	d(d&�|j.�	d)d&��jj/�s�|j.d%|7<|j.d'|7<|j.d(|7<d&}#��r���}$|#t|$�t��7}#|$D]}%|%�v�r�|%�0��r|#d8}#�q�jj/�s|j.d)|#7<��1�|d&k�rbd*|jv�r;t2��3���|jd*<t2��3|d��|jd+<t4|j��nt4|j��t2��3����d*<t2��3|d���d+<�j
	,d5d
dit�����t�#�|��d}&|d-v�r��5��rzt6j7}}&nt6j8}}&��r�t6�9�||��|&du�r���r���:��n��t6j;�||&g�d.�g�|d&k�r�����fd/d0��|�<d1���fd2d3��W�j�=�n�j�=�w|#d&k�r�|#d}'|'S|#d}'|'S)6a?Add the changegroup returned by source.read() to this repo.
        srctype is a string like 'push', 'pull', or 'unbundle'.  url is
        the URL of the repo where this changegroup is coming from.

        Return an integer summarizing the change to this repo:
        - nothing changed or no source: 0
        - more heads than before: 1+added heads (2..n)
        - fewer heads than before: -1-removed heads (-2..-n)
        - number of heads stays the same: 1

        `sidedata_categories` is an optional set of the remote's sidedata wanted
        categories.
        �04spullT)�pullNcs�j�dt|��t��S)Nsadd changeset %s
)r5�debugrr)��x��clr�r r!�csmap;sz cg1unpacker.apply.<locals>.csmapcs
��|�SrP��revr��r�r r!r�?rWz!cg1unpacker.apply.<locals>.revmapssourcesurl�prechangegroup�throwsadding changesets
�
changesets�chunks��unit�totalcs|�kr��|�dSdSrP)�append)r�r�)�clstart�duprevsr r!�ondupchangelog_s�z)cg1unpacker.apply.<locals>.ondupchangelogcs2|�|�}�dusJ���|j���||�dSrP)�changelogrevision�update�files�register_changeset)r�r��ctx)�	efilessetr�r r!�onchangelogcs
z&cg1unpacker.apply.<locals>.onchangelog)�alwayscachery�duplicaterevisioncbs(applied empty changelog from changegroupswarn-empty-changegroup)�configsadding manifests
�	manifestsrc�F��|�}|s||f�|<dS||ddksJ�|d|f�|<dS�Nrr��get)�manifestr��range)�touched_manifestsr r!�on_manifest_rev��

z*cg1unpacker.apply.<locals>.on_manifest_revrxsserversvalidatecr�r�r�)�filelogr�r�)�touched_filelogsr r!�on_filelog_rev�r�z)cg1unpacker.apply.<locals>.on_filelog_revsadding file changes
schangegroup-count-changesetsrschangegroup-count-revisionsschangegroup-count-filesschangegroup-count-heads�node�	node_last�pretxnchangegroup)spushsserve)�revsc	s��t��krdS�jd
it������D]}���}t��|��|d<|d=�jdit�|���q�fdd����D�}�j�	ddt��d�
d	d�|D���dS)N�changegroupr�r��incomingcsg|]}|�vr|�qSr r )�.0�h)�oldheadsr r!�
<listcomp>/�z7cg1unpacker.apply.<locals>.runhooks.<locals>.<listcomp>s$%d incoming changes - new heads: %s
s, cSsg|]
}t|dd���qS)N�)r�r�r<r r r!r�4s)r�)r�)r)�hookr
�	strkwargs�copyrrc�headsr5�log�join)�unused_successr��args�newheads)�addedr�r��hookargsr�r�r r!�runhooks s�z#cg1unpacker.apply.<locals>.runhooksschangegroup-runhooks-%020ics
����SrP)�
_afterlock)�tr)r�r�r r!�<lambda>9�
z#cg1unpacker.apply.<locals>.<lambda>)r�)r�)>�
unfilteredr�REVLOGV2_REQUIREMENT�CHANGELOGV2_REQUIREMENT�version�sidedatamod�get_sidedata_helpers�setr��
setdefaultr�r
r��	changelog�delayupdater��weakref�proxyr5�statusrr)�makeprogressrzrHrZr{r~�	develwarnr�revlog_constants�KIND_MANIFESTLOGr��
configboolr|�xranger�r��	readdelta�	iteritems�add�KIND_FILELOG�_addchangegroupfiles�KIND_CHANGELOG�rewrite_sidedata�items�changes�quiet�closesbranch�invalidatevolatilesetsrrc�dict�
publishingr�public�draft�registernew�extend�advanceboundary�addpostclose�flush)(rIr�r��srctype�url�targetphase�
expectedtotal�sidedata_categories�adding_sidedata�sidedata_helpersr�r�r��progressr�r�r��efiles�clend�
changesetsr��	needfiles�ml�cset�mfnode�mfest�f�nr��newrevs�newfiles�mf�startrev�endrev�fl�
deltaheadsr�r��phaseall�retr )r�r�r�r�r�r�r�r�r�r�r�r!�applysZ
������
�

������	
�
�
�


���




��
�zcg1unpacker.applyc#s:�d�t��fdd�i�D]
}|dd�V|d�q
dS)z�
        returns an iterator of the deltas in this changegroup

        Useful for passing to the underlying storage system to be stored.
        Ncs
����SrP)rpr ��chainrIr r!r�Kr�z'cg1unpacker.deltaiter.<locals>.<lambda>�r)�iter)rI�	chunkdatar rr!r{Ds�
�zcg1unpacker.deltaiterrP)�__name__�
__module__�__qualname__�__doc__�_CHANGEGROUPV1_DELTA_HEADERrl�sizerkr�rrrLrNrQrSrVr3rXrZr\r_rjrprwr�rr�rr{r r r r!r>ms6


-
�7r>c@s&eZdZdZeZejZdZdd�Z	dS)�cg2unpackerz�Unpacker for cg2 streams.

    cg2 streams add support for generaldelta, so the delta header
    format is slightly different. All other features about the data
    remain the same.
    �02c
Cs(|\}}}}}d}d}	|||||||	fSr`r �
rIrarbrcrdrergrfrhrir r r!rj]szcg2unpacker._deltaheaderN)
rrrr�_CHANGEGROUPV2_DELTA_HEADERrlrrkr�rjr r r r!r Qsr cs<eZdZdZeZejZdZdZ	dd�Z
d	�fdd�	Z�ZS)
�cg3unpackerz�Unpacker for cg3 streams.

    cg3 streams add support for exchanging treemanifests and revlog
    flags. It adds the revlog flags to the delta header and an empty chunk
    separating manifests and files.
    �03rqc
Cs&|\}}}}}}d}	|||||||	fSr`r r"r r r!rjqszcg3unpacker._deltaheaderNc	sxtt|�j|||||d�t|ji�D]&}|d}|j�d|�|��}|j�	|�j
||||d�s9t�t
d���qdS)Nrxr]�adding %s revisions
s"received dir revlog group is empty)�superr$r�rr_r5r�r{r|r}r~r	rr)	rIr�r�r�r�ryrrr���	__class__r r!r�vs

����zcg3unpacker._unpackmanifestsrP)
rrrr�_CHANGEGROUPV3_DELTA_HEADERrlrrkr�rrrjr��
__classcell__r r r(r!r$dsr$cs6eZdZdZeZejZdZdd�Z	�fdd�Z
�ZS)�cg4unpackerzTUnpacker for cg4 streams.

    cg4 streams add support for exchanging sidedata.
    r�c
Cs$|\}}}}}}}	||||||	|fSrPr )
rIrarbrircrdrergrfrhr r r!rj�szcg4unpacker._deltaheaderc
	sntt|��|�}|s|S|\	}}}}}}}	}
}|
rJ�i}
|tj@r,t|j�}t�|�}
|||||||	|
|f	SrP)	r'r,rpr�CG_FLAG_SIDEDATAr"rEr��deserialize_sidedata)
rIrb�resrcrdrerfrgrorhrri�sidedata_rawr(r r!rp�s:�


�zcg4unpacker.deltachunk)rrrr�_CHANGEGROUPV4_DELTA_HEADERrlrrkr�rjrpr+r r r(r!r,�sr,c@seZdZdd�Zdd�ZdS)�headerlessfixupcCs||_||_dSrP)�_h�_fh)rIr9r�r r r!rL�s
zheaderlessfixup.__init__cCsZ|jr'|jd|�|j|d�}|_t|�|kr%|t|j|t|��7}|St|j|�SrP)r3r)rr4)rIr
rr r r!rQ�s zheaderlessfixup.readN)rrrrLrQr r r r!r2�sr2ccs��|jdur
d|j}}n|j|jkr|j}t�t|��}n|j}t�|jt|��}||�}t	t|�t|�t|��V|V|rE|V|V|j
tj@r]|j
}t	t|��V|VdSdS)z0Serialize a revisiondelta to changegroup chunks.Nr)ro�basenode�nullid�revisionr�trivialdiffheaderr)�replacediffheader�baserevisionsizer&rirr-r)r�ro�headerfnr,�data�metarr r r!�_revisiondeltatochunks�s&�
	
�r>cs��fdd�}t||d�S)z&Sort nodes for changegroup generation.cs���|��SrPr�)r
�r��lookupr r!r��sz$_sortnodesellipsis.<locals>.<lambda>��key)�sorted)�store�nodesr�r@rBr r?r!�_sortnodesellipsis�srFc	s��|}	�������fdd��|	r����ttfkr!tt}
}n"t|	�dkr6t�fdd�|	D��\}
t}n
t�fdd�|	D��\}
}��|
���|�}}
||
|fS)Ncs�|tkrtS�r
|S|g}|rs|d}|dd�}|�vr!�|S|�vr3|�dd���|�D��n>|�vrD|�dd��|D��n-t��dd�D]
}��|�|krX|SqKt��d�rc�j}n�j	j}t
�d	|�|f��|stS)
a�Turn a changelog revnum into a local revnum.

        The ellipsis dag is stored as revnums on the changelog,
        but when we're producing ellipsis entries for
        non-changelog revlogs, we need to turn those numbers into
        something local. This does that for us, and during the
        changelog sending phase will also expand the stored
        mappings as needed.
        rrNcS�g|]}|tkr|�qSr �r�r��ppr r r!r�+r�z=_resolvenarrowrevisioninfo.<locals>.local.<locals>.<listcomp>cSrGr rHrIr r r!r�.r�����targets?unable to resolve parent while packing '%s' %r for changeset %r)rr��
parentrevsr
r��linkrevr�safehasattr�
display_id�_revlogr	r)�clrev�walk�p�irL)r��clrevtolocalrev�fullclnodes�ischangelog�precomputedellipsisr�rDr r!�local
s<
�����(z)_resolvenarrowrevisioninfo.<locals>.localrc3��|]}�|�VqdSrPr �r�rT�rZr r!�	<genexpr>R��z-_resolvenarrowrevisioninfo.<locals>.<genexpr>c3r[rPr r\r]r r!r^Ur_)rMrr)rCrc)r�rDrXr�rN�linknoderVrWrY�linkparentsrdre�p1node�p2noder )r�rVrWrXrZrYr�rDr!�_resolvenarrowrevisioninfo�sE
rdFccs��|sdS|j}|r
d}
n|rt||||�}d}
nd}
|rhg}i}i}|D]@}|�|�}||�}|�|�}|||<||	vrB|||<n||
vrGq%t||||||||	|
�	\}}}||f||<|||<|�|�q%|}d}|dur{|jj|td�t|�d�}|j�	dd�}|dvr�td	�}|j�
||�tj}|r�tj
}n|d
kr�tj}n|dkr�tj}|j||
d|||d
�}t|�D]:\}}|r�|�|d�|r�||j}|j|vr�||j\}}||_||_|jtjO_n||j�}||_|Vq�|r�|��dSdS)a6Calculate deltas for a set of revisions.

    Is a generator of ``revisiondelta`` instances.

    If topic is not None, progress detail will be generated using this
    topic name (e.g. changesets, manifests, etc).

    See `revlogutil.sidedata.get_sidedata_helpers` for the doc on
    `sidedata_helpers`.
    Nsstoragesnodesr�r�sdevelsbundle.delta)r�p1�fulls0config "devel.bundle.delta" as unknown value: %srerfT)�
nodesorder�revisiondata�assumehaveparentrevisions�	deltamoder�r)r�rFr�rdr�r5r�rr)r��warnr�CG_DELTAMODE_STD�CG_DELTAMODE_PREV�CG_DELTAMODE_P1�CG_DELTAMODE_FULL�
emitrevisions�	enumerater�rcrbrcrh�REVISION_FLAG_ELLIPSISr`r)r�rDrErXr@�forcedeltaparentprev�topic�ellipsesrVrWrYr�r�rg�filtered�adjustedparents�	linknodesrcr�r`rNrbrcr�configtarget�msgrj�	revisionsrUr7r r r!�
deltagroup\s��



���	

�
�r|c@s\eZdZ							ddd�Z	ddd�Z	ddd	�Z	dd
d�Zdd
�Z	ddd�ZdS)�cgpackerFNcCs�|sJ�|sJ�||_||_||_||_||_||_|	|_|dur$t�}||_|
dur.t�}
|
|_	|
|_
||_||_||_
|j
jjrO|j
jjsO|j
jj|_dSdd�|_dS)a
Given a source repo, construct a bundler.

        oldmatcher is a matcher that matches on files the client already has.
        These will not be included in the changegroup.

        matcher is a matcher that matches on files to include in the
        changegroup. Used to facilitate sparse changegroups.

        forcedeltaparentprev indicates whether delta parents must be against
        the previous revision in a delta group. This should only be used for
        compatibility with changegroup version 1.

        builddeltaheader is a callable that constructs the header for a group
        delta.

        manifestsend is a chunk to send after manifests have been fully emitted.

        ellipses indicates whether ellipsis serving mode is enabled.

        bundlecaps is optional and can be used to specify the set of
        capabilities which can be used to build the bundle. While bundlecaps is
        unused in core Mercurial, extensions rely on this feature to communicate
        capabilities to customize the changegroup packer.

        shallow indicates whether shallow data might be sent. The packer may
        need to pack file contents not introduced by the changes being packed.

        fullnodes is the set of changelog nodes which should not be ellipsis
        nodes. We store this rather than the set of nodes that should be
        ellipsis because for very large histories we expect this to be
        significantly smaller.

        remote_sidedata is the set of sidedata categories wanted by the remote.
        NcSsdSrPr )�sr r r!r�?sz#cgpacker.__init__.<locals>.<lambda>)�_oldmatcher�_matcherr��_forcedeltaparentprev�_builddeltaheader�
_manifestsend�	_ellipsesr��_bundlecaps�_remote_sidedata�
_isshallow�_fullclnodes�_precomputedellipsis�_repor5�verbose�	debugflag�note�_verbosenote)rIr��
oldmatcher�matcherr��builddeltaheader�manifestsendrs�
bundlecapsru�shallow�
ellipsisroots�	fullnodes�remote_sidedatar r r!rL�s,2zcgpacker.__init__Tc
#s��|j��j�|�td��d}d}|jdkr'|j}|dkr!�j}t��|�}|j	�|||d�\}	}
|
D]}t
|j||j�D]}|t|�7}|Vq>q4t
�}
|t|
�7}t
�V|�td�|�|	d}|	d	}|	d
}|ott���}i}d}|j|||||||	d|d�}|D]A\}}
|r�|jd
vs�J�t|�}|t|�7}|V|
D]}t
|j||j�}|D]}|t|�7}|Vq�q�t
�}
|t|
�7}|
Vq�|�td�|�|jVd}|jr�|jr�fdd�t�|�D�}|���fdd�|D�}|j||||||||d�}|D]D\}}
t|�}t|�}|V|
D]}t
|j||j�}|D]}|t|�7}|V�q&�qt
�}
|t|
�7}|
V|�td�||f��q	t
�V|�rc�jdt|d�|d�dSdS)z�Yield a sequence of changegroup byte chunks.
        If changelog is False, changelog data won't be added to changegroup
        s%uncompressed size of bundle content:
rNr�sstrip)�generater�s%8.i (changelog)
�
clrevorderr��changedfiles�clrevtomanifestrev)r�)r%r�s%8.i (manifests)
cs"g|]
\}}�j|��|f�qSr )r|rQ)r�r
�lr�r�r r!r��s��z%cgpacker.generate.<locals>.<listcomp>csh|]}��|��qSr r�)r�r�r�r r!�	<setcomp>��z$cgpacker.generate.<locals>.<setcomp>s	%8.i  %s
soutgoing)rc�source)r�r�r�rr�r��_wanted_sidedatar�r��_generatechangelogr>r�r)r(r�istreemanifest�generatemanifestsr+r�r�r�r
r��clear�
generatefilesr�r)rI�
commonrevs�clnodes�fastpathlinkrevr�r�rr�r��clstater�rorur3�
clrevorder�	manifests�changedfiles�fnodes�it�treer6�mfdicts�clrevsr*r�r r�r!r�As��
�
�
���
��
��
�
��zcgpacker.generatec
s�i�i��jj�t��i�����d�}|sA�jsAt|�jd�}|D]}��|�}t���|<��|j	|���
|j�q"|dfS�������fdd�}t�j�|d|�j
�jtd�i�j�j|d�}	||	fS)	a�Generate data for changelog chunks.

        Returns a 2-tuple of a dict containing state and an iterable of
        byte chunks. The state will not be fully populated until the
        chunk stream has been fully consumed.

        if generate is False, the state will be fully populated and no chunk
        stream will be yielded

        See `revlogutil.sidedata.get_sidedata_helpers` for the doc on
        `sidedata_helpers`.
        )r�r�r�r�rAr cs���|�}t���|<�jrI|�jvs��|��jvr0|j}��||�����|���|���jrA��	�|j�
����|S��	|j�|S��|j|���	|j�|SrP)
r�r)r�r�r�r�r�r�r�r�rQ�keysr�)r�r<�manifestnode�r�r�r��clrevtomanifestrevr��mflrIr r!�lookupcls$

�
��z-cgpacker._generatechangelog.<locals>.lookupclTr��rurtrVrWrYr�)r�r|r�r�rCr�r�r)r�r�r�r�r|r�rr�r�)
rIr�rEr�r��statercr<r��genr r�r!r��sD�

(�zcgpacker._generatechangelogc	#s�|j}	|	j�d�i�������fdd�}
�r����\}}|j�|dd��}
|r-|
s-q��|�}|
s7g}n|�|||�}|rC|sCq|
||�}t|j||d||j|j	t
d�||j|j|d�}|j
�|jdd��sp||fVn|D]}qr|s||gfV�sdSdS)	a8Returns an iterator of changegroup chunks containing manifests.

        `source` is unused here, but is used by extensions like remotefilelog to
        change what is sent based in pulls vs pushes, etc.

        See `revlogutil.sidedata.get_sidedata_helpers` for the doc on
        `sidedata_helpers`.
        rcs,�r	�rJ��jS������fdd�}|S)Ncs��|}���|�jdd�}|��D]D\}}}|dkr:�|d}��|i�}|�||�}�|�|kr9|||<q�|}	��|	i�}
|
�||�}�|�|krV||
|<q|S)aPCallback for looking up the linknode for manifests.

                Returns the linkrev node for the specified manifest.

                SIDE EFFECT:

                1) fclnodes gets populated with the list of relevant
                   file nodes if we're not using fastpathlinkrev
                2) When treemanifests are in use, collects treemanifest nodes
                   to send

                Note that this means manifests must be completely sent to
                the client before you can trust the list of files and
                treemanifests to send.
                T)r��t�/)r��readfast�iterentriesr�)r��clnode�mdatarTr
r�subtree�
tmfclnodes�	tmfclnoder	�fclnodes�fclnode)r�r�r�rE�tmfnodesr�r r!�lookupmflinknode^s"��zRcgpacker.generatemanifests.<locals>.makelookupmflinknode.<locals>.lookupmflinknode)�__getitem__)r�rEr��r�r�r�r�r�r�)rEr�r!�makelookupmflinknodeVs
!z8cgpacker.generatemanifests.<locals>.makelookupmflinknodeNrKFr�r�)r�r|�popitemr��visitdirr}�_prunemanifestsr|r�r�rr�r�rr�)rIr�r�r�r�r�r�rVr�r�r�r�rE�should_visitrD�prunednodes�lookupfnr�rr r�r!r�<sL�+

�
�zcgpacker.generatemanifestscs2|js|��S|j|j�����fdd�|D�S)Nc� g|]}��|���vr|�qSr r �r�r
�r��flr�frevr r!r��s z,cgpacker._prunemanifests.<locals>.<listcomp>)r�r�r�rN)rIrDrEr�r r�r!r��szcgpacker._prunemanifestsc	#sp��fdd�|D�}|s�fdd��n�jjj���fdd��i��jr=�fdd��D���jjj�����
�fdd�}	n�}	�j}
|
jjtd	�td	�t|�d
�}t	t
|��D]Z\}}
|
�|
�}|skt�
td�|
�����|	||
��	�	fdd
�}|j|j�����fdd��	D�}|s�qW|j|d|
d�t�j||d|�j�j��j�j|d�}|
|fVqW|��dS)Ncs$g|]}��|�r��|�s|�qSr )r�r)r�r	rMr r!r��s���z*cgpacker.generatefiles.<locals>.<listcomp>cs��|i�SrPr�)�unusedr^)r�r r!�normallinknodes�rRz/cgpacker.generatefiles.<locals>.normallinknodescs4|j�|j��fdd�|D�}���fdd�|D�S)Nc3s�|]	}|�|�fVqdSrPr )r��r)�flinkrevr r!r^�s�zBcgpacker.generatefiles.<locals>.normallinknodes.<locals>.<genexpr>cs&i|]\}}|�vr�|��|��qSr r )r�r�r�)�clnr��fnoder r!�
<dictcomp>�s&zCcgpacker.generatefiles.<locals>.normallinknodes.<locals>.<dictcomp>)rNrc)rDr^r�)r�r�)r�r�r!r��scsg|]}�j|�qSr )r�r�rMr r!r��r�c	s��D]}z|�|�}|�|��|��<WqtjyYqw�||�}t|�t��krO�D] \}}|�|d�}||vrHt|||�d�||<q.|rN|||<q.|S)NrA)�filenoder�r	�ManifestLookupErrorr)r��min)�flogr^r<r��linksr
r�)rRrV�
commonctxsr�r�r r!rx�s"
�
�z)cgpacker.generatefiles.<locals>.linknodes�filesr�s!empty or missing file data for %scs�|SrPr r�)�linkrevnodesr r!�
lookupfilelog�z-cgpacker.generatefiles.<locals>.lookupfilelogcr�r r r�r�r r!r�sr)�itemF)rurVrWrYr�)r�r�rcr�r�r5r�rr)rqrC�filer	rr�rNr�r|r�r�r�r�r)rIr�r�r�r�r�r�r�r�rxr�rrUr^�
filerevlogr��	filenodesr�r )
r�rRr�rVr�r�r�r�r�r�r�r�rIr!r��sb�
�

�

�
��zcgpacker.generatefiles)FNFFNNN)T)TNrP)	rrrrLr�r�r�r�r�r r r r!r}�s&	
�R
�
�o
�y�r}c	
Cs(dd�}	t|||d|	dd|||||d�S)NcSst�|j|j|j|j�SrP)rr$rcrbrcr`�rr r r!r�@s�z _makecg1packer.<locals>.<lambda>r?rT)r�r�rsr�rur�r�r��r}�
r�r�r�r�rur�r�r�r�r�r r r!�_makecg1packer5s�r�c	

Cs&dd�}	t|||d|	d|||||d�S)NcSst�|j|j|j|j|j�SrP)r#r$rcrbrcr5r`r�r r r!r�_s�z _makecg2packer.<locals>.<lambda>r!r�r�r�r�rur�r�r�r�r�r r r!�_makecg2packerTs�r�c	

Cs(dd�}	t|||d|	t�|||||d�S)NcSs t�|j|j|j|j|j|j�SrP)r*r$rcrbrcr5r`rhr�r r r!r�}s�z _makecg3packer.<locals>.<lambda>r%r��r}r(r�r r r!�_makecg3packerrs�r�c	
Cs*dd�}	t|||d|	t�||||||d�S)Nc	Ss$t�|j|j|j|j|j|j|j�SrP)	r1r$rircrbrcr5r`rhr�r r r!r��s�z(_makecg4packer.<locals>.builddeltaheaderr�)r�r�r�rur�r�r�r�r�r�r r r!�_makecg4packer�s
�r�)r?r!r%r�cCs�tt���}d}|j�dd�s|j�dd�st�|�rd}|s$|�d�|j�dd�p6tj	|jvp6tj
|jv}|s>|�d�|S)	NFsexperimentalschangegroup3streemanifestTr%schangegroup4r�)r��
_packermapr�r5r�rr��discardrr�r�)r��versions�needv03�want_v4r r r!�allsupportedversions�s&���

�
�
r�cCst|�SrP)r�r�r r r!�supportedincomingversions�r�r�cCsht|�}t�|�r|�d�|�d�tj|jvr#|�d�|�d�t|jvr2|�d�|�d�|S)Nr?r!)r�rr�r�r�NARROW_REQUIREMENT�LFS_REQUIREMENT�r�r�r r r!�supportedoutgoingversions�s







r�cCstt|��SrP)�maxr�r�r r r!�localversion�srcCs.t|�}tj|jvr|�d�|sJ�t|�S)Nr?)r�r�GENERALDELTA_REQUIREMENTr�r�r�r r r!�safeversions

rc
Cs�|t|�vsJ�|durt��}|durt��}|dkr%|��s%t�d��|r4|dvr4t�td�|��|�|�}t	|d}
|
|||||||||	d�	S)Nr?s;version 01 changegroups do not support sparse file matchers)r?r!sSellipsis nodes require at least cg3 on client and server, but negotiated version %sr)rur�r�r�r�)
r��matchmod�always�neverr	�ProgrammingErrorrr�narrowmatchr�)r�r�r�r�r�rur�r�r�r��fnr r r!�
getbundlers<����

�r
cCst|d|||d�S)Nr)rG)r�)r�r9rJrGr r r!�getunbundlerAsrcCsb|jjs|dkr|j�td�t|��|jjr-|j�d�|D]}|j�dt|��q dSdS)Nsbundles%d changesets found
slist of changesets:
s%s
)r5r�r�rr)r�r�r)r�rEr�rcr r r!�_changegroupinfoEs�rcCs2t||||||d�}t|t�|�ddt|j�i�S)N)�fastpathr�sclcount)�
makestreamrr�chunkbufferr)�missing)r��outgoingr�r�r
r��cgstreamr r r!�makechangegroupNs��rc
Cs~t|||||d�}|��}|j}	|j}
|j}|��|p(|jduo(|t|���k}|j	dd|d�t
||
|�|�|	|
||�S)N)r�r�r�spreoutgoingT)r�r�)r
r��commonr�ancestorsof�sort�
filternamerCr�r�rr�)
r�rr�r�r
r�r�r��bundlerr��csetsr�r�r r r!ras$
��rcCs�d}d}|jjtd�td�|d�}	t|ji�D]�}
|d7}|
d}|j�d|�|	��|�|�}t|�}
z|�	�}|j
||||d�}|sMt�td���Wntj
yd}z	t�td	�|��d}~ww|t|�|
7}||vr�||}t�|
t|��D]}|�|�}||vr�|�|�q}t�td
���|s�||=q|	��t�|�D]*\}}|�|�}|D]}z|�|�Wq�tjy�t�td�|t|�f��wq�||fS)Nrr�r�rr]r&rxs#received file revlog group is emptys#received delta base is censored: %ss#received spurious file revlog entrys+missing file data for %s:%s - run hg verify)r5r�rrr_r�rzr�r)r{r~r	r�CensoredBaseErrorr
r�rc�removerr�r��LookupErrorr)r�r�r�r��
expectedfilesrryr{r�rrr	r�or�r��e�needs�newr
r r r!r��sj	�
����
�

����	r�rP)NFNNNN)FFNNN)NNNFFNNN)FN)FNNN)F�
__future__rr0rr��i18nrrcrrrr
r�r	r
rrrrrr�
interfacesr�revlogutilsrr�rr��utilsr�Structrr#r*r1r�rr"r&r(r+r=�objectr>r r$r,r2r>rFrdr|r}r�r�r�r�r�r�r�r�rrr
rrrrr�r r r r!�<module>s�(




#g!2"f
�O
�$
�#
�#
�)�
�
3

�
�*�

https://t.me/RX1948 - 2025