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/hgext/infinitepush/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib64/python3.9/site-packages/hgext/infinitepush/__pycache__/__init__.cpython-39.pyc
a

�+�b���@s�dZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlmZmZddlmZddlmZmZddlmZmZmZddlmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,d	d
l-m.Z.m/Z/dZ0iZ1e(�2e1�Z2e2dd
dd�e2dddd�e2dddd�e2dddd�e2dddd�e2dddd�e2dddd�e2dddd�e2dddd�e2dddd�e2dddd�dZ3dZ4dZ5e.j6Z6e(�7�Z7e(�8�Z8dd�a9e
�:d�j;Z<d d!�Z=d"d#�Z>d$d%�Z?d&d'�Z@Gd(d)�d)eA�ZBd*d+�ZCd,d-�ZDd.d/�ZEd0d1�ZFd2d3�ZGd4d5�ZHd6d7�ZId8d9�ZJdyd:d;�ZKe+jLd<d=��ZMd>d?�ZNd@dA�ZOdBdC�ZPdDdE�ZQdFdG�ZRdHdI�ZSdzdJdK�ZTdLdM�ZUd{dOdP�ZVdQdR�ZWdSdT�ZXdUdV�ZYdWdX�ZZdYdZ�Z[d[d\�Z\e%j]fd]d^�Z^e!�_e6�d_d`��Z`daejae.j6<dbdc�Zbejcddde��Zddfdg�Zedhdi�Zfdjdk�Zgdldm�Zhe�ie6dn�dodp��Zjdqdr�Zkdsdt�Zldudv�Zmdwdx�ZndS)|ax
 store some pushes in a remote blob store on the server (EXPERIMENTAL)

IMPORTANT: if you use this extension, please contact
mercurial-devel@mercurial-scm.org ASAP. This extension is believed to
be unused and barring learning of users of this functionality, we will
delete this code at the end of 2020.

    [infinitepush]
    # Server-side and client-side option. Pattern of the infinitepush bookmark
    branchpattern = PATTERN

    # Server or client
    server = False

    # Server-side option. Possible values: 'disk' or 'sql'. Fails if not set
    indextype = disk

    # Server-side option. Used only if indextype=sql.
    # Format: 'IP:PORT:DB_NAME:USER:PASSWORD'
    sqlhost = IP:PORT:DB_NAME:USER:PASSWORD

    # Server-side option. Used only if indextype=disk.
    # Filesystem path to the index store
    indexpath = PATH

    # Server-side option. Possible values: 'disk' or 'external'
    # Fails if not set
    storetype = disk

    # Server-side option.
    # Path to the binary that will save bundle to the bundlestore
    # Formatted cmd line will be passed to it (see `put_args`)
    put_binary = put

    # Serser-side option. Used only if storetype=external.
    # Format cmd-line string for put binary. Placeholder: {filename}
    put_args = {filename}

    # Server-side option.
    # Path to the binary that get bundle from the bundlestore.
    # Formatted cmd line will be passed to it (see `get_args`)
    get_binary = get

    # Serser-side option. Used only if storetype=external.
    # Format cmd-line string for get binary. Placeholders: {filename} {handle}
    get_args = {filename} {handle}

    # Server-side option
    logfile = FIlE

    # Server-side option
    loglevel = DEBUG

    # Server-side option. Used only if indextype=sql.
    # Sets mysql wait_timeout option.
    waittimeout = 300

    # Server-side option. Used only if indextype=sql.
    # Sets mysql innodb_lock_wait_timeout option.
    locktimeout = 120

    # Server-side option. Used only if indextype=sql.
    # Name of the repository
    reponame = ''

    # Client-side option. Used by --list-remote option. List of remote scratch
    # patterns to list if no patterns are specified.
    defaultremotepatterns = ['*']

    # Instructs infinitepush to forward all received bundle2 parts to the
    # bundle for storage. Defaults to False.
    storeallparts = True

    # routes each incoming push to the bundlestore. defaults to False
    pushtobundlestore = True

    [remotenames]
    # Client-side option
    # This option should be set only if remotenames extension is enabled.
    # Whether remote bookmarks are tracked by remotenames extension.
    bookmarks = True
�)�absolute_importN)�bin�hex)�_)�getattr�open)�procutil�
stringutil�urlutil)�bundle2�changegroup�commands�	discovery�encoding�error�exchange�
extensions�hg�	localrepo�phases�pushkey�pycompat�	registrar�util�wireprototypes�wireprotov1peer�wireprotov1server�)�bundleparts�commonsships-with-hg-core�infinitepush�serverF)�default�	storetype��	indextypes	indexpath�
storeallparts�reponames
scratchbranchs	storepath�
branchpattern�pushtobundlestoresexperimentalsserver-bundlestore-bookmarksinfinitepush-scratchpushcCsdS�NF�)�xr+r+�A/usr/lib64/python3.9/site-packages/hgext/infinitepush/__init__.py�<lambda>�r$r.z^[a-f0-9]+$cCsl|�ddg�}|�dd�}|s(t�d��|�ddg�}|�dd�}|sPt�d��dd	lm}|�||||�S)
Nr sput_argss
put_binarysput binary is not specifiedsget_argss
get_binarysget binary is not specifiedr��store)Z
configlist�configr�Abort�r0Zexternalbundlestore)�uiZput_argsZ
put_binary�get_argsZ
get_binaryr0r+r+r-�_buildexternalbundlestore�s

