\x89\x50\x4E\x47\x0D\x0A\x1A\x0A PNG  \x89\x50\x4E\x47\x0D\x0A\x1A\x0A  13\c@@s0ddlmZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z m Z m Z mZmZmZmZmZmZmZmZmZmZddlmZmZmZejZejZejZdZ de!fd YZ"d Z#d Z$d Z%d e j&fdYZ'e(dZ)dej*fdYZ+dZ,dej-j.fdYZ/ej0ej1de!fdYZ2ej0ej3de!fdYZ4iie4d6dd6ej56Z6dZ7dej9dZ:dddZ;dS(i(tabsolute_importNi(t_( tbundle2terrorthttpconnectiontpycompatt repositorytstatichttprepoturltutiltwireprotoframingtwireprototypestwireprotov1peertwireprotov2peertwireprotov2server(tcborutilt interfaceutilt stringutilcC@stj|d}|t|dtd}g}d}x^tjdt||D]A}|d7}|j|t|tj||||!fqYW|S(scEncode a string value into multiple HTTP headers. ``value`` will be encoded into 1 or more HTTP headers with the names ``header-`` where ```` is an integer starting at 1. Each header name + value will be at most ``limit`` bytes long. Returns an iterable of 2-tuples consisting of header names and values as native strings. s-%st000s: ii(Rtstrurltlentxrangetappendtstr(tvaluetheadertlimittfmttvaluelentresulttnti((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pytencodevalueinheaders,s " 5t _multifilecB@s;eZdZedZddZejdZ RS(cG@sTx;|D]3}tj|dstdt||qqW||_d|_dS(NtlengthsO_multifile only supports file objects that have a length but this one does not:i(R t safehasattrt ValueErrorttypet _fileobjst_index(tselftfileobjstf((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyt__init__Is  cC@std|jDS(Ncs@s|]}|jVqdS(N(R"(t.0R*((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pys Ts(tsumR&(R(((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyR"RscC@s|dkr&djd|jDSg}xz|r|jt|jkr|j|j|jj|t|d}||kr|jd7_n||8}q/Wdj|S(Nitcs@s|]}|jVqdS(N(tread(R,R*((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pys Xsii(tjoinR&R'RRR/(R(tamttpartstgot((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyR/Vs !  cC@sg|tjkrtdn|dkr9tdnx|jD]}|jdqCWd|_dS(NsP_multifile does not support anything other than os.SEEK_SET for whence on seek()isQ_multifile only supports seeking to start, but that could be fixed if you need it(tostSEEK_SETtNotImplementedErrorR&tseekR'(R(toffsettwhenceR*((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyR7bs   N( t__name__t __module__R+tpropertyR"tNoneR/R4R5R7(((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyR!Hs  cC@sG|dkrd|ds(RthandlerstcloseR(R(th((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyt__del__s cC@s|jS(N(R(R(((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyRscC@sdS(N(R=(R(((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pytlocalscC@s|S(N((R(((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pytpeerscC@stS(N(R(R(((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pytcanpushscC@sfy*|jj|jj|jj}}}Wntk r>dSX|jjtd|||fdS(NsE(sent %d HTTP requests and %d bytes; received %d bytes in responses) (Rt requestscounttsentbytescounttreceivedbytescountRR_tnoteR(R(treqstsenttrecv((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyRs   cC@s|jS(N(R(R(((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyt capabilitiessc K@stj|}t|j|j|j|j|j||\}}}t|j|j |}t |j|j||||\|_}}|S(N( Rt byteskwargsRvR_RRtcapableRRRR( R(RAt _compressibleRdRuRlRkRtct((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyt _callstreams cK@s2|j||}z|jSWd|jXdS(N(RR/R(R(RARdtfp((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyt_callsc K@s|jd}y|jd}Wntk r>dg}nXx'|D]}|tjkrF|}PqFqFWtj|j|d|}tj |j|d}idd6} zye|j |d|d| |} | jd d } t | d kr t j td | n| SWntjk r*nntj k r} | jd tjtjfkr~t jtd| jd nt j| jd nXWd|jtj|XdS(NtunbundleRDR.trbsapplication/mercurial-0.1s Content-TypeR?R@s iisunexpected response:ispush failed: %s(RRTRRt bundletypest writebundleR_R=Rt httpsendfileRRRt ResponseErrorRRRtsocketRdterrnot ECONNRESETtEPIPERRR4tunlink( R(RAtcgRdttypestxR%ttempnameRR@trtvalsterr((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyt _callpushs6    # c K@sd}d}d}ztjdddd\}}tj|d}|jd}x&|r||j||jd}qWW|jtj |j |d}idd 6} |j |d |d | |SWd|dk r|jn|dk r |jtj |nXdS( Ntprefixs hg-bundle-tsuffixs.hgtwbiRsapplication/mercurial-0.1s Content-TypeR?R@( R=RtmkstempR4tfdopenR/twriteRRRR_RR( R(RARRdtfhtfp_tfilenametfdtdR@((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyt_calltwowaystreams&         cK@s|j|dt|S(NR(RR(R(RARd((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyt_callcompressablescC@s |dS(N((R(t exception((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyt_aborts(R:R;R+RRRRRRRRRRRRRR(((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyR{s           (  cC@sQtj|jdd}|rrg}xP|D]<} | tjkr^|jtd| q/|j| q/Wn tj}tj|dt dt d|} t j || d|d|} d ||f} t |d kr| d 7} n| d |d d 7} |jdt |x=|D]5\} }}|jd| tj|ddfqWdjtt| j}itjd6tjd6}|tj| ||}|jddt |y|j|}Wnntjk r}|jdkrtjtdnn/t j!k rF}|j"t#d|nX| |fS(Nt experimentalshttppeer.v2-encoder-ordersQwire protocol version 2 encoder referenced in config (%s) is not known; ignoring thasmultiplesendt buffersendstclientcontentencodersRR`s%s/%sis /multirequests/%sissending %d commands ssending command %s: %s tindentiR.tAccepts Content-TypesContent-Lengths%disauthorization failed(%R tpopulatestreamencoderst configlisttSTREAM_ENCODERSRRRtSTREAM_ENCODERS_ORDERt clientreactorRRR t clienthandlerRRJRtpprintR0tmapRPt flushcommandsRt FRAMINGTYPERRR^RRRRRRRRRRR=(R_RR`tapiurlt permissiontrequeststredirectt uiencoderstencoderstencodertreactorthandlerRtcommandRdR*tbodyR@RuRRq((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyt sendv2requestsT            tqueuedcommandfuturecB@seZdZddZRS(s@Wraps result() on command futures to trigger submission on call.cC@s<|jr"tjjj||S|jj|j|S(N(tdoneRtfuturestFutureRt _peerexecutort sendcommands(R(ttimeout((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyRMs  N(R:R;t__doc__R=R(((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyR Jsthttpv2executorcB@sGeZdZdZdZdZdZdZdZRS(cC@s||_||_||_||_||_||_t|_t|_t |_ g|_ t j |_d|_d|_dS(N(t_uit_openerRt_apiurlt _descriptort _redirectRt_sentt_closedRUt_neededpermissionst_callstweakreftWeakSett_futuresR=t_responseexecutort _responsef(R(R_RR`Rt descriptorR((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyR+Ys           cC@s|S(N((R(((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyt __enter__iscC@s|jdS(N(R(R(texctypetexcvaluetexctb((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyt__exit__lscC@s0|jrtjdn|jr6tjdn||jdkr_tjd|n|jd|}t|jt|jdi}|rtjd|djt |fn|j t|dO_ t j j }t|_||_|jj||jj|||f|S( Ns4callcommand() cannot be used after commands are sents*callcommand() cannot be used after close()tcommandss)wire protocol command %s is not availableRds5wire protocol command %s does not accept argument: %ss, t permissions(R.RtProgrammingErrorR/R,RUtkeysRR0RMR0RR"R#R t __class__R$R4RVR1R(R(RRdtcmdinfot unknownargsR*((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyt callcommandos(  ("  c C@s|jr dS|jsdSt|_x;|jD]0}t|tr-tjj|_ d|_ q-q-Wg|jD]*\}}}|j rk|||f^qk}d|_|sdSt |j}d|krd|kr|jdnt|dkr(tjtdtdjt|nidd6dd6|j}t|j|j|j|j|||j\}}tjjd|_|jj|j |||_!dS(Ntpushtpullis6cannot make request requiring multiple permissions: %ss, trwtro("R.R1RR4ROR RR"R#RAR=R$tset_running_or_notify_cancelRUR0tremoveRRRRR0RMRIRR)R*RR+R-tThreadPoolExecutorR5tsubmitt_handleresponseR6( R(R*RRdtcallsR>RRR((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyR%s>   ! " cC@s|jr dS|jt|_|js-dSz|jjWd|jjdtd|_d|_x<|jD]1}|j sp|j t j t dqpqpWd|_XdS(Ntwaitsunfulfilled command response(R/R%RR6RR5tshutdownR=R4R!t set_exceptionRRR(R(R*((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyRs         cC@sx|j|rqWdS(N(treaddata(R(RR((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyRMs( R:R;R+R8R<RDR%RRM(((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyR(Ws    ) 4 t httpv2peercB@sbeZdZdZdZdZdZdZdZdZ dZ d Z RS( cC@s~||_||_|jdr.|d }n||_||_d||f|_||_||_tj |||_ dS(NRis%s/%s( R_t apidescriptorRRt_apipathR+R*RR tsupportedredirectsR-(R(R_trepourltapipathRR`RT((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyR+s       cC@s|jS(N(R(R(((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyRscC@sdS(N(R=(R(((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyRscC@s|S(N((R(((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyR scC@stS(N(R(R(((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyR scC@s9|jjtd|jj|jj|jjfdS(NsE(sent %d HTTP requests and %d bytes; received %d bytes in responses) (R_RRR*RRR(R(((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyRs  cC@sN|d krtS|dkr tS|jdrJ|td|jdkStS( Nt branchmapt getbundletknowntlookupR>Rscommand-R=(RYRZR[R\R>(RR]RRTR(R(R[((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyRs  cC@s6|j|rdStjtd||fdS(NsIcannot %s; client or remote repository does not support the %r capability(RRtCapabilityErrorR(R(R[tpurpose((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyt requirecap.s  cK@s/|j}|j||jSWdQXdS(N(tcommandexecutorRDR(R(R[RdRq((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyR8scC@s+t|j|j|j|j|j|jS(N(R(R_R*RR+RTR-(R(((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyR`<s( R:R;R+RRRRRRR_RR`(((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyRSs       tiniti2tpriorityc C@sdd}d}i}|jdd}|rmidd6|d<|djtdjttdd nt|||||d |\}} } t|||} y1t ||| | | d t d |\} } } Wn|t k rU}t|||||j d |\}} } t|||} t ||| | | d t d |\} } } nXz| j }Wd| jX| jd stjd| n|rA| dkrytj|d}Wq>tjk rtjtddtdq>XqZ| dkr%it|jd6}qZtjtd| nit|jd6}| |fS(NcS@stjddS(Nsshould not be called(RR?(R((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyRVsRshttppeer.advertise-v2Rs X-HgProto-1R@RGs X-HgUpgradeiRRRsapplication/mercurial-sunexpected content-type: %ssapplication/mercurial-cboris&error decoding CBOR from remote serverthints5try again and consider contacting the server operatorsapplication/mercurial-0.1sapplication/mercurial-0.2tv1capabilitiess(unexpected response type from server: %s(sapplication/mercurial-0.1sapplication/mercurial-0.2(R=R}tupdateR R0RMt API_PEERSRvRRRRRR/RR]RR?Rt decodealltCBORDecodeErrorRRRURTR(R_RRR`RaRRdt advertisev2RuRRkRRRRqtrawdatatinfo((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pytperformhandshakeRs^          c C@sYtj|}|js!|jrItjtd|jp?|jn|j\}}|jd||pt j ||}t ||||\}}t |j dijt tj@} t| dddt} xQ| D]I} d|djd | f} t| d ||| |||d| SWt||||||d S( s-Construct an appropriate HTTP peer instance. ``opener`` is an ``url.opener`` that should be used to establish connections, perform HTTP requests. ``requestbuilder`` is the type used for constructing HTTP requests. It exists as an argument so extensions can override the default. sunsupported URL component: "%s"s using %s tapistkeycS@s t|dS(NRb(Rf(R((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyRstreverses%s/%stapibaseRRaRd(R RtquerytfragmentRRRtauthinfoRJRRRlRURR@RfRMRRR( R_RRR`tuRRsRRktapipeerchoicestpreferredchoicestserviceRX((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pytmakepeers&  .    cC@s|rtjtdnyH|jdrRtj rRtjtdnt||}|SWngtjk r}y4tj |d||}|j td|SWqtjk r|qXnXdS(Ns!cannot create new http repositoryshttps:s1Python support for SSL and HTTPS is not installedsstatic-s(falling back to static-http) ( RRRR]Rt has_httpsRxRRtinstanceR(R_Rtcreatetintentst createoptsRt httpexceptionR((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyRzs(<t __future__RRRQR4RRR2ti18nRR.RRRRRRRRR R R R R RtutilsRRRRRRKR tobjectR!RvRzRRRRRtwirepeerRRR"R#R t implementertipeercommandexecutorR(tipeerv2RStHTTP_WIREPROTO_V2RfRlR=trequestRxRz(((s8/usr/lib64/python2.7/site-packages/mercurial/httppeer.pyt sB      X    ' w  : M C [ [0