Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/site-packages/hgext/largefiles/basestore.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


��c@s�dZddlZddlmZmZmZddlmZddlZde	fd��YZ
defd��YZddl
Z
ddlZie
j
gd	6ejgd
6ejgd6ejgd6Zejd
�Zded�ZdS(sCbase class for store implementations and store-related utility codei�N(tutiltnodethg(t_t
StoreErrorcBs)eZdZd�Zd�Zd�ZRS(sZRaised when there is a problem getting files from or putting
    files to a central store.cCs(||_||_||_||_dS(N(tfilenamethashturltdetail(tselfRRRR((s>/sys/lib/python2.7/site-packages/hgext/largefiles/basestore.pyt__init__s			cCs&td�|j|j|j|jfS(Ns0error getting id %s from url %s for file %s: %s
(RRRRR(R	((s>/sys/lib/python2.7/site-packages/hgext/largefiles/basestore.pytlongmessages	cCsd|j|jfS(Ns%s: %s(RR(R	((s>/sys/lib/python2.7/site-packages/hgext/largefiles/basestore.pyt__str__s(t__name__t
__module__t__doc__R
RR(((s>/sys/lib/python2.7/site-packages/hgext/largefiles/basestore.pyRs		t	basestorecBsJeZd�Zd�Zd�Zd�Zed�Zd�Zd�Z	RS(cCs||_||_||_dS(N(tuitrepoR(R	RRR((s>/sys/lib/python2.7/site-packages/hgext/largefiles/basestore.pyR
#s		cCstd��dS(s>Put source file into the store so it can be retrieved by hash.sabstract methodN(tNotImplementedError(R	tsourceR((s>/sys/lib/python2.7/site-packages/hgext/largefiles/basestore.pytput(scCstd��dS(s�Check to see if the store contains the given hashes. Given an
        iterable of hashes it returns a mapping from hash to bool.sabstract methodN(R(R	thashes((s>/sys/lib/python2.7/site-packages/hgext/largefiles/basestore.pytexists,sc
	CsCg}g}|j}tjtj|jd��d}|jtd�|D���}x�|D]�\}}|jt	d�|dddt
|��|d7}|jt	d	�||f�|j|�s�j
t	d
�|||jf�|j|�q]ntj|j|�}	tj|	dd|jjj�}
y|j|
||�}Wn,tk
r{}|j
|j��d}nX|
j�||kr�dkr�|j
t	d
�|||f�ntj|	d�|j|�q]ntj|	d|	�tj|j|�|j||f�q]W|jt	d�d�||fS(s�Get the specified largefiles from the store and write to local
        files under repo.root.  files is a list of (filename, hash)
        tuples.  Return (success, missing), lists of files successfully
        downloaded and those not found in the store.  success is a list
        of (filename, hash) tuples; missing is a list of filenames that
        we could not get.  (The detailed error message will already have
        been presented to the user, so missing is just supplied as a
        summary.)ticss|]\}}|VqdS(N((t.0t	_filenameR((s>/sys/lib/python2.7/site-packages/hgext/largefiles/basestore.pys	<genexpr>Assgetting largefilestunittlfilettotalisgetting %s:%s
s'%s: largefile %s not available from %s
s.tmpt
createmodes*%s: data corruption (expected %s, got %s)
N(RRtmakedirstlfutilt	storepathRRtsettprogressRtlentnotetgettwarnRtappendtatomictempfiletstoreRt_getfileRRtclosetunlinktrenametlinktousercachetNone(
R	tfilestsuccesstmissingRtatt	availableRRt
storefilenamettmpfilethhashterr((s>/sys/lib/python2.7/site-packages/hgext/largefiles/basestore.pyR&1sJ		





c
Cs1t}|jjtd�t|��t�}xu|D]m}|j|}d|j�tj	|j��f}x2|D]*}|j
|||||�rut}ququWq6Wt|�}	ttg|D]\}
}|
^q���}|r|jjtd�|	|f�n |jjtd�|	|f�t|�S(s�Verify the existence (and, optionally, contents) of every big
        file revision referenced by every changeset in revs.
        Return 0 if all is well, non-zero on any errors.s'searching %d changesets for largefiles
s%d:%ss3verified contents of %d revisions of %d largefiles
s4verified existence of %d revisions of %d largefiles
(
tFalseRtstatusRR$R"RtrevRtshortt_verifyfiletTruetint(
R	trevstcontentstfailedtverifiedR<tcctxtcsettstandintnumrevstfnametfnodet	numlfiles((s>/sys/lib/python2.7/site-packages/hgext/largefiles/basestore.pytverifyhs(	

%
+				cCstd��dS(sFetch one revision of one file from the store and write it
        to tmpfile.  Compute the hash of the file on-the-fly as it
        downloads and return the hash.  Close tmpfile.  Raise
        StoreError if unable to download the file (e.g. it does not
        exist in the store).sabstract methodN(R(R	R7RR((s>/sys/lib/python2.7/site-packages/hgext/largefiles/basestore.pyR+�scCstd��dS(spPerform the actual verification of a file in the store.
        'cset' is only used in warnings.
        'contents' controls verification of content hash.
        'standin' is the standin path of the largefile to verify.
        'verified' is maintained as a set of already verified files.
        Returns _true_ if it is a standin and any problems are found!
        sabstract methodN(R(R	RERFRBRGRD((s>/sys/lib/python2.7/site-packages/hgext/largefiles/basestore.pyR>�s(
R
RR
RRR&R:RLR+R>(((s>/sys/lib/python2.7/site-packages/hgext/largefiles/basestore.pyR"s				7	tfilethttpthttpstsshs^([a-zA-Z0-9+-.]+)://c	Cs�|j}|s�t|dd�}|r9|j|�}n|jdd�}|dksc|dkrrd}|}q�tj|�\}}tj|i|�}ntj|d�r�|j	�p�|j
}tj|�}|s�}n|j
d�}yt|}	Wn*tk
r-tjtd�|��nXx9|	D]1}
y|
|||�SWq5tjk
req5Xq5Wtjtd	�|��dS(
Ntlfpullsourcesdefault-pushtdefaultRRRMisunsupported URL scheme %rs*%s does not appear to be a largefile store(RtgetattrR0t
expandpathRtparseurltpeerRtsafehasattrRtpatht
_scheme_retmatchtgroupt_storeprovidertKeyErrortAbortRR tstoreprotonotcapable(RtremoteRRRQRXt	_branchesRZtschemetstoreproviderstclassobj((s>/sys/lib/python2.7/site-packages/hgext/largefiles/basestore.pyt
_openstore�s4		'	

(Rtret	mercurialRRRtmercurial.i18nRR t	ExceptionRtobjectRt
localstoret	wirestoreR\tcompileRYR0R:Re(((s>/sys/lib/python2.7/site-packages/hgext/largefiles/basestore.pyt<module>	sv




Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.