\x89\x50\x4E\x47\x0D\x0A\x1A\x0A PNG  \x89\x50\x4E\x47\x0D\x0A\x1A\x0A  13\c@@sddlmZddlZddlZddlZddlZddlZddlZddlZddl Z yddl Z e j Wn!e k rddl mZ nXddlmZddlmZmZmZddlmZdadZd efd YZd efd YZd efdYZdefdYZdZdZ defdYZ!defdYZ"dS(i(tabsolute_importNi(t selectors2(t_(tencodingterrortutil(tprocutilcG@s<ts dSx!|D]}tjt|qWtjdS(N(tlogfiletwritetstrtflush(targsta((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pytlog%s  tchanneledoutputcB@s8eZdZdZedZdZdZRS(s^ Write data to out in the following format: data length (unsigned int), data cC@s||_||_dS(N(touttchannel(tselfRR((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyt__init__5s cC@s d|jS(Ns <%c-channel>(R(R((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pytname9scC@sG|s dS|jjtjd|jt|||jjdS(Ns>cI(RRtstructtpackRtlenR (Rtdata((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyR=s,cC@s+|dkrt|nt|j|S(Ntisattytfilenottelltseek(RRRR(tAttributeErrortgetattrR(Rtattr((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyt __getattr__Ds (t__name__t __module__t__doc__RtpropertyRRR(((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyR.s   tchanneledinputcB@sneZdZd ZdZedZddZdZddZ d Z d Z e Z d Z RS( s/ Read data from in_. Requests for input are written to out in the following format: channel identifier - 'I' for plain input, 'L' line based (1 byte) how many bytes to send at most (unsigned int), The client replies with: data length (unsigned int), 0 meaning EOF data iicC@s||_||_||_dS(N(tin_RR(RR%RR((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyRXs  cC@s d|jS(Ns <%c-channel>(R(R((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyR]sicC@sw|dkr`|j}|j||j}|}x)|r[|j||j}||7}q3W|S|j||jSdS(Ni(t maxchunksizet_readR(Rtsizetstbuf((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pytreadas   cC@s|s dS|dkst|jjtjd|||jj|jjd}tjd|d}|szdS|jj|SdS(Ntis>cIis>I( tAssertionErrorRRRRR R%R+tunpack(RR(Rtlength((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyR'ps cC@s~|dkrj|j}|j|d}|}x6|re|ddkre|j|d}||7}q0W|S|j|dSdS(NitLis (R&R'(RR(R)R*((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pytreadlines  cC@s|S(N((R((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyt__iter__scC@s|j}|stn|S(N(R1t StopIteration(Rtl((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pytnexts  cC@s+|dkrt|nt|j|S(NRRRR(RRRR(RRR%(RR((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyRs i(R R!R"R&RR#RR+R'R1R2R5t__next__R(((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyR$Is       tservercB@sseZdZdZdZdZdZdZdZdZ dZ ied 6e d 6Z d Z RS( sm Listens for commands on fin, runs them and writes the output on a channel based stream to fout. cC@stj|_|jdd}|rW|dkrEt|daqWt|dan|r|j|_||_ |j|_ n||_d|_ |_ t|d|_ t|d|_ t||d|_t|d |_||_dS( Nt cmdserverR t-tdR tetotItr(RtgetcwdtcwdtconfigRRtopentbaseuituitrepotrepouitNonetcerrtcoutR$tcintcresulttclient(RRDREtfintfouttlogpath((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyRs"    cC@sdS(s9release and restore resources taken during server sessionN((R((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pytcleanupscC@s/|s dS|jj|}|s+tn|S(NR,(RLR+tEOFError(RR(R((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyR's  cC@s6tjd|jdd}|s)dS|j|S(s[read a string from the channel format: data length (uint32), data s>IiiR,(RR.R'(RR/((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyt_readstrscC@s'|j}|r|jdSgSdS(s6read a list of NULL separated strings from the channelsN(RRtsplit(RR)((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyt _readlists  c C@stddlm}|j}|jj}|g}|jr||j_|jj|j}|j|_|j |||j_|jj _ |jj nxF|D]>}|j tj|jds|jddddqqW|j|||j|j|j|j}z9|j|d@}|jjtjd t|Wd d |krotj|jnXd S( sk reads a list of terminated arguments, executes and writes the return code to the result channel i(tdispatchRRDtnonttyttruet commandserveris>iNs--cwd(R,RURTRDtcopyRERCRFt __class__tappendtdirstatet_uit invalidateallt resetstateRt safehasattrRJt setconfigtrequestRIRHRKRRRtinttostchdirR@( RRUR tcopieduituisRFRDtreqtret((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyt runcommands,        & cC@s|jjtjdS(s3 writes the current encoding to the result channel N(RKRR(R((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyt getencoding scC@sd|jjd }|rZ|jj|}|r>||qZtjtd|n|dkS(Nisunknown command %sR,(RLR1t capabilitiestgetRtAbortR(Rtcmdthandler((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pytserveones RjRkcC@sddjt|j}|d7}|dtj7}|d7}|dtj7}tjtdr|d7}|dtj d7}n|j j |yx|j rqWWnt k rd SXdS( Nscapabilities: t s s encoding: spid: %dtgetpgidspgid: %dii(tjointsortedRlRRtgetpidRR`RdRsRIRRqRQ(Rthellomsg((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pytserves    ( R R!R"RRPR'RRRTRjRkRqRlRx(((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyR7s    '   t pipeservicecB@s#eZdZdZdZRS(cC@s||_||_dS(N(RDRE(RRDREtopts((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyR7s cC@sdS(N((R((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pytinit;sc C@sh|j}tj|j|jA\}}z&t||j||}|jSWd|jXWdQXdS(N( RDRtprotectedstdioRMRNR7RERxRP(RRDRMRNtsv((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pytrun>s  !(R R!RR{R~(((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyRy6s  cC@stjddtjdS(Ni(Rdtsetpgidtrandomtseed(((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyt_initworkerprocessIs c C@sc|jd}|jd}d}zy|||||}z|y|jWngtjk r}|jtd|n;tk r}|jtjkrqnt k rnXWd|j XWnG|r|j }nt |d}|j tjtjnXWd|jy|jWn+tk r]}|jtjkr^q^nXXdS(Ntrbtwbs abort: %s R;(tmakefileRGRxRRnRtIOErrorterrnotEPIPEtKeyboardInterruptRPRHRRRt strtolocalt tracebackt format_exctclose( RDREtconntcreatecmdserverRMRNR}tinstRH((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyt _serverequestZs:     tunixservicehandlercB@sJeZdZdZdZdZdZdZdZ dZ RS(sSet of pluggable operations for unix-mode services Almost all methods except for createcmdserver() are called in the main process. You can't pass mutable resource back from createcmdserver(). cC@s ||_dS(N(RD(RRD((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyRscC@sKtj|||jtj|jjtd||jjdS(Nslistening at %s ( Rtbindunixsockettlistentsockett SOMAXCONNRDtstatusRR (Rtsocktaddress((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyt bindsocketscC@stj|dS(N(Rdtunlink(RR((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyt unlinksocketscC@stS(s9True if server should shut down; checked per pollinterval(tFalse(R((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyt shouldexitscC@sdS(s/Called when main process notices new connectionN((R((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyt newconnectionscC@st|j|||S(shCreate new command server instance; called in the process that serves for the current connection(R7RD(RRERRMRN((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyRsN( R R!R"RGt pollintervalRRRRRR(((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyR~s     tunixforkingservicecB@sbeZdZd dZdZdZdZdZdZ dZ dZ d Z RS( sG Listens on unix domain socket and forks server per connection cC@s||_||_|d|_tjtdsItjtdn|jsjtjtdn|pyt ||_ d|_ d|_ t|_d|_dS(NRtAF_UNIXsunsupported platforms'no socket path specified with --address(RDRERRR`RRRnRRt_servicehandlerRGt_sockt_oldsigchldhandlertsett _workerpidst_socketunlinked(RRDRERzRp((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyRs       cC@stjtj|_|jj|j|jtjtdrStj t j nt j t j |j }||_ t|_dS(Nt unblocksignal(RRRRRRRR`RRtsignaltSIGCHLDt_sigchldhandlerRRR(RR<((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyR{s cC@s,|js(|jj|jt|_ndS(N(RRRRtTrue(R((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyt _unlinksockets cC@s>tjtj|j|jj|j|jddS(Ni(RRRRRRt _reapworkers(R((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyt_cleanups  cC@s z|jWd|jXdS(N(t _mainloopR(R((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyR~sc C@st}|j}tj}|j|jtjxtr| r`|jr`|j t}ny|j d|j }Wn1t k r}|j t jkrng}nX|s|r4Pq4q4ny|jj\}}Wn5tjk r}|jdt jkr q4nnXtj}|riz2|jjd||jj||jWd|jXq4y?|j|jj|j||jtjdWq4z|jjdtWdtjdXq4Xq4W|jdS(Nttimeoutisforked worker process (pid=%d) tforcei(RRt selectorstDefaultSelectortregisterRt EVENT_READRRRtselectRtOSErrorRt ETIMEDOUTtacceptRRR tEINTRRdtforkRDtdebugRtaddRRt _runworkert_exitR( RtexitingthtselectortreadyRRt_addrtpid((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyRsT           cC@s|jtjdS(N(RRdtWNOHANG(RRtframe((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyRscC@sx|jrytjd|\}}WnQtk r{}|jtjkrRqn|jtjkrjn|jjdSX|dkrdS|jj d||jj |qWdS(Niisworker process exited (pid=%d) ( RRdtwaitpidRRRtECHILDtclearRDRtdiscard(RtoptionsRt_statusR((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyR s   cC@sXtjtj|jt|j}z t|j|j||jWdt j XdS(N( RRRRRRRDRERtgctcollect(RRR((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyRs   N( R R!R"RGRR{RRR~RRRR(((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyRs     9  (#t __future__RRRRdRRRRRRt BaseSelectort ImportErrort thirdpartyRti18nRR,RRRtutilsRRGRR tobjectRR$R7RyRRRR(((s=/usr/lib64/python2.7/site-packages/mercurial/commandserver.pyts4            V  $!