r6cCs�|�dd�}|st�td���|�d�\}}}}}|�dd�}|sPt�td���|�ddd�}|�dd	d
�}	|�ddd�}
d
dlm}|j|||||||t|�|	|
d�
S)Nr ssqlhostsplease set infinitepush.sqlhost�:r's please set infinitepush.reponameslogfiler$swaittimeouti,slocktimeout�xr)�sqlindexapi)�waittimeout�locktimeout)	r1rr2r�splitZ	configintr3r9�_getloglevel)r4Zsqlhost�host�portZdb�user�password�reponameZlogfiler:r;r9r+r+r-�_buildsqlindex�s.�rCcCs>|�ddd�}tt|��d�}t|t�s:t�td�|��|S)Nr sloglevelsDEBUGsinvalid log level %s)	r1r�logging�upper�
isinstance�intrr2r)r4ZloglevelZnumeric_loglevelr+r+r-r=
s

r=cCs8t�|�r4|�dd�d}|�|�r4|t|�d�S|S)a)returns a bookmarks with hoisted part removed

    Remotenames extension has a 'hoist' config that allows to use remote
    bookmarks without specifying remote path. For example, 'hg update master'
    works as well as 'hg update remote/master'. We want to allow the same in
    infinitepush.
    �remotenamesshoistedpeer�/N)r�isremotebooksenabledr1�
startswith�len)r4�remotebookmarkZhoistr+r+r-�	_tryhoists
	

