HEX
Server: Apache
System: Linux p102.lithium.hosting 4.18.0-553.141.1.el8_10.x86_64 #1 SMP Fri Jul 10 17:48:02 UTC 2026 x86_64
User: bvzmoamr (9955)
PHP: 8.1.34
Disabled: syslog
Upload Files
File: //lib64/python2.7/site-packages/hgext/lfs/blobstore.pyc
�
1�3\c@@s�ddlmZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZmZm
Z
mZmZmZmZddlmZejd�Zdejfd	��YZd
efd��YZdefd
��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZ ied6ed6ed6ed6e d6Z"d�Z#d�Z$dd�Z%dej&fd ��YZ'd!ej(fd"��YZ)dS(#i(tabsolute_importN(t_(terrortpathutiltpycompatturltutiltvfstworkeri(tlfutils\A[a-f0-9]{64}\ZtlfsvfscB@s eZd�Zddd�ZRS(cC@sItj|�s%tjd|��ntt|�j|dd!|d�S(s9split the path at first two characters, like: XX/XXXXX...sunexpected lfs path: %sii(t_lfsretmatchRtProgrammingErrortsuperR
tjoin(tselftpath((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR#sc
c@s�tjj|j�}ttj|��}g}x�tj|j|j|pNd�d|�D]e\}}}||}t|�dkr[|j	g|D]#}	t
j||	�r�||	^q��q[q[Wdg|fVdS(s�Yield (dirpath, [], oids) tuple for blobs under path

        Oids only exist in the root of this vfs, so dirpath is always ''.
        ttonerroriN(tosRtnormpathtbasetlenRtnormasprefixtwalktreljointextendRR(
RRRtroott	prefixlentoidstdirpathtdirstfilestf((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR)s$
+N(t__name__t
__module__RtNoneR(((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR
"s	tnullvfscB@s;eZd�Zd�Zd�Zddd�Zd�ZRS(cC@sdS(N((R((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyt__init__@scC@stS(N(tFalse(Rtoid((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pytexistsCscC@sttjd|��dS(Ns%s: No such file or directory(tIOErrorterrnotENOENT(RR)((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pytreadFscC@s
dggfS(NR((RRR((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyRMscC@sdS(N((RR)tdata((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pytwritePsN(R#R$R'R*R.R%RR0(((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR&?s
			tfilewithprogresscB@s)eZdZd�Zd�Zd�ZRS(s�a file-like object that supports __len__ and read.

    Useful to provide progress information for how many bytes are read.
    cC@sE||_||_|jdtj�|j�|_|jd�dS(Ni(t_fpt	_callbacktseekRtSEEK_ENDttellt_len(Rtfptcallback((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR'Ys
		cC@s|jS(N(R7(R((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyt__len__`scC@sg|jdkrdS|jj|�}|rM|jrc|jt|��qcn|jj�d|_|S(NR(R2R%R.R3Rtclose(RtsizeR/((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR.cs	
	(R#R$t__doc__R'R:R.(((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR1Ss		tlocalcB@skeZdZd�Zd�Zd�Zd�Zd�Zd�Ze	d�Z
d�Zd	�Zd
�Z
RS(s�Local blobstore for large file contents.

    This blobstore is used both as a cache and as a staging area for large blobs
    to be uploaded to the remote blobstore.
    cC@sy|jjd�}t|�|_|jjdd�rEt�|_n$tj	|jd�}t|�|_|j|_dS(Nslfs/objectstexperimentalslfs.disableusercachetlfs(
tsvfsRR
Rtuit
configboolR&tcachevfsR	t
_usercachedir(Rtrepotfullpatht	usercache((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR'vscC@s2|jj|�r"|j|d�S|j|d�S(sgOpen a read-only file descriptor to the named blob, in either the
        usercache or the local store.trb(RDR*R(RR)((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pytopen�s	cC@s�tj�}|j|ddt��r}x7tj|dd�D] }|j|�|j|�q=W|j�}||kr�t	t
d�|��nWdQX|j|�dS(snRead the blob from the remote source in chunks, verify the content,
        and write to this local blobstore.twbt
atomictempR<iscorrupt remote lfs object: %sN(thashlibtsha256RtTrueRt
filechunkiterR0tupdatet	hexdigesttLfsCorruptionErrorRt_linktousercache(RR)tsrcRNR8tchunktrealoid((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pytdownload�s
cC@s?|j|ddt��}|j|�WdQX|j|�dS(s�Write blob to local blobstore.

        This should only be called from the filelog during a commit or similar.
        As such, there is no need to verify the data.  Imports from a remote
        store must use ``download()`` instead.RKRLN(RROR0RT(RR)R/R8((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR0�scC@sot|jt�rk|jj|�rk|jjtd�|�tj	|jj
|�|jj
|��ndS(s�Link blobs found in the user cache into this store.

        The server module needs to do this when it lets the client know not to
        upload the blob, to ensure it is always available in this store.
        Normally this is done implicitly when the client reads or writes the
        blob, but that doesn't happen when the server tells the client that it
        already has the blob.
        slfs: found %s in the usercache
N(t
isinstanceRDR&RR*RBtnoteRR	tlinkR(RR)((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pytlinkfromusercache�s	cC@so|jj|�rkt|jt�rk|jjtd�|�tj|j	j
|�|jj
|��ndS(Ns lfs: adding %s to the usercache
(RDR*RYR&RBRZRR	R[RR(RR)((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyRT�scC@s�|jj|�s�|j|j||�}|sKtj|�j�|kr�|jjt	d�|�t
j|jj|�|jj|��q�n2|jjt	d�|�|j|j||�}|S(sRead blob from local blobstore.slfs: found %s in the usercache
s%lfs: found %s in the local lfs store
(
RR*t_readRDRMRNRRRBRZRR	R[R(RR)tverifytblob((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR.�s!.cC@s)|j|�}|r%t||�n|S(s0Read blob (after verifying) from the given store(R.t_verify(RRR)R^R_((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR]�scC@satj�}|j|��4}x*tj|dd�D]}|j|�q4WWdQX||j�kS(sQIndicate whether or not the hash of the underlying file matches its
        name.R<iN(RMRNRJRRPRQRR(RR)RNR8RV((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR^�s
cC@s"|jj|�p!|jj|�S(sYReturns True if the local blobstore contains the requested blob,
        False otherwise.(RDR*R(RR)((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pythas�s(R#R$R=R'RJRXR0R\RTROR.R]R^Ra(((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR>os								t
_gitlfsremotecB@sYeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(	cC@s�|j}||_|j�\}}|jd�|_|jjdd�}|sddtj�}ntj|||�|_	|j
dd�|_dS(Nt/R?slfs.user-agentsgit-lfs/2.3.4 (Mercurial %s)R@tretry(RBtauthinfotrstriptbaseurltconfigRtversionturlmodtopenert	urlopenert	configintRd(RRFRRBRgRet	useragent((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR'�s		cC@s|jt|�|d�dS(s,Batch upload from local to remote blobstore.tuploadN(t_batcht_deduplicate(Rtpointerst	fromstore((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyt
writebatch�scC@s|jt|�|d�dS(s-Batch download from remote to local blostore.RXN(RpRq(RRrttostore((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyt	readbatch�sc
C@s�g|D]&}i|j�d6|j�d6^q}tji|d6|d6�}tjjd|jd|�}|jdd�|jd	d�y"|j	j
|�}|j�}Wn5tjj
k
r�}	ttd
�|	|f��nXytj|�}
Wn'tk
r%ttd�|��nX|jjr�|jjd|j�|jjd
djtt|j��j����d|
kr�t|
ddd��|
d<n|jjd
tj|
dddddt��n|
S(s�Get metadata about objects pointed by pointers for given action

        Return decoded JSON object like {'objects': [{'oid': '', 'size': 1}]}
        See https://github.com/git-lfs/git-lfs/blob/master/docs/api/batch.md
        R)R<tobjectst	operations%s/objects/batchR/tAcceptsapplication/vnd.git-lfs+jsonsContent-TypesLFS HTTP error: %s (action=%s)s#LFS server returns invalid JSON: %ssStatus: %d
s%s
s
tkeycS@s|dS(NR)((tp((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyt<lambda>"Rtindentit
separatorsRs: t	sort_keys(Rs: (R)R<tjsontdumpsRturlreqtrequestRgt
add_headerRlRJR.turlerrt	httperrortLfsRemoteErrorRtloadst
ValueErrorRBt	debugflagtdebugtstatusRtsortedtstrtinfot
splitlinesRO(RRrtactionR{Rwtrequestdatatbatchreqtrsptrawjsontextresponse((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyt
_batchrequest�s<3	
	
)
cC@sx|D]}d|krL|dkr||jdg�krd}qgqn|jd�jdd�}d�|D�}|j|dd�}|r�t|d	d
�}idd6dd
6dd6dd6}	|	j|d|�}
ttd�||
f��qttd�|d��qWdS(sUScans errors from objects

        Raises LfsRemoteError if any objects have an errorRRXtactionsi�tcodei�cS@si|]}||j��qS((R)(t.0R{((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pys
<dictcomp>=s	R)tfilenametunknownsThe object does not exists#The object was removed by the owneri�sValidation errori�sInternal server errorsstatus code %dsLFS server error for "%s": %ss1LFS server error. Unsolicited response for oid %sN(tgetR%tgetattrR�R(RRrt	responsesR�R�R�tptrmapR{R�terrorstmsg((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyt_checkforservererror)s,
	
	cC@sZ|jdg�}|j|||�g|D]$}||jdg�kr,|^q,}|S(s�extract objects from response of the batch API

        response: parsed JSON object returned by batch API
        return response['objects'] filtered by action
        raise if any object has an error
        RwR�(R�R�(RR�RrR�Rwtotfilteredobjects((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyt_extractobjectsOs1cC@s`tj|d�}tj|d|jd��}|d|jdi�j�}tjj|�}|dkr�|j|�s�tj	t
d�|dt
d���nt|j|�d�|_d	�|_|jd
d�nx$|D]\}}	|j||	�q�Wd}
y�|jj|�}|jjr|jjd
|j�|jjddjtt|j��j����n|dkr�|j||�nSx-tr�|jd�}|s�Pn|
|7}
q�W|
r�|jjd||
f�nWngtjjk
r[}
|jjr9|jjd||
j�f�nt t
d�|
||f��nXdS(sCDownload or upload a single object using basic transfer protocol

        obj: dict, an object description returned by batch API
        action: string, one of ['upload', 'download']
        localstore: blobstore.local

        See https://github.com/git-lfs/git-lfs/blob/master/docs/api/        basic-transfers.md
        R)R�threftheaderRosdetected corrupt lfs object: %sthints
run hg verifycS@sdS(NtPUT((((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR|vRsContent-Typesapplication/octet-streamRsStatus: %d
s%s
s
RXislfs %s response: %ss%s: %s
s"HTTP error: %s (oid=%s, action=%s)N(!RtbytestrR�titemsRR�R�R^RtAbortRR1RJR%R/t
get_methodR�RlRBR�R�R�RR�R�R�R�RXROR.R�R�R�(RtobjR�t
localstoreR)R�theadersR�tktvR�treqR/R�((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyt_basictransfer`sD
  ,	!#c	@s��dkr"tjd���n�j|��}�j||��}td�|D��}i}x-|D]%}|jdd�||jd�<qlWitd�d6td	�d6�}	t|�d
kr��jj	td�t|�t
j|�f�n���fd�}
�jjd
d�rWt
j
�jd|
dt|dd���}n|
t|dd���}�jj|	d|��v}|jd�d}
d}xS|D]K\}}|
||7}
|d
7}|j|
��jj	td�|�q�WWdQX|dkr��dkrF�jjtd�|t
j|
�f�q��dkr��jjtd�|t
j|
�f�q�ndS(NRoRXsinvalid Git-LFS action: %scs@s!|]}|jdd�VqdS(R<iN(R�(R�tx((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pys	<genexpr>�sR<iR)s
lfs uploadingslfs downloadingis&lfs: need to transfer %d objects (%s)
c3@s2x+|D]#}|jdd�}�jjr��dkrFtd�}n�dkratd�}n�jj||jd�tj|�f�n�j}x�tr)y,�j	|���d|jd�fVPWq�t
jk
r%}|dkr�jjtd	�||f�|d8}q�n�q�Xq�WqWdS(
NR<iRXslfs: downloading %s (%s)
Roslfs: uploading %s (%s)
R)is%lfs: failed: %r (remaining retry %d)
(R�RBtverboseRRZRt	bytecountRdROR�tsocketR(RVR�tobjsizeR�RdR�(R�R�R(s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyttransfer�s.
				
R?slfs.worker-enableg�������?RzcS@s
|jd�S(NR)(R�(R�((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR|�RcS@s
|jd�S(NR)(R�(R�((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR|�Rttotalslfs: processed: %s
slfs: uploaded %d files (%s)
slfs: downloaded %d files (%s)
(RoRX((RR
R�R�tsumR�RRRBRZRR�RCRR�tmakeprogressRQR�(RRrR�R�R�RwR�tsizesR�ttopicR�Rtprogresst	processedtblobst_oneR)((R�R�Rs9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyRp�sD
# 


$cC@sSt|dd�}|rOx4|jD]&}|j�t|dd���q"WndS(NRlt	close_allcS@sdS(N(R%(((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR|�R(R�R%thandlersR;(RRlth((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyt__del__�s

(R#R$R'RtRvR�R�R�R�RpR�(((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyRb�s				*	&		7	Bt_dummyremotecB@s)eZdZd�Zd�Zd�ZRS(s,Dummy store storing blobs to temp directory.cC@s+|jjd|j�}t|�|_dS(NR@(RRRR
(RRFRRG((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR'�scC@sjxct|�D]U}|j|j�dt�}|j|j�ddt��}|j|�WdQXq
WdS(NR^RKRL(RqR.R)RORR0(RRrRsR{tcontentR8((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyRt�s!cC@sRxKt|�D]=}|j|j�d��}|j|j�|�WdQXq
WdS(NRI(RqRR)RX(RRrRuR{R8((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyRv�s(R#R$R=R'RtRv(((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR��s		t_nullremotecB@s)eZdZd�Zd�Zd�ZRS(s&Null store storing blobs to /dev/null.cC@sdS(N((RRFR((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR'�scC@sdS(N((RRrRs((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyRt�scC@sdS(N((RRrRu((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyRv�s(R#R$R=R'RtRv(((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR��s		t
_promptremotecB@s8eZdZd�Zdd�Zdd�Zd�ZRS(s)Prompt user to set lfs.url when accessed.cC@sdS(N((RRFR((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR'scC@s|j�dS(N(t_prompt(RRrRsRB((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyRtscC@s|j�dS(N(R�(RRrRuRB((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyRvscC@stjtd���dS(Nslfs.url needs to be configured(RR�R(R((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR�sN(R#R$R=R'R%RtRvR�(((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR��s
	thttpsthttptfiletnullcC@s7tj�}x|D]}|||j�<qW|j�S(s0Remove any duplicate oids that exist in the list(RtsortdictR)tvalues(RrtreducedR{((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyRqs
cC@sJtj|�j�}||krFttd�|dtd���ndS(Nsdetected corrupt lfs object: %sR�s
run hg verify(RMRNRRRSR(R)R�RW((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR`scC@sW|jjdd�}tj|p$d�}|dkr|rE|}n9tj|d�rc|j}n|jjdd�p{d}tj|�}|jdkr|jr�|jd	 d
kr�|jd
7_n|jp�dd|_tjt	|��}|jj
td�|�qn|j}|tkrFt
jtd
�|��nt|||�S(s�remotestore factory. return a store in _storemap depending on config

    If ``lfs.url`` is specified, use that remote endpoint.  Otherwise, try to
    infer the endpoint, based on the remote repository using the same path
    adjustments as git.  As an extension, 'http' is supported as well so that
    ``hg serve`` works out of the box.

    https://github.com/git-lfs/git-lfs/blob/master/docs/api/server-discovery.md
    R@RRt_subtoppathtpathstdefaultR�R�i����Rcs
.git/info/lfsslfs: assuming remote store: %s
slfs: unknown url scheme: %sN(R�R�(RBRhRRR%tsafehasattrR�tschemeRtbytesRZRt	_storemapRR�(RFtremotetlfsurlRRt
defaulturlR�((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR�#s&
	 	R�cB@seZRS((R#R$(((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR�MsRScB@seZdZRS(s~Raised when a corrupt blob is detected, aborting an operation

    It exists to allow specialized handling on the server side.(R#R$R=(((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyRSPs(*t
__future__RR,RMR�RtreR�tmercurial.i18nRt	mercurialRRRRRjRRtvfsmodRt
largefilesR	tcompileRR
R&tobjectR1R>RbR�R�R�R%R�RqR`R�tStorageErrorR�R�RS(((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyt<module>s:4
{�
		*