\x89\x50\x4E\x47\x0D\x0A\x1A\x0A PNG  \x89\x50\x4E\x47\x0D\x0A\x1A\x0A  13\c@@sddlmZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z m Z m Z mZmZmZmZddlmZejdZdejfd YZd efd YZd efd YZdefdYZdefdYZdefdYZdefdYZdefdYZ ied6ed6ed6ed6e d6Z"dZ#dZ$ddZ%de j&fd YZ'd!e j(fd"YZ)dS(#i(tabsolute_importN(t_(terrortpathutiltpycompatturltutiltvfstworkeri(tlfutils\A[a-f0-9]{64}\ZtlfsvfscB@s eZdZdddZRS(cC@sItj|s%tjd|ntt|j|dd!|dS(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@stjj|j}ttj|}g}xtj|j|j|pNdd|D]e\}}}||}t|dkr[|j g|D]#} t j || r|| ^qq[q[Wdg|fVdS(sYield (dirpath, [], oids) tuple for blobs under path Oids only exist in the root of this vfs, so dirpath is always ''. ttonerroriN( tosRtnormpathtbasetlenRt normasprefixtwalktreljointextendR R ( 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;eZdZdZdZdddZdZRS(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)eZdZdZdZdZRS(sa file-like object that supports __len__ and read. Useful to provide progress information for how many bytes are read. cC@sE||_||_|jdtj|j|_|jddS(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|jjd|_|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@skeZdZdZdZdZdZdZdZe dZ dZ d Z d Z RS( sLocal 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||_|jjddrEt|_n$tj |jd}t||_|j|_dS(Ns lfs/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|dS|j|dS(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.pytopens cC@stj}|j|ddtr}x7tj|ddD] }|j||j|q=W|j}||krt 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.pytdownloads     cC@s?|j|ddt}|j|WdQX|j|dS(sWrite 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.pyR0scC@sot|jt rk|jj| rk|jjtd|tj |jj ||jj |ndS(sLink 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.pytlinkfromusercaches 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.pyRTscC@s|jj|s|j|j||}|sKtj|j|kr|jjt d|t j |jj ||jj |qn2|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|ddD]}|j|q4WWdQX||jkS(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.pythass(R#R$R=R'RJRXR0R\RTROR.R]R^Ra(((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR>os       t _gitlfsremotecB@sYeZdZdZdZdZdZdZdZdZ dZ 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||ddS(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 writebatchscC@s|jt||ddS(s-Batch download from remote to local blostore.RXN(RpRq(RRrttostore((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyt readbatchsc C@sg|D]&}i|jd6|jd6^q}tji|d6|d6}tjjd|jd|}|jdd|jd dy"|j j |}|j }Wn5tj j k r} ttd | |fnXytj|} Wn'tk r%ttd |nX|jjr|jjd |j|jjd djtt|jjd| krt| ddd| d"stindentit separatorsRs: t sort_keys(Rs: (R)R<tjsontdumpsRturlreqtrequestRgt add_headerRlRJR.turlerrt httperrortLfsRemoteErrorRtloadst ValueErrorRBt debugflagtdebugtstatusRtsortedtstrtinfot splitlinesRO( RRrtactionR{Rwt requestdatatbatchreqtrsptrawjsontextresponse((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyt _batchrequests<3        )   c C@sx|D]}d|krL|dkr||jdgkrd}qgqn|jdjdd}d|D}|j|dd}|rt|d d }id d6d d 6dd6dd6} | j|d|} ttd|| fqttd|dqWdS(sUScans errors from objects Raises LfsRemoteError if any objects have an errorRRXtactionsitcodeicS@si|]}||jqS((R)(t.0R{((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pys =s R)tfilenametunknownsThe object does not exists#The object was removed by the ownerisValidation errorisInternal server errorsstatus code %dsLFS server error for "%s": %ss1LFS server error. Unsolicited response for oid %sN(tgetR%tgetattrRR( RRrt responsesRRRtptrmapR{Rterrorstmsg((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyt_checkforservererror)s,       cC@sZ|jdg}|j|||g|D]$}||jdgkr,|^q,}|S(sextract 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(RR(RRRrRRwtotfilteredobjects((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyt_extractobjectsOs1cC@s`tj|d}tj|d|jd}|d|jdij}tjj|}|dkr|j|stj t d|dt dnt |j |d|_d |_|jd d nx$|D]\}} |j|| qWd } y|jj |} |jjr|jjd | j|jjddjtt| jjn|dkr|j|| nSx-tr| jd} | sPn| | 7} qW| r|jjd|| fnWngtjjk r[} |jjr9|jjd|| jfnt t d| ||fnXdS(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)RthreftheaderRosdetected corrupt lfs object: %sthints run hg verifycS@sdS(NtPUT((((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR|vss Content-Typesapplication/octet-streamRs Status: %d s%s s RXislfs %s response: %ss%s: %s s"HTTP error: %s (oid=%s, action=%s)N(!RtbytestrRtitemsRRRR^RtAbortRR1RJR%R/t get_methodRRlRBRRRRRRRRRXROR.RRR(RtobjRt localstoreR)RtheadersRtktvRtreqR/R((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyt_basictransfer`sD       ,  ! # c @sdkr"tjdnj|}j||}td|D}i}x-|D]%}|jdd||jdsR<iR)s lfs uploadingslfs downloadingis&lfs: need to transfer %d objects (%s) c3@s2x+|D]#}|jdd}jjrdkrFtd}ndkratd}njj||jdtj|fnj}xtr)y,j |d|jdfVPWqt j k r%}|dkrjjtd ||f|d8}qnqXqWqWdS( NR<iRXslfs: downloading %s (%s) Roslfs: uploading %s (%s) R)is%lfs: failed: %r (remaining retry %d) ( RRBtverboseRRZRt bytecountRdRORtsocketR(RVRtobjsizeRRdR(RRR(s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyttransfers.          R?slfs.worker-enableg?RzcS@s |jdS(NR)(R(R((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR|scS@s |jdS(NR)(R(R((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR|sttotalslfs: processed: %s slfs: uploaded %d files (%s) slfs: downloaded %d files (%s) (RoRX((RR RRtsumRRRRBRZRRRCRRt makeprogressRQR(RRrRRRRwRtsizesRttopicRRtprogresst processedtblobst_oneR)((RRRs9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyRpsD  #    $   cC@sSt|dd}|rOx4|jD]&}|jt|ddq"WndS(NRlt close_allcS@sdS(N(R%(((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyR|s(RR%thandlersR;(RRlth((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyt__del__s  ( R#R$R'RtRvRRRRRpR(((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyRbs   * &  7 Bt _dummyremotecB@s)eZdZdZdZdZRS(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|jdt}|j|jddt}|j|WdQXq WdS(NR^RKRL(RqR.R)RORR0(RRrRsR{tcontentR8((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyRts!cC@sRxKt|D]=}|j|jd}|j|j|WdQXq WdS(NRI(RqRR)RX(RRrRuR{R8((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyRvs(R#R$R=R'RtRv(((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyRs  t _nullremotecB@s)eZdZdZdZdZRS(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.pyRtscC@sdS(N((RRrRu((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyRvs(R#R$R=R'RtRv(((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyRs  t _promptremotecB@s8eZdZdZddZddZdZRS(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|jdS(N(t_prompt(RRrRsRB((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyRtscC@s|jdS(N(R(RRrRuRB((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyRvscC@stjtddS(Nslfs.url needs to be configured(RRR(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.pyRs    thttpsthttptfiletnullcC@s7tj}x|D]}|||jRbRRRR%RRqR`Rt StorageErrorRRRS(((s9/usr/lib64/python2.7/site-packages/hgext/lfs/blobstore.pyts:      4 {     *