rNc@seZdZdd�ZdS)�bundlestorecCs�||_|jj�dd�}|dkr@ddlm}|�|jj|j�|_n*|dkrXt|jj�|_nt�t	d�|��|jj�dd�}|dkr�dd	lm
}|�
|j�|_n*|d
kr�t|jj�|_nt�t	d�|��dS)Nr r#sdiskrr/sexternals,unknown infinitepush store type specified %sr%)�fileindexapissqls,unknown infinitepush index type specified %s)
Z_repor4r1r3r0Zfilebundlestorer6rr2rrP�indexrC)�self�repoZ	storetyper0Z	indextyperPr+r+r-�__init__#s&
�
�zbundlestore.__init__N)�__name__�
__module__�__qualname__rTr+r+r+r-rO"srOcCs|�dd�S)Nr r!)�
configbool�r4r+r+r-�	_isserver>srZcCst|�r|��rt|�|_dS�N)rZ�localrO)r4rSr+r+r-�	reposetupBsr]cCs&t|�t|�rt|�nt|�dSr[)�commonsetuprZ�serverextsetup�clientextsetuprYr+r+r-�extsetupGs
racCs2tdftjd<|�dd�}|r.t�|�\}}adS)Nsnamespace patternsslistkeyspatternsr r()�wireprotolistkeyspatternsrr
r1r	�
stringmatcher�_scratchbranchmatcher)r4Zscratchbranchpat�kind�patr+r+r-r^Os�
�r^cs�tjd��fdd�}�j|_|tjd<tjd��fdd�}�j|_|tjd<t�tjdt�tt	j
dd	�d
ft	j
d<t�tdt�t�tdt
�dS)
N�pushkeycst�g|�Ri|��dSr[)�bundle2pushkey��args�kwargs)�origpushkeyhandlerr+r-�newpushkeyhandler_sz)serverextsetup.<locals>.newpushkeyhandlersphase-headscst�g|�Ri|��Sr[)�bundle2handlephasesri)�orighandlephasehandlerr+r-r.fs���z serverextsetup.<locals>.<lambda>�listkeysslookupr�keysgetbundlechunkssprocessparts)rZparthandlermapping�paramsr�wrapfunctionr�localrepository�localrepolistkeys�_lookupwraprr
r�getbundlechunks�processparts)r4rmZnewphaseheadshandlerr+)rorlr-r_\s 



��
r_cCs|t�tjdt�}|d�dddtd�f�t�tjdt�t�t	dt
�ttj
_tj}|�d�}|�||�|�t���dS)	Nspushrr$sbundle-stores/force push to go to bundle store (EXPERIMENTAL)�pulls
checkheadss	changeset)rZwrapcommandr
�table�_push�appendr�_pullrsr�_checkheads�listkeyspatternsrZwirepeerrZb2partsgenorderrQ�insert�pop�scratchbranchparttype)r4�entryZ	partorderrQr+r+r-r`xs ��	
�r`cCs|j�ttd�rdS||�Sr*)r4rX�experimental�configscratchpush)�orig�pushopr+r+r-r~�sr~cCs,t�|�}t�|�t�|�|��}t�|�Sr[)	rZ
decodelistr�	iteritemsZlistkeysr�tolocalrZ
encodekeys)rS�proto�	namespace�patterns�dr+r+r-rb�s
rbc
Cs�|dkr�|r�|jj}i}|||�}|D]f}|�|�|��|�d�rXd|dd�d}t�|�\}}	}
t�|�D]\}}|
|�rr|||<qrq&|S|||�SdS)N�	bookmarks�*sre:^���s.*)	rOrQ�updateZgetbookmarks�endswithr	rcrr�)
r�rRr�r�rQ�results�	bookmarks�patternrerfZmatcher�bookmark�noder+r+r-ru�s

rucsJ��d�sidfS�j�d����fdd�}t���t�|�d�|fS)Nrgspreparing listkeys for "%s"
cs"�j�d�t|�f�t�|�S)Ns$received listkey for "%s": %i bytes
)r4�debugrLrZ
decodekeys)r��r�rRr+r-�decode�s�z listkeyspatterns.<locals>.decode)�	namespacespatterns)Zcapabler4r�rZ	fromlocalrZ
encodelist)rRr�r�r�r+r�r-r�s
��rcCst|�d��S)Nsbundle())�list�revs)�
bundlerepor+r+r-�_readbundlerevs�sr�c
Cs�t�}|j}|D]}|�|�|�d�q|s2|Sd�|�}g}d}|pJgD]2}	|	�d�rt|�d�|	|f��d}qL|�|	�qL|s�|�d|�|S)z�Tells remotefilelog to include all changed files to the changegroup

    By default remotefilelog doesn't include file content to the changegroup.
    But we need to include it if we are fetching from bundlestore.
    ��Fsexcludepattern=T)�set�	changelogr��read�joinrKr|)
�
bundlecapsr��
bundlerevsr4Zchangedfiles�cl�rZnewcapsZappendedZcapr+r+r-�_includefilelogstobundle�s"

