\x89\x50\x4E\x47\x0D\x0A\x1A\x0A PNG  \x89\x50\x4E\x47\x0D\x0A\x1A\x0A  13\c@@sNddlmZddlZddlZddlZddlmZddlmZddl m Z m Z m Z mZmZmZmZmZmZddlmZejZdZd efd YZd Zd ejjfd YZejej defdYZ!ejej"ej#dej$fdYZ%dS(i(tabsolute_importNi(t_(tbin( tbundle2t changegrouptencodingterrortpushkeytpycompatt repositorytutiltwireprototypes(t interfaceutilc@s6fd}t|dt|dj|S(sUannotation for batchable methods Such methods must implement a coroutine as follows: @batchable def sample(self, one, two=None): # Build list of encoded arguments suitable for your wire protocol: encargs = [('one', encode(one),), ('two', encode(two),)] # Create future for injection of encoded result: encresref = future() # Return encoded arguments and future: yield encargs, encresref # Assuming the future to be filled with the result from the batched # request now. Decode it: yield decode(encresref.value) The decorator returns a function which wraps this coroutine as a plain method, but adds the original method as an attribute called "batchable", which is used by remotebatch to split the call into separate encoding and decoding phases. c@sj||}t|\}}|s+|S|d}tjj}|j|j||t|S(Ni(tnextRtbytesurlt__name__tsett _submitone(targstoptst batchablet encargsorrest encresreftselftcmd(tf(s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pytplain9s RR(tsetattrR(RR((Rs?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR#s tfuturecB@seZdZdZRS(s'placeholder for a value to be set latercC@s1tj|dr$tjdn||_dS(Ntvaluesfuture is already set(R t safehasattrRt RepoErrorR(RR((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRHs(Rt __module__t__doc__R(((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRFsc@stjg}xr|D]j\}}tfd|DsDtdjfd|jD}|jd||fqWdj|S(s;Return a ``cmds`` argument value for the ``batch`` command.c3@s!|]}||kVqdS(N((t.0tk(t escapearg(s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pys Vst,c3@s1|]'\}}d||fVqdS(s%s=%sN((R"R#tv(R$(s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pys Xss%s %st;(R tescapebatchargtalltAssertionErrortjoint iteritemstappend(treqtcmdstoptargsdictR((R$s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pytencodebatchcmdsMs "t unsentfuturecB@seZdZddZRS(s0A Future variation to represent an unsent command. Because we buffer commands and don't submit them immediately, calling ``result()`` on an unsent future could deadlock. Futures for buffered commands are represented by this type, which wraps ``result()`` to call ``sendcommands()``. cC@s<|jr"tjjj||S|jj|j|S(N(tdoneRtfuturestFuturetresultt _peerexecutort sendcommands(Rttimeout((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR7gs  N(RR R!tNoneR7(((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR3^st peerexecutorcB@sGeZdZdZdZdZdZdZdZRS(cC@sI||_t|_t|_g|_tj|_d|_ d|_ dS(N( t_peertFalset_sentt_closedt_callstweakreftWeakSett_futuresR;t_responseexecutort _responsef(Rtpeer((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyt__init__ts     cC@s|S(N((R((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyt __enter__}scC@s|jdS(N(tclose(Rtexctypetexcvaleetexctb((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyt__exit__sc@sjrtjdnjr6tjdntjtjdsptjdnfd}tdt r|}t |_ |_ n2j rtjdn|}j|S(Ns4callcommand() cannot be used after commands are sents*callcommand() cannot be used after close()sAcannot call command %s: method of same name not available on peerc@s?tjj}jj|jj|f|S(N(RR5R6RDtaddRAR-(R(RtcommandtfnR(s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pytaddcallsRsX%s is not batchable and cannot be called on a command executor along with other commands(R?RtProgrammingErrorR@tgetattrR=RtsysstrR;R>R3t __class__R8RAR9(RRPRRRR((RRPRQRs?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyt callcommands*          c C@sS|jr dS|jsdSt|_x;|jD]0}t|tr-tjj|_ d|_ q-q-W|j}d|_t |dkr|d\}}}}|j sdSy|tj|}Wn+tk rtj|tjdnX|j|dSg}g}x|D]\}}}}|j s:qny"|j|jtj|} Wn,tk rtj|tjddSXyt| \} } Wn,tk rtj|tjddSX|j|| f|j||| | fqW|s dS|jj|} tjjd|_|jj|j|| |_dS(Nii(R?RAtTrueRDt isinstanceR3RR5R6RVR;R8tlentset_running_or_notify_cancelt strkwargst Exceptiontfuture_set_exception_infotsystexc_infot set_resultRt__self__R R-R=t _submitbatchtThreadPoolExecutorREtsubmitt_readbatchresponseRF( RRtcallsRPRRQR7trequestststatesRt encodedargstfremotet wireresults((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR9sZ             cC@s|j|jrdSt|_|js-dSz|jjWd|jjdtd|_d|_x<|jD]1}|j sp|j t j t dqpqpWd|_XdS(Ntwaits"unfulfilled batch command response(R9R@RXRFR7REtshutdownR;RDR4t set_exceptionRt ResponseErrorR(RR((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRJ s         c C@sx~|D]v\}}}}t|}|j|yt|}Wn+tk rotj|tjdqX|j|qWdS(Ni(R RR]RR^R_R`Ra( RRiRlRPRRRkt remoteresultR7((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRf's   ( RR RHRIRNRWR9RJRf(((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR<rs   3 T twirepeercB@seZdZdZdZedZedZedZedZ edZ edZ d Z d Z d Zd Zd ZdZdZdZdZddddZdZdZdZdZdZdZRS(sClient-side interface for communicating with a peer repository. Methods commonly call wire protocol commands of the same name. See also httppeer.py and sshpeer.py for protocol-specific implementations of this interface. cC@s t|S(N(R<(R((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pytcommandexecutorBscC@s#|jdtd|jdS(Nt clonebundless clone bundles(t requirecapRt_call(R((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRtGscc@s|jdtdt}itj|d6|fV|j}|d jdd\}}t|ryt|Vn|j t j |dS(Ntlookupslook up remote revisiontkeyit i( RuRRRt fromlocalRtsplittintRt_abortRR(RRxRtdtsuccesstdata((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRwKs   cc@sjt}i|fV|j}ytj|d VWn0tk re|jtjtd|nXdS(Nisunexpected response:( RRR t decodelistt ValueErrorR}RRpR(RRR~((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pytheadsWs    cc@st}itj|d6|fV|j}y1gtj|D]}tt|^q@VWn0tk r|j t j t d|nXdS(Ntnodessunexpected response:( RR t encodelistRRt iterbytestrtboolR|RR}RRpR(RRRR~tb((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pytknownas  1 cc@st}i|fV|j}yoi}x]|jD]O}|jdd\}}tjtj|}tj |}|||R;RRRRRzRR{RR|RRRpRRRXtstatus( RRRxRRRR~toutputtl((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRs$   cC@s |jdS(Nt stream_out(t _callstream(R((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRsc K@stj|}|jdtdi}|jdp@t}x|jD]\}}|dkrnqPntj j|}|dkrt j d|n|dkrtj |}n|dkrdj |}nb|dkrdj t|}n>|d kr!d t|}n|d kr@td |n|||stUN(Rt byteskwargsRuRtgetRR,R;R tGETBUNDLE_ARGUMENTSRRSRR+tsortedRtKeyErrort_callcompressableR\tanyRt getunbundlerRtchangegroupmodt cg1unpacker( RtsourcetkwargsRRRxRtkeytypeR((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRs6        cC@s]|dgkrT|jdrTtjdtjdjt|jg}ntj|}tj |dr,|j d|d|\}}|dkrt j t d|nyt|}Wn)tk rt j t d |nXx`|jtD]}|jjt d |qWn-|jd|d|}tj|j|}|S( sSend cg (a readable file-like object representing the changegroup to push, typically a chunkbuffer object) to the remote server as a bundle. When pushing a bundle10 stream, return an integer indicating the result of the push (see changegroup.apply()). When pushing a bundle20 stream, return a bundle20 stream. `url` is the url the client thinks it's pushing to, which is visible to hooks. tforcet unbundlehashthashedtt deltaheadertunbundleRs push failed:s"push failed (unexpected response):sremote: (RR Rthashlibtsha1R+RtdigestR Rt _callpushRRpRR|RRRXRRt_calltwowaystreamRR(RtbundleRturltretRRtstream((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRs&0   cC@stj|}|jdd|}y6g|jD]}ttj|^q4}|SWn0tk r|jtj t d|nXdS(NtbranchesRsunexpected response:( R RRvRttupleRRR}RRpR(RRtnR~Rtbr((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRs. cC@sd}g}xtjdt||D]}djg||||!D]}tj|d^qF}|jdd|}y!|jd|jDWq(t k r|j t j t d|q(Xq(W|S( NiiRyt-tbetweentpairscs@s*|] }|rtj|p!gVqdS(N(R R(R"R((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pys ssunexpected response:(RtxrangeRZR+R RRvtextendRRR}RRpR(RRtbatchtrtitpRR~((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRs" 0  'cC@s4tj|}|jdd|}tj|dS(NRtrootsR(R RRRR(RRRRR((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRscC@s_|jdtdtj|}tj|}|jdd|d|}tj|dS(Ntchangegroupsubsetslook up remote changestbasesRR(RuRR RRRR(RRRRR((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRs  c c@sd|j}|jrn|jddrn|jdx:|D]/\}}d}|j||t|fq8Wntj}|jddt|}|j d}|g} x|rKx2d|kr|r|j d}| j |qWd j | } x3d| kr,| j dd \} } || VqW|j d}| |g} qW|d j | Vd S( sqrun batch request on the server Returns an iterator of the raw responses from the server. tdevelsdebug.peer-requests$devel-peer-request: batched-content s+devel-peer-request: - %s (%d arguments) RR/iR'RiN( Rt debugflagt configboolRRZR tunescapebatchargRR2treadR-R+R{( RR.RR0Rtmsgt unescapeargtrsptchunktworktmergedtone((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRcs*  $   cC@s|j|tj|S(N(RvRR\(RR0R((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR,scC@sTi}|dk r||d on the server The command is expected to return a simple string. returns the server reply as a string.N(tNotImplementedError(RRR((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRv8scK@s tdS(s execute on the server The command is expected to return a stream. Note that if the command doesn't return a stream, _callstream behaves differently for ssh and http peers. returns the server reply as a file like object. N(R(RRR((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR@s cK@s tdS(sEexecute on the server The command is expected to return a stream. The stream may have been compressed in some implementations. This function takes care of the decompression. This is the only difference with _callstream. returns the server reply as a file like object. N(R(RRR((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRKs cK@s tdS(sexecute a on server The command is expected to be related to a push. Push has a special return method. returns the server reply as a (ret, output) tuple. ret is either empty (error) or a stringified int. N(R(RRtfpR((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRXs cK@s tdS(sqexecute on server The command will send a stream to the server and get a stream in reply. N(R(RRRR((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRcscC@s tdS(sKclearly abort the wire protocol connection and raise the exception N(R(Rt exception((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR}jsN(RR R!RsRtRRwRRRRRRRRRRRRRcRR;RRvRRRRR}(((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRr8s2          ,      (&t __future__RRR_RBti18nRtnodeRRRRRRRRRRR R R tutilsR RRtobjectRR2R5R6R3t implementertipeercommandexecutorR<t ipeercommandstipeerlegacycommandsRGRr(((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyts"   @   #