\x89\x50\x4E\x47\x0D\x0A\x1A\x0A PNG  \x89\x50\x4E\x47\x0D\x0A\x1A\x0A  13\c@@s?ddlmZddlZddlmZddlmZmZmZm Z m Z m Z m Z mZddlmZdZdd hZd d hZd Zd ZdefdYZdefdYZdZdZdZdZdZdZied6ed6ed6ed6ed6ed6ZdS(i(tabsolute_importNi(t_(tencodingterrortpycompattsslutilturltutiltwireprotoframingtwireprototypes(tcborutilcC@sdg}xN|D]F}t|d}d|krF|t|d}n|j|q Wdj|S(s4Format an encoded message from the framing protocol.tmsgtargst(Rttupletappendtjoin(tatomstchunkstatomR ((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov2peer.pytformatrichmessages  thttpthttpstsha1tsha256cC@s(|jdtkrF|jtd|d|jddftS|jdr~tj r~|jtd|dtSd|kr t|d}t}x"tjD]}|j |dqW||@s |jtd |dd j t |ftSn|jtd |dt S( sDetermine whether a redirect target entry is supported. ``target`` should come from the capabilities data structure emitted by the server. tprotocols:(remote redirect target %s uses unsupported protocol: %s) tnameR t snirequireds8(redirect target %s requires SNI, which is unsupported) t tlsversionsisB(remote redirect target %s requires unsupported TLS versions: %s) s, s*(remote redirect target %s is compatible) ( tgettSUPPORTED_REDIRECT_PROTOCOLStnoteRtFalseRthassnitsettsupportedprotocolstaddRtsortedtTrue(tuittargetRt supportedtv((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov2peer.pytredirecttargetsupported4s&    !cC@s| sd|krdSg|ddD]}t||r&|d^q&}g|ddD]}|tkrZ|^qZ}i|d6|d6S(spResolve the "redirect" command request key given an API descriptor. Given an API descriptor returned by the server, returns a data structure that can be used in hte "redirect" field of command requests to advertise support for compatible redirect targets. Returns None if no redirect targets are remotely advertised or if none are supported. tredirectttargetsRthashesN(tNoneR+tSUPPORTED_CONTENT_HASHES(R't apidescriptorttR-thR.((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov2peer.pytsupportedredirectsVs tcommandresponsecB@sGeZdZedZdZdZdZdZdZ RS(sRepresents the response to a command request. Instances track the state of the command and hold its results. An external entity is required to update the state of the object when events occur. cC@sy||_||_||_t|_tj|_tj|_ g|_ d|_ t j|_t|_d|_dS(N(t requestidtcommandt fromredirectR t_inputcompletet threadingtRLockt_locktEventt _serviceablet_pendingeventsR/t _pendingerrorR tbufferingdecodert_decodert _seeninitialt _redirect(tselfR6R7R8((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov2peer.pyt__init__ws       cC@s*|jt|_|jjWdQXdS(N(R<R&R9R>R"(RE((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov2peer.pyt_oninputcompletes  cC@s|jj|\}}}|s%dS|jxo|jjD]^}|j rl|j rl|j|q?n|jrtj t dn|j j |q?W|j jWdQXdS(NsMreceived unexpected response data after content redirect; the remote is buggy(RBtdecodeR<t getavailableRCR8t_handleinitialRDRtAbortRR?RR>R"(REtdatat availablet readcounttwantedto((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov2peer.pyt_onresponsedatas   cC@s*||_|j|jjWdQXdS(N(R@R<R>R"(REte((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov2peer.pyt_onerrors  cC@st|_|ddkrdS|ddkr|d}tjd|dd|dd|jdd|jdd |jd d |jd d |jd |_dSi|d d d6g}d|d kr|d d|ddtwaitR@R<tclearR9tlistR?(REtstoptpendingRP((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov2peer.pytobjectss        ( t__name__t __module__t__doc__R RFRGRQRSRJRf(((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov2peer.pyR5ns     t clienthandlercB@seeZdZd ejjdZd dZdZ dZ dZ dZ dZ dZRS( sObject to handle higher-level client activities. The ``clientreactor`` is used to hold low-level state about the frame-based protocol, such as which requests and streams are active. This type is used for higher-level operations, such as reading frames from a socket, exposing and managing a higher-level primitive for representing command responses, etc. This class is what peers should probably use to bridge wire activity with the higher-level peer API. cC@sd||_||_i|_i|_i|_g|_t|_|pQtj ||_ ||_ dS(N( t_uit_reactort _requestst_futurest _responsest _redirectsR t _frameseofturlmodtopenert_openert_requestbuilder(RER't clientreactorRstrequestbuilder((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov2peer.pyRFs       c C@s|jj||d|\}}}|dkrFtjd|n|j}||j|<||j|       cC@s|j|d|dr5|j|j|j=n |jsBdS|jre|j|j|jdS|j|jkr{dS|jt kr|j|jj |j |j|j=nI|j rt |j|j }|j|jj ||j|j=ndS(NRLteos( RQRGRmR6RCRDt_followredirectRnR7tCOMMAND_DECODERSt set_resultRfR9(RERRRtdecoded((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov2peer.pyRxs$     cC@s|jjtd|j|jdkrKtjtd|jn|jrm|jjtdn|j s|j r|jjtdni|jd6}|j t j |jd |}y|jj|}Wntjjk r$}|jdkrtjtdnnOtjjk rr}|jjd |j|jjtd |nXtj||j|}t||jd t |j|<|j!j"||fd S( s4Called to initiate redirect following for a request.s(following redirect to %s) sapplication/mercurial-cbors-cannot handle redirects for the %s media typesC(support for validating hashes on content redirects not supported) sM(support for pinning server certificates on content redirects not supported) tAcceptisauthorization failedshttp error requesting %s R8N(#RkRRRRWRRKRYtwarnR[R\RuRtstrurlR/RttopenRturlerrt httperrortcodethttplibt HTTPExceptiontdebugt get_full_urlt tracebacktIOErrorRrt wrapresponseRoR5R7R&RpR(RER6R,theaderstreqtresRRt oldresponse((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov2peer.pyRs6  !    cC@s|j|}y|jd}|j||s?|jn||jkrXt|S|jtkr|j|j|j |j|=nC|j rt|j|j }|j|j||j|=nt|SWn<t k r}|j|j ||j|=|jt SXdS(sCalled to continue processing a response from a redirect. Returns a bool indicating if the redirect is still serviceable. iN(RotreadRQRGRntboolR7RRRfR9RRR (RERRRRLRRR((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov2peer.pyRs*         N(RgRhRiR/RturlreqR}RFRyRRRRRR(((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov2peer.pyRjs    8 , -cC@s t|}d|jDS(NcS@s(i|]\}}|tj|qS((Rttolocal(t.0tkR*((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov2peer.pys s (tnexttitems(tobjstbm((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov2peer.pytdecodebranchmaps cC@s t|S(N(R(R((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov2peer.pyt decodeheadsscC@s5t|}g|D]}|dkr+tnt^qS(Nt1(RR&R (Rtrawtc((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov2peer.pyt decodeknowns cC@s t|S(N(R(R((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov2peer.pytdecodelistkeysscC@s t|S(N(R(R((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov2peer.pyt decodelookupscC@s t|S(N(R(R((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov2peer.pyt decodepushkey st branchmaptheadstknowntlistkeystlookuptpushkey( t __future__RR:ti18nRR RRRRRRrRRR tutilsR RRR0R+R4tobjectR5RjRRRRRRR(((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov2peer.pyts6 :     "