r�cCs`g}d}tj|||gd�}t�|||d�}t�|���}tjd|d�}|�	d|�|�
|�|S)z�
    Bundle may include more revision then user requested. For example,
    if user asks for revision but bundle also consists its descendants.
    This function will filter out all revision that user is not requested.
    s02)ZcommonheadsZancestorsofry�changegroup��data�version)r�outgoingrZ
makestreamr�chunkbufferr�r�
bundlepart�addparamr|)r��bundlerootsZunknownhead�parts�versionr�Zcgstream�cgpartr+r+r-�	_rebundle�s�
r�c	CsH|j}g}|D]4}|�|�}|�|�}|D]}||vr*|�|�q*q|Sr[)r�r��parentsr|)	Zoldrepor�r�r�r��revr�r��parentr+r+r-�_getbundleroots�s

r�cCs0t|�d��}t|�dko,||d��|kS)N�heads(bundle())rr)r�r�rLr�)�headr��bundleheadsr+r+r-�_needsrebundlings�r�cCs.g}t||��st�|d���}t�|j||�}t|tj�rft	j
d|j��d�}|�
dd�|�|�n�t|t	j�r�d}|��D]R}|jdkr�d}t	j
|j|��d�}	t�|j�D]\}
}|	�
|
|�q�|�|	�q~|s�tjdd	t|�d
d��n
t�d��Wd
�n1�s0Ynt|||�}|S)zmgenerates bundle that will be send to the user

    returns tuple with raw bundle string and bundle type
    �rbr�r�r��01FTs,unexpected bundle without changegroup part, shead: %ssreport to administrator)�hintsunknown bundle typeN)r�rZ	posixfilerZ
readbundler4rFrZcg1unpackerrr��_streamr�r�r|Z
unbundle20Z	iterparts�typerr�rrrr2rr�)r�r�r��
bundlefiler��f�	unbundler�partZhaschangegroup�newpart�key�valuer+r+r-�_generateoutputparts
s:
�

��,r�cst|pg}i�g�g}g}i}g}	�z*|D]�}
|jj�|
�s(|
|vr�t�||
�}d|j|f}t�|j|�}
|	�	|
|f�t
t|
��}t||
||j�}|
j}t
||
|�}|D].}|�|�}ttj��t|�<|
||f||<q���	t|
g||
�R��|�|�|�	|
�q(W|	D]:\}
}|
��zt�|�Wnttf�yFYn0�qnB|	D]:\}
}|
��zt�|�Wnttf�y�Yn0�qR0t���d}d}tjd�z���fdd�}|tjd<d}��fdd�}t�tj d	|�d}t!t
|�t
|�Bt
|��}|||f||d
�|��}W|�r0�tjd<|�rpt�"tj d	|�n(|�rX�tjd<|�rnt�"tj d	|�0|S)N�bundle:%s+%sFr�cs8�|g|�Ri|��}�D]}|D]}|�|�q"q|Sr[)�addpart)�bundlerrjrk�result�bundler�)�oldchangegrouppart�scratchbundlesr+r-�_changegrouppartjs
z)getbundlechunks.<locals>._changegrouppartTcs8|||�}|dkr4�r4|�d�dkr*|d=|���|S)Nsphasess
publishing�True)�getr�)r�rRr�Z
origvalues)�	newphases�pullfrombundlestorer+r-�	_listkeysws

z"getbundlechunks.<locals>._listkeysrp)�headsr�)#r�rQZhas_noderZdownloadbundle�rootr�
repositoryr4r|r�r�r�r�r��strrZdraftrr��extend�close�os�unlink�IOError�OSError�boolrZgetbundle2partsmappingrrsrrtr��unwrapfunction)r�rS�sourcer�r�rkZnewheadsZscratchheadsZ
nodestobundleZallbundlestocleanupr�Z
newbundlefile�
bundlepathr�r�r�r�r�r�r�ZwrappedchangegrouppartZwrappedlistkeysr�r�r�r+)r�r�r�r�r-rw4s�
�
�
�
�


	����
��
�rwcCsdd�}|S)Nc
Ss�t�|�}t|t�rLt|�rL|jj�|�}|r:dd|fSddd|fSn�zt|�	|��}dd|fWSt
y�}zT|jj�|�r�dd|fWYd}~St�
|�}dd|fWYd}~SWYd}~n
d}~00dS)Ns%d %s
rrsscratch branch %s not found)rr�rFr�rdrOrQ�getnoder�lookup�	Exception�	getbundler	�forcebytestr)rSr�r�ZlocalkeyZscratchnoder��instr+r+r-�_lookup�s"
�
z_lookupwrap.<locals>._lookupr+)r�r�r+r+r-rv�srv�defaultc
Ks�t�|�}tjd||||�d�d�\}}i}|��}g}|�dg�D]}	|	|vrD|�|	�qD|�d��r*g}
|�d�pxg}|�d�D] }t|�r�d||<q�|
�|�q�|�rt�	|||�}
zT|
j
d|d�}|D]4}||vr�t�d	|��||||<|�||�q�W|
�
�n
|
�
�0|
|d<||d<|�s6|�rDt�td
t�znt|||�}||||fit�|���}t�|��r�|�|�t|||�n
t||�|W|�r�t�td
�Sn|�r�t�td
�0dS)Nsinfinite-push's pullsbranch)Zdefault_branchessrev�bookmarks
REVTOFETCHr��r�sremote bookmark %s not found!sfindcommonincoming)r�byteskwargsr
Zget_unique_pull_pathr�Z
unfilteredr|rdr�peerrrr2r�rrsr�_findcommonincoming�_readscratchremotebookmarks�	strkwargsrrJr��_saveremotebookmarks�_savelocalbookmarksr�)r�r4rSr��opts�branchesZscratchbookmarksZunfiZunknownnodesr�r�r�r��other�fetchedbookmarks�remotescratchbookmarksr�r+r+r-r}�sp
�

���

��r}c
Cs�t�|�r�t�d�}|�|j|�}i}|j��|jd�	|�D]H}|�
|�\}}||kr@t|�r@|jd�||�}	|	r@t
|	d�||<q@|SiSdS)NrHsremotebookmarksr)rrJr�find�
activepathr4Z_remotenamesZ
clearnames�namesZ	listnamesZsplitremotenamerd�nodesr)
r4rSr��remotenamesext�
remotepathr�rM�pathZbooknamerr+r+r-r��s



�r�cCs�t�d�}|�|j|�}t�t�}i}|�|�}|D]P\}}	}}
||krJq4|	dkrj|
|vr`||
=|||
<q4|	dkr4||
�t	|��q4t
�|�D]\}}|||<q�|�||||�dS)NrHr��branches)
rr�r�r4�collections�defaultdictr��readremotenamesr|rrr��saveremotenames)rSZnewbookmarks�remoterrr�r��remotenamesZhexnode�nametypeZrnamer�r+r+r-r�
s"




