Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/site-packages/mercurial/commandserver.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


��Qc@s�ddlmZddlZddlZddlZddlZddlZddlZda	d�Z
defd��YZdefd��YZ
defd	��YZdS(
i�(t_NcGs<ts
dSx!|D]}tjt|��qWtj�dS(N(tlogfiletwritetstrtflush(targsta((s;/sys/lib/python2.7/site-packages/mercurial/commandserver.pytlogs

tchanneledoutputcBs)eZdZd�Zd�Zd�ZRS(sg
    Write data from in_ to out in the following format:

    data length (unsigned int),
    data
    cCs||_||_||_dS(N(tin_touttchannel(tselfR	R
R((s;/sys/lib/python2.7/site-packages/mercurial/commandserver.pyt__init__s		cCsS|s
dS|jjtjd|jt|���|jj|�|jj�dS(Ns>cI(R
RtstructtpackRtlenR(Rtdata((s;/sys/lib/python2.7/site-packages/mercurial/commandserver.pyR$s
(cCs+|dkrt|��nt|j|�S(Ntisattytfileno(sisattysfileno(tAttributeErrortgetattrR	(Rtattr((s;/sys/lib/python2.7/site-packages/mercurial/commandserver.pyt__getattr__+s(t__name__t
__module__t__doc__R
RR(((s;/sys/lib/python2.7/site-packages/mercurial/commandserver.pyRs		tchanneledinputcBsYeZdZdZd�Zdd�Zd�Zdd�Zd�Zd	�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
    iicCs||_||_||_dS(N(R	R
R(RR	R
R((s;/sys/lib/python2.7/site-packages/mercurial/commandserver.pyR
?s		i�cCsw|dkr`|j}|j||j�}|}x)|r[|j||j�}||7}q3W|S|j||j�SdS(Ni(tmaxchunksizet_readR(Rtsizetstbuf((s;/sys/lib/python2.7/site-packages/mercurial/commandserver.pytreadDs		cCs�|s
dS|dkst�|jjtjd||��|jj�|jjd�}tjd|�d}|szdS|jj|�SdS(Ntis>cIis>I(	tAssertionErrorR
RRRRR	R!tunpack(RRRtlength((s;/sys/lib/python2.7/site-packages/mercurial/commandserver.pyRSs
cCs~|dkrj|j}|j|d�}|}x6|re|ddkre|j|d�}||7}q0W|S|j|d�SdS(NitLi�s
(RR(RRRR ((s;/sys/lib/python2.7/site-packages/mercurial/commandserver.pytreadlinecs	cCs|S(N((R((s;/sys/lib/python2.7/site-packages/mercurial/commandserver.pyt__iter__rscCs|j�}|st�n|S(N(R't
StopIteration(Rtl((s;/sys/lib/python2.7/site-packages/mercurial/commandserver.pytnextus	cCs+|dkrt|��nt|j|�S(NRR(sisattysfileno(RRR	(RR((s;/sys/lib/python2.7/site-packages/mercurial/commandserver.pyR{si(RRRRR
R!RR'R(R+R(((s;/sys/lib/python2.7/site-packages/mercurial/commandserver.pyR0s				tservercBsXeZdZd�Zd�Zd�Zd�Zd�Zied6ed6Zd�Z	RS(	sq
    Listens for commands on stdin, runs them and writes the output on a channel
    based stream to stdout.
    cCs(tj�|_|jddd�}|rc|dkrQttjtjd�aqct	|d�an|j
|_||_|j|_
|dkrttjtjd�|_ttjtjd�|_ttjtjd	�|_ttjtjd
�|_tj|_ntjtd�|��dS(Nt	cmdserverRt-tdRtpipetetotItrsunknown mode %s(tostgetcwdtcwdtconfigtNoneRtsyststdoutRtopentbaseuituitrepotrepouitstderrtcerrtcoutRtstdintcintcresulttclienttutiltAbortR(RR>R?tmodetlogpath((s;/sys/lib/python2.7/site-packages/mercurial/commandserver.pyR
�s 	cCs/|s
dS|jj|�}|s+t�n|S(NR"(RGR!tEOFError(RRR((s;/sys/lib/python2.7/site-packages/mercurial/commandserver.pyR�s	cCs"tjd|jd��d}|s.g}n|j|�jd�}|jj�}||j_|jj�|j_|jj	_
|jj�|jj�t
j|||j|j|j|j�}t
j
|�p�d}d|kr�j|j�n|jjtjdt|���dS(sk reads a list of  terminated arguments, executes
        and writes the return code to the result channel s>Iiits--cwds>iN(RR$RtsplitR>tcopyR?R=R@tdirstatet_uit
invalidatetinvalidatedirstatetdispatchtrequestRERCRBR5tchdirR7RFRRtint(RR%Rtcopieduitreqtret((s;/sys/lib/python2.7/site-packages/mercurial/commandserver.pyt
runcommand�s	"

cCs|jjtj�dS(s3 writes the current encoding to the result channel N(RFRtencoding(R((s;/sys/lib/python2.7/site-packages/mercurial/commandserver.pytgetencoding�scCsd|jj�d }|rZ|jj|�}|r>||�qZtjtd�|��n|dkS(Ni�sunknown command %sR"(RGR'tcapabilitiestgetRHRIR(Rtcmdthandler((s;/sys/lib/python2.7/site-packages/mercurial/commandserver.pytserveone�s
R[R]cCswddjt|j��}|d7}|dtj7}|jj|�yx|j�r\qMWWntk
rrdSXdS(Nscapabilities: t s
s
encoding: ii(tjointsortedR^R\RCRRbRL(Rthellomsg((s;/sys/lib/python2.7/site-packages/mercurial/commandserver.pytserve�s

(
RRRR
RR[R]RbR^Rg(((s;/sys/lib/python2.7/site-packages/mercurial/commandserver.pyR,�s					

(ti18nRRR:R5RTR\RHR9RRtobjectRRR,(((s;/sys/lib/python2.7/site-packages/mercurial/commandserver.pyt<module>s$		P

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.