\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@sotjg}xP|D]H\}}djfd|jD}|jd||fqWdj|S(s;Return a ``cmds`` argument value for the ``batch`` command.t,c3@s1|]'\}}d||fVqdS(s%s=%sN((t.0tktv(t escapearg(s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pys Xss%s %st;(R tescapebatchargtjoint 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.pyR5gs  N(RR R!tNoneR5(((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR1^st peerexecutorcB@sGeZdZdZdZdZdZdZdZRS(cC@sI||_t|_t|_g|_tj|_d|_ d|_ dS(N( t_peertFalset_sentt_closedt_callstweakreftWeakSett_futuresR9t_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(RR3R4RBtaddR?R+(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;RtsysstrR9R<R1t __class__R6R?R7(RRNRRPR((RRNRORs?/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=R?tTrueRBt isinstanceR1RR3R4RTR9R6tlentset_running_or_notify_cancelt strkwargst Exceptiontfuture_set_exception_infotsystexc_infot set_resultRt__self__R R+R;t _submitbatchtThreadPoolExecutorRCtsubmitt_readbatchresponseRD( RRtcallsRNRROR5trequestststatesRt encodedargstfremotet wireresults((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR7sZ             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(R7R>RVRDR5RCtshutdownR9RBR2t set_exceptionRt ResponseErrorR(RR((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRH s         c C@sx~|D]v\}}}}t|}|j|yt|}Wn+tk rotj|tjdqX|j|qWdS(Ni(R RR[RR\R]R^R_( RRgRjRNRRRit remoteresultR5((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRd's   ( RR RFRGRLRUR7RHRd(((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.pyRrGscc@s|jdtdt}itj|d6|fV|j}|d jdd\}}t|ryt|Vn|j t j |dS(Ntlookupslook up remote revisiontkeyit i( RsRRRt fromlocalRtsplittintRt_abortRR(RRvRtdtsuccesstdata((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRuKs   cc@sjt}i|fV|j}ytj|d VWn0tk re|jtjtd|nXdS(Nisunexpected response:( RRR t decodelistt ValueErrorR{RRnR(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 iterbytestrtboolRzRR{RRnR(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 |}||||d kr!d t|}n|d kr@td |n|||stUN(Rt byteskwargsRsRtgetRR*R9R tGETBUNDLE_ARGUMENTSRRQRR)tsortedRtKeyErrort_callcompressableRZtanyRt getunbundlerRtchangegroupmodt cg1unpacker( RtsourcetkwargsRRRvRtkeytypeR((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 _callpushRRnRRzRRRVRRt_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 RRtRttupleRRR{RRnR(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( NiiRwt-tbetweentpairscs@s*|] }|rtj|p!gVqdS(N(R R(R#R((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pys ssunexpected response:(RtxrangeRXR)R RRttextendRRR{RRnR(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(RsRR 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 configboolRRXR tunescapebatchargRR0treadR+R)Ry( RR,RR.Rtmsgt unescapeargtrsptchunktworktmergedtone((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRas*  $   cC@s|j|tj|S(N(RtRRZ(RR.R((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.pyRt8scK@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!RqRrRRuRRRRRRRRRRRRRaRR9RRtRRRRR{(((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRp8s2          ,      (&t __future__RRR]R@ti18nRtnodeRRRRRRRRRRR R R tutilsR RRtobjectRR0R3R4R1t implementertipeercommandexecutorR:t ipeercommandstipeerlegacycommandsRERp(((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyts"   @   #