r�c
Cs�|sdS|����|���||�d��R}g}t�|�D]"\}}||}|�||��f�q6|j�|||�Wd�n1s~0YWd�n1s�0YWd�n1s�0YdS)Nr�)	Zwlock�lockZtransactionrr�r|r�Z
_bookmarksZapplychanges)rSr��trZchangesZscratchbookr�Z	changectxr+r+r-r�#s r�cOs||i|��\}}}|d|fS)NTr+)r�rjrkrZincZremoteheadsr+r+r-r�.sr�c	Os�t�|�}|�d�}t|�dkr*|d}nd}d}ttf|i}|�|d���.|�d�}t|�rrd}|�tdd�|r�g|d<|�tt	d�t
�td	t
�}tt�|||��}	t|	�dkr�td
�}
t�|
��|	d}|jp�|j}t|||�}
|||g|�Rit�|���}t�|��rl|�r`|�r`t�|||�}z&|jd|gd�}|
�|�W|��n
|��0t||
|�Wd�n1�s�0Y|�r�|t_ |S)
Nr�rrr$r sbundle_storeTsbundle2.pushbacks_localphasemoves.cannot push to multiple path with infinitepushr�r�)!rr�r�rLr��configbookmarkZconfigoverriderdZ	setconfigr�rrsr�
_phasemover�r
Zget_push_pathsrrr2Zpushloc�locr�r�rrJrr�rr�r�r�Z_localphasemove)r�r4rSZdestsr�r�ZoldphasemoveZ	overrides�scratchpush�paths�msgrZdestpathr�r�r�r�r+r+r-r{3sN



�
�,r{c
s�t�d�}d�d�d���fdd�|�|�D�}��fdd�|D�}|D]"}||vrHt�td��|����qHi}t�t	�}	|D]@\}
}}}|d	kr�||vr�|
||<q~|d
kr~|	|�
t|
��q~|�|�|	|�dS)zqPrune remote names by removing the bookmarks we don't want anymore,
    then writing the result back to disk
    rHr�r�csg|]}|��kr|�qSr+r+��.0Z
