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: //proc/self/root/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyc
�
1�3\c@@s�dZddlmZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZm
Z
mZmZmZmZmZmZmZmZmZdZedZd	Zd
d�Zd�Zd
�Zed�Zd�Z d�Z!dejfd��YZ"e#d�Z$d�Z%ddd�Z'e(d�Z)e(d�Z*d�Z+d�Z,d�Z-d�Z.d�Z/d�Z0dd�Z1d�Z2d �Z3d!�Z4d"�Z5d#�Z6d$�Z7d%�Z8d&�Z9d'�Z:d(�Z;d)�Z<d*�Z=d+�Z>d,�Z?d-�Z@d.eAfd/��YZBd0�ZCd1�ZDd2�ZEd3�ZFd4�ZGd5�ZHd6eIfd7��YZJdd8�ZKdS(9sGlargefiles utility code: must not import other modules in this package.i(tabsolute_importN(t_(thex(tdirstatetencodingterrorthttpconnectiontmatchtnodetpycompattscmutiltsparsetutiltvfss.hglft/t
largefilesi
cC@s�|}|r.|r.|jtdd|�}n|rtyt|�}Wqttk
rptjtd�|��qtXn|dkr�tjtd���n|S(Ntminsizetdefaults)largefiles: size must be number (not %s)
s-minimum size for largefiles must be specified(tconfigtlongnametfloatt
ValueErrorRtAbortRtNone(tuitassumelfilestoptRtlfsize((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyt
getminsize(s

cC@s�tjtjj|��ytj||�Wn�tk
r�t|d��F}tj|��.}x$tj	|�D]}|j
|�qqWWdQXWdQXtj|tj|�j
�nXdS(s@Try to create hardlink - if that fails, efficiently make a copy.trbN(RtmakedirstostpathtdirnametoslinktOSErrortopentatomictempfilet
filechunkitertwritetchmodtstattst_mode(tsrctdesttsrcftdstftchunk((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pytlink6s
cC@stjjt|�|�S(s�Return the correct location in the "global" largefiles cache for a file
    with the given hash.
    This cache is used for sharing of largefiles across repositories - both
    to preserve download bandwidth and storage space.(RR tjoint
_usercachedir(Rthash((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyt
usercachepathBscC@s=|j|d�}|r|Stjrbtjjdtjjd��}|r tjj||�Sn�tj	r�tjjd�}|r tjj|dd|�Sn�tj
rtjjd�}|r�tjj||�Stjjd�}|r tjj|d|�Sntjt
d	�tj��tjt
d
�|��dS(s5Return the location of the "global" largefiles cache.t	usercachetLOCALAPPDATAtAPPDATAtHOMEtLibrarytCachestXDG_CACHE_HOMEs.cachesunknown operating system: %s
sunknown %s usercache locationN(t
configpathR	t	iswindowsRtenvirontgetRR R1tisdarwintisposixRRRtosname(RtnameR tappdatathome((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyR2Is,			
cC@st||�}tjj|�S(N(R4RR texists(RR3R ((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pytinusercachecscC@s�t||�\}}|r9|jjtd�|�|St|j|�r�|jjtd�|�t||�}tt|j|�|�|SdS(s�Return store path of the largefile with the specified hash.
    As a side effect, the file might be linked from user cache.
    Return None if the file can't be found locally.sfound %s in store
sfound %s in system cache
N(	t
findstorepathRtnoteRRGt	storepathR0R4R(trepoR3R RF((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pytfindfilegstlargefilesdirstatecB@s\eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	e
d�ZRS(	cC@stt|�jt|��S(N(tsuperRMt__getitem__tunixpath(tselftkey((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyROwscC@stt|�jt|��S(N(RNRMtnormalRP(RQtf((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyRSyscC@stt|�jt|��S(N(RNRMtremoveRP(RQRT((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyRU{scC@stt|�jt|��S(N(RNRMtaddRP(RQRT((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyRV}scC@stt|�jt|��S(N(RNRMtdropRP(RQRT((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyRWscC@stt|�jt|��S(N(RNRMtforgetRP(RQRT((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyRX�scC@stt|�jt|��S(N(RNRMtnormallookupRP(RQRT((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyRY�scC@stS(N(tFalse(RQRT((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyt_ignore�scC@stt|�jd�dS(N(RNRMR'R(RQttr((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyR'�s(t__name__t
__module__RORSRURVRWRXRYR[RZR'(((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyRMvs								c@s��j}t}tj|j|��}t||�j�jj�fd��}|r�|j|j|d��r�t	��}�jj
|dgdtdt�}t|�dkr�|j
|�nx*|D]}	t|	�}
|j|
�q�Wn|S(s�
    Return a dirstate object that tracks largefiles: i.e. its root is
    the repo root, but it is saved in .hg/largefiles/dirstate.
    c@s
tj��S(N(Rtmatcher((RK(s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyt<lambda>�tRtsubrepostunknowntignoredi(R
RtvfsmodR1RMtrootRt	_validateRFtgetstandinmatchertwalkRZtlenRtsplitstandinRY(RRKtcreateR
t
lfstoredirtopenert
lfdirstateR_tstandinststandintlfile((RKs=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pytopenlfdirstate�s 		"	
c

C@s�|d}tj|j|j��}|j|dgdtdtdt�\}}|j|j}}x�|D]�}y|t|�}	Wnt	k
r�d}	nX|	s�t|	�t|j
|��kr�|j|�ql|j|�|j|�qlW|S(Nt.RbRdtcleanRc(tmatchmodtalwaysRftgetcwdtstatusRZtmodifiedRuRqtLookupErrorRt
readasstandinthashfiletwjointappendRS(
RoRKtpctxRtunsuretsRzRuRrtfctx((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pytlfdirstatestatus�s



(
cC@sd|dkrt|�}ng||j|�D]1}|dk	sT|j|dkr/t|�^q/S(sNreturn a list of largefiles in the working copy or the
    specified changesett?N(RRhRiRRk(RKtrevR_RT((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyt
listlfiles�s
cC@stjjt|||��S(sBReturn true if a largefile with the given hash exists in the store(RR RFRJ(RKR3t
forcelocal((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pytinstore�scC@s?|r,|j�r,|jj|jt|�S|jjt|�S(sbReturn the correct location in the repository largefiles store for a
    file with the given hash.(tsharedR
treljoint
sharedpathRR1(RKR3R�((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyRJ�scC@sit||t�}t||�r+|tfS|j�r_t||t�r_t||t�tfS|tfS(s�Search through the local store path(s) to find the file for the given
    hash.  If the file is not found, its path in the primary store is returned.
    The return value is a tuple of (path, exists(path)).
    (RJRZR�tTrueR�(RKR3R ((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyRH�s
cC@s�|j}t||�}|dkr(tS|j|j|j|���t|d��7}||d��}tt	j
|�|�}WdQXWdQX||kr�|jjt
d�|||f�|j|�tStS(s.Copy the specified largefile from the repo or system cache to
    filename in the repository. Return true on success or false if the
    file was not found in either cache (which should not happened:
    this is meant to be called only after ensuring that the needed
    largefile exists in the cache).RtwbNs'%s: data corruption in %s with hash %s
(twvfsRLRRZRR!R1R$tcopyandhashRR&RtwarnRtunlinkR�(RKR3tfilenameR�R tsrcfdtdestfdtgothash((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyt
copyfromcache�s	!
cC@s{|j}t||�}t||�r,dS|j|�rWt||j|�|�n |jjtd�||f�dS(Ns0%s: largefile %s not available from local store
(	R�R|R�RFtcopytostoreabsoluteR1RR�R(RKtctxtfiletfstandinR�R3((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pytcopytostore�s	cC@se||}xT|j�D]F}t|�}|dk	r||j�krt||||�qqWdS(s4Copy all largefiles in a given revision to the storeN(tfilesRkRtmanifestR�(RKRR�R�trealfile((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pytcopyalltostores

cC@s�t|j|�r7tt|j|�t||��n�tjtjj	t||���t
|d��[}tjt||�d|jj
��.}x$tj|�D]}|j|�q�WWdQXWdQXt||�dS(NRt
createmode(RGRR0R4RJRRRR R!R$R%tstoreR�R&R'tlinktousercache(RKR�R3R-R.R/((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyR�s%"cC@s,t|j|�}tt||�|�dS(sRLink / copy the largefile with the specified hash from the store
    to the cache.N(R4RR0RJ(RKR3R ((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyR�scC@s�|j}t}d�}|r�|j�r�g|j�D]}|j||�^q8}|sq|j|�g}ntj|d|d|�}n(tj|d|j|�gd|�}|S(sDReturn a match object that applies rmatcher to the standin directorycS@sdS(N(R(RTtmsg((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyR`&RatbadfnN(R�t	shortnameRwR�R1R
RR(RKtrmatcherR�t
standindirR�tpattpatsR((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyRh s		+(c@s7t|��}|j���fd�}||_|S(s�Return a matcher that accepts standins corresponding to the
    files accepted by rmatcher. Pass the list of files in the matcher
    as the paths specified by the user.c@s�|�o�jt|��S(N(tmatchfnRk(RT(t	isstandinR�(s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pytcomposedmatchfn8s(RhR�(RKR�tsmatcherR�((R�R�s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pytcomposestandinmatcher2s
		cC@sttj|�S(sLReturn the repo-relative path to the standin for the specified big
    file.(tshortnameslashRtpconvert(R�((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyRq>s
cC@s
|jt�S(ssReturn true if filename is a big file standin. filename must be
    in Mercurial's internal form (slash-separated).(t
startswithR�(R�((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyR�JscC@sMtj|�jdd�}t|�dkrE|dtkrE|dSdSdS(NRiii(RR�tsplitRjR�R(R�tbits((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyRkOs"cC@sl|j|�}|jj|�rOt|�}t|�}t||||�ntjtd�|��dS(s�Re-calculate hash value of lfile and write it into standin

    This assumes that "lfutil.standin(lfile) == standin", for efficiency.
    s%s: file not found!N(	R~R�RFR}t
getexecutabletwritestandinRRR(RKRrRqR�R3t
executable((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyt
updatestandinYscC@s|j�j�S(sxread hex hash from given filectx of standin file

    This encapsulates how "standin" data is stored into storage layer.(tdatatstrip(R�((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyR|fscC@s'|j||d|rdpd�dS(s#write hash to <repo.root>/<standin>s
txRaN(twwrite(RKRqR3R�((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyR�lscC@sJtjd�}x(|D] }|j|�|j|�qWt|j��S(s�Read bytes from instream (iterable) and write them to outfile,
    computing the SHA-1 hash of the data along the way. Return the hash.Ra(thashlibtsha1tupdateR'Rtdigest(tinstreamtoutfilethasherR�((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyR�ps


cC@s<tjj|�sdSt|d��}t|�SWdQXdS(NRaR(RR RFR$thexsha1(R�tfd((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyR}yscC@s7tj|�j}|tj@o6|tj@o6|tj@S(N(RR)R*tS_IXUSRtS_IXGRPtS_IXOTH(R�tmode((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyR�s

cG@s<d�}|||�}x|D]}|||�}qW|S(NcS@s@|jd�s|d7}n|jd�r8|d}n||S(NRi(tendswithR�(tlefttright((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyR1�s


((tfirsttsecondtargR1turlta((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyturljoin�s
	
cC@sCtj�}x$tj|�D]}|j|�qWt|j��S(sUhexsha1 returns the hex-encoded sha1 sum of the data in the file-like
    object data(R�R�RR&R�RR�(tfileobjthR/((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyR��scC@stj||d�S(NR(Rthttpsendfile(RR�((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyR��scC@stjtjj|��S(s@Return a version of path normalized for use with the lfdirstate.(RR�RR tnormpath(R ((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyRP�scC@sKd|jkr2td�|jj�D��r2tStt|j|t��S(s,Return true if the repo is a largefile repo.Rcs@s|]}t|dkVqdS(iN(R�(t.0RT((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pys	<genexpr>�s(trequirementstanyR�t	datafilesR�RsRRZ(RK((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pytislfilesrepo�ststoreprotonotcapablecB@seZd�ZRS(cC@s
||_dS(N(t
storetypes(RQR�((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyt__init__�s(R]R^R�(((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyR��scC@s�g}t|�}|d}xy|jj|dgdtdt�D]S}t|�}yt||�}Wntk
r�d}nX|j||f�qAW|S(NRbRcRd(	RhRRRiRZRkR|tIOErrorR(RKRpR_twctxRqRrR3((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pytgetstandinsstate�s



cC@st|�}||jkrC|jj|}|d|d}}nd	\}}|dkr�|s�|dks�|jj|�r�|j|�q|j|�np|dkr�|j|�nT|dkr�|j|�n8|dkr�|j|�n|dkr|j	|�ndS(
NiiR�i����tntmtrR�(R�i����(
RqRt_mapR�RFRYRSRURVRW(RKRoRrRYt	lfstandinR)tstatetmtime((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pytsynclfdirstate�s$cC@s�|j�}||�t|j|�}xB|j�D]4}t|�}|dk	r5t|||t�q5q5W|j�t	||�dS(N(
RKRsRR�RkRR�RZR'R�(torigR�RRKRoRTRr((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyt
markcommitted�s

cC@sZt|�jt|��}g}x2|D]*}|d|kr(|j|d�q(q(W|S(Ni(tsettsymmetric_differenceR(toldstandinstnewstandinstchangedstandinstfilelistRT((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pytgetlfilestoupdate�s
cC@s!|jj}|td�dtd�dt|����}x�t|�D]�\}}|j|�g||j�D]}|tjkrp|^qp}|j	}	t
|_	z||}
Wd|	|_	Xt|
j��}t|�dkr�|
j
�}|
j�dj
�}
|
j�dj
�}x*|
D]"}||kr!|j|�q!q!Wx*|D]"}||krN|j|�qNqNWxY|D]N}|||
j|d�ks�|||j|d�kr{|j|�q{q{Wnx@|D]8}t|�r�||
kr�||t|
|��q�q�WqFWWdQXdS(Nsfinding outgoing largefilestunitt	revisionsttotaliii(RtmakeprogressRRjt	enumerateR�tparentsRtnullidtlfstatusRZR�R�R�RVR?RR�R|(RKtmissingtaddfuncR�tprogresstiR�tpR�toldlfstatusR�R�tmctmp1tmp2RTtfn((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pytgetlfilestoupload�s8
2		



8
c
@s�|j}|dks!|j�r	t||�}tj|j|j��}|j|dgdtdtdt�\}}||j	|j
|j}t|��xc�D][}||kr�t
|�}	|jj|	�r|jj|�r�t|||	�q�qq�q�W|St|��|j|j���|_t||�}
|jj|
dgdtdt���sm|St||�}x=�D]5}	t|	�}||dkr�t|||	�q�q�Wtj|�}|j�|jt��7_g}x�|jD]�}t
|�}	|�ks#|	�krn|j|	dkrR|j|dkrkq�qkqn|j|dkrnq�qnn|j|�q�W||_���fd�}
|
|_|S(	s�Update standins in the working directory according to specified match

    This returns (possibly modified) ``match`` object to be used for
    subsequent commit process.
    RbRdRuRcR�R�c@s$�|�r|�kS|�kSdS(N((RT(tlfilestorigmatchfnRp(s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyR�us
N(RRRwRsRvRfRxRyRZRztaddedtremovedR�RqR�RFR�t
_subdirlfsR�t_filesR�RRiRktcopyR�tsortedR(RKRRRot
dirtymatchR�R�t
modifiedfilesRrR�R�tactualfilesRTR�((RRRps=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pytupdatestandinsbymatchsX	
	
					tautomatedcommithookcB@s eZdZd�Zd�ZRS(s�Stateful hook to update standins at the 1st commit of resuming

    For efficiency, updating standins in the working directory should
    be avoided while automated committing (like rebase, transplant and
    so on), because they should be updated before committing.

    But the 1st commit of resuming automated committing (e.g. ``rebase
    --continue``) should update them, because largefiles may be
    modified manually.
    cC@s
||_dS(N(tresuming(RQR((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyR��scC@s'|jrt|_t||�S|SdS(N(RRZR(RQRKR((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyt__call__�s		
(R]R^t__doc__R�R(((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyRs
	cC@sA|dkr)tj|d�r)|jdS|r6|jSd�SdS(s)Return the function to write largefiles specific status out

    If ``forcibly`` is ``None``, this returns the last element of
    ``repo._lfstatuswriters`` as "default" writer function.

    Otherwise, this returns the function to always write out (or
    ignore if ``not forcibly``) status.
    t_largefilesenabledi����c_@sdS(N(R(R�topts((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyR`�RaN(RRtsafehasattrt_lfstatuswritersRy(RRKtforcibly((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pytgetstatuswriter�s
	(LRt
__future__RRR�RR)tmercurial.i18nRtmercurial.nodeRt	mercurialRRRRRRvRR	R
RRR
ReR�R�RRR0R4R2RGRLRMR�RsR�RR�RZR�RJRHR�R�R�R�R�RhR�RqR�RkR�R|R�R�R}R�R�R�R�RPR�t	ExceptionR�R�R�R�R�RRtobjectRR(((s=/usr/lib64/python2.7/site-packages/hgext/largefiles/lfutil.pyt<module>	slL
																
	
							
									!	g