remotename)r�
remote_idxr+r-�
<listcomp>vs�z0_deleteinfinitepushbookmarks.<locals>.<listcomp>cs g|]}|�dkr|��qS)r�r+r)�name_idx�nametype_idxr+r-r{s�s6infinitepush bookmark '{}' does not exist in path '{}'r�rN)
rr�rrr2r�formatrrr�r|rr	)
r4rSrrrrZremote_bm_names�namer�r�r�rr
r+)rrrrr-�_deleteinfinitepushbookmarksks6
�����

rcCs|tjkr||||�dS)z�prevent commits from being marked public

    Since these are going to a scratch branch, they aren't really being
    published.N)r�public)r�r�rZphaser+r+r-r�s
rcs��j�tt�}�j�tt�}d�jvs*|s.dStt�	�j
�vrBdS�j�d��jj
sp�j�td��d�_dS|�dd�t��j�j
�j�j|�}|D]}|�|�q��fdd�}|S)Ns
changesetssno changes found
rr r�cs
d�_dS)Nr)�cgresult)�op�r�r+r-�handlereply�szpartgen.<locals>.handlereply)r4r1r�rrXr�Z	stepsdoner�rZbundle2capsr
�addr��missing�statusrr r�rZgetscratchbranchpartsrSr�)r�r�r�rZscratchpartsZscratchpartr#r+r"r-�partgen�s&�r'r+csD�fdd���d�D�}|dur$|S|�vr@t��d|��r@|S|S)Ncsg|]}�|�qSr+r+)rr��r�r+r-r�r$z_getrevs.<locals>.<listcomp>ssort(bundle())sbundle() & %s::)r�r�r�)r��oldnode�forcer�r�r+r(r-�_getrevs�sr+c
ks�t��}||fddi|��z,dV||fdt��|dd�|��WnPty�}z8||fdt��|dt�|�d�|���WYd}~n
d}~00dS)N�	eventtype�start�success���r,�	elapsedms�failure�r,r1Zerrormsg)�timer�r	r�)�loggerZservicerk�start�er+r+r-�logservicecall�s.���
���r8c
Cs�|jd}|s�|jj}zt��}Wnty8d}Yn0t��t�dd�}t	�
�}tj|j
d||||�dd�d�}|j�d|�n|d}|S)Nsinfinitepushloggersunknownri�5wr r')r@�	requestid�hostnamerB)�recordsrSr4rZgetuserr��randomZseedZrandint�socketZgethostname�	functools�partial�logr1r$)r!r5r4�usernamer9r:r+r+r-�_getorcreateinfinitepushlogger�s*


�rBcCs�|j�td��t�|j�}t�|||���}|D]�}d}|jdkrPt�||�n�tj|j|�	�d�}t
�|j�D]\}}	|�
||	�qp|jdvr�|jdur�|j�d|j�}
|
j
dd|jd	d
�|
j
ddd	d
�|j�|jdd
i�|r0|�|�q0Wd�n1�s0Yt�|���}t
��\}}
zfz&t�|d�}|�|�	��W|��n
|��0t|i|
�Wzt�|
�Wnt�y�Yn0n&zt�|
�Wnt�y�Yn00dS)zmstores the incoming bundle coming from push command to the bundlestore
    instead of applying on the revlogss&storing changesets on the bundlestore
N�	replycapsr�)rgr�sreply:%s�in-reply-tos%dF�Z	mandatory�return�1r�wb)r4r&rr�bundle20�partiteratorr��_processpartr�r�rr�rrr��replyr��idr;r$r�rr��	getchunks�mkstempr��fdopen�writer��storebundler�r�)r�rSr!r�r�r�r�r�r�r��rpart�buf�fdr��fpr+r+r-�storetobundlestore	sP


���,�rWcCs�|jdkr||||�S|j�dd�r2t||||�S|j�d�dkrN||||�S|j�dd�}t�|j�}d}t�|||���d}|D�]L}d}	|j	dkr�t�
||��n|j	tjk�r|j�dd�}
tj
d	|��d
�}	|	�d|
�|j}|�s�|j�tdd
�|j�tdd
�n�|�r�tj
|j	|��d
�}	t�|j�D]\}}|	�||��q8|j	dk�r�|jdu�r�|j�d�}
|
jdt|j�dd�|
jdddd�nt�
||�|�r�|j�|j	ddi�|	r�|�|	�q�Wd�n1�s�0Y|�r�t�|���}t��\}}zfz&t�|d�}|�|���W|� �n
|� �0t!|||�Wzt�"|�Wnt#�yvYn0n&zt�"|�Wnt#�y�Yn00dS)Nsunbundler r)r�r&rC�	cgversionr�r�r�r��_skippushkeyT�_skipphaseheadsrg�
reply:pushkeyrDFrErFrGrrH)$r�r4rXrWrrr�rrIrJr�rKrr�r�r�r�r;r$rr�rLr�r�rMr�rr�rNrOr�rPrQr�rRr�r�)r�rSr!r�Zhandleallpartsr�Zcgparamsr�r�r��	cgversionr�r�rSrTrUr�rVr+r+r-rx@s�


������,�rxc
s�t|�}t��}|tdd�|jjj�|jjj}|j�tdd�d��zz�zd|jj	|f}t
�|jj|��|�
d�}|�
dd�}|�
d	�}	|r���|�}
nd}
��d
�}|r�t|�dkr�t�td���t�|
|	|�}t|�dkr�d
nd}
|jj�td�t|�|
f�d}tdtt|�|��D]B}�||���d�ddd�}|jj�d|||f��q"t|�|dk�r�|jj�d��|d���d�ddd�}|jj�d|d|f��fdd�|D�}��fdd��|�rt�fdd�|D��}nd}|�r|d��nd}d}|�r�t|d���}|��}t|dt|�d��Dd}t|�|k�rvd }t�|t|�f��|�|�}Wd�n1�s�0YWd�n1�s�0Yt|d!|d"��j��D|�r�� ||�|�r
��!||�t"|||||�Wd�n1�s 0YWd�n1�s@0Y|td#t��|d$d%�WnJt#�y�}z0|td&t��|d$t$�%|�d'��WYd}~n
d}~00W��rԈ�&�n��r҈�&�0dS)(Nr-)r,rYTr�r��bookprevnoder$�forcer�rs2cannot push more than one head to a scratch branch�sspushing %d commit%s:
�
r�
�2s    %s  %s
s    ...
r�csg|]}�|�qSr+r+�rr�r(r+r-r�r$zstorebundle.<locals>.<listcomp>cst���|����Sr[)r�r�r)r�)r�rQr+r-r.�r$zstorebundle.<locals>.<lambda>c3s|]}�|�VqdSr[r+rc)�inindexr+r-�	<genexpr>�r$zstorebundle.<locals>.<genexpr>r�sbundlestore)Z
bundlesizei@s7bundle is too big: %d bytes. max allowed size is 100 MBsindex)�
newheadscountr.r/r0r2r3)'rBr4r�rSrOrQr0r;r$r�rr�r4r�r�r�rLrr2rr+�warn�range�min�descriptionr<�sumrrr�r8rQZ	addbundleZaddbookmark�_maybeaddpushbackpartr�r	r�r�)r!rrr�r@Zparthandlerstartr0r�r�Zbookprevnoder*r)r�r��pluralZ	maxoutput�i�	firstlineZnodesctxrfZbookmarknoder�r�Z
bundledataZbundlesizelimitZ	error_msgr7r+)r�rQrdr-rR�s�




�""
��J
�D�
�
�rR)r�r]r^�pushbackbookmarksrXc
Cs2t�|jj�}|j�dd�}tjd|��d�}|�d|�|�	|�t
�|���}t
��\}}z�z&t�|d�}|�|���W|��n
|��0t||j|�Wzt�|�Wn2ty�}	z|	jtjkr΂WYd}	~	n
d}	~	00nHzt�|�Wn6t�y*}	z|	jtjk�r�WYd}	~	n
d}	~	000dS)	z9unbundle a bundle2 part containing a changegroup to storerXr�r�r�r�rHNr)rrIrSr4rrr�r�r�r�r�rr�rNrrOr�rPrQr�rRr�r��errno�ENOENT)
r!r�r�r\r�rTrUr�rVr7r+r+r-�bundle2scratchbranchs0

�rscCsD|�d�r@|jr@d|jjvr@d|||d�}|jjdt�|�d�dS)Nrpspushbackr�)r�rqsnewsoldrg)Zmandatoryparams)r�rL�capabilitiesr�rr�)r!r�Znewnoder)rrr+r+r-rl&s
�
�rlcCsX|jtdrN|jdurJ|j�d�}|jdt|j�dd�|jdddd�d	S|||�S)
z�Wrapper of bundle2.handlepushkey()

    The only goal is to skip calling the original function if flag is set.
    It's set if infinitepush push is happening.
    rYNr[rDFrErFrGr)r;r�rLr�r�r�rM)r�r!r�rSr+r+r-rh4s
rhcCs|jtdrdS|||�S)z�Wrapper of bundle2.handlephases()

    The only goal is to skip calling the original function if flag is set.
    It's set if infinitepush push is happening.
    rZN)r;r�)r�r!r�r+r+r-rnDsrnc	Cs�d}t|�|krdSg}|D]}|�d�|�|�qttjd��D}t��dd|g|}tjt	�
tj|�dd|||d	�Wd�n1s�0YdS)
z�starts a separate process that fills metadata for the nodes

    This function creates a separate process and doesn't wait for it's
    completion. This was done to avoid slowing down pushes
    rbNs--nodesw+bsdebugfillinfinitepushmetadatas-RTF)Z	close_fds�shell�stdin�stdout�stderr)
rLr|rr��devnullrZhgexecutable�
subprocess�PopenrZrapplyrZtonativestr)r�rZmaxnodesZ	nodesargsr�ryZcmdliner+r+r-�_asyncsavemetadataQs.
���r|)N)NN)r�)o�__doc__Z
__future__rr�
contextlibrqr>rDr�r<�rer=rzr4Zmercurial.noderrZmercurial.i18nrZmercurial.pycompatrrZmercurial.utilsrr	r
Z	mercurialrrr
rrrrrrrrrrrrrrrr3rrZ
testedwithZconfigtableZ
configitemr�rr�r�ZrevsetpredicateZtemplatekeywordrd�compile�searchZ
_maybehashr6rCr=rN�objectrOrZr]rar^r_r`r~rbruZ	batchablerr�r�r�r�r�r�rwrvr}r�r�r�r�r{rrrZb2partsgeneratorr'rtr+�contextmanagerr8rBrWrxrRZparthandlerrsrlrhrnr|r+r+r+r-�<module>sSP	
�����������


'
^
F8+

"
7``�



Youez - 2016 - github.com/yon3zu
LinuXploit