��Qc@s�ddlZddlZddlZddlZddlmZmZddlmZdZ dZ
defd��YZd�Z
d �ZdS(
i�N(tutilt wireproto(tHTTP_OKsapplication/mercurial-0.1sapplication/hg-errortwebprotocBsPeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z RS(cCs||_d|_||_dS(Nt(treqtresponsetui(tselfRR((s</sys/lib/python2.7/site-packages/mercurial/hgweb/protocol.pyt__init__s cCs�|j�}i}|j�}x�|D]{}|dkr�i}xA|j�D]3}|dkrJ||krJ||d||<qJqJW||d<q%||d||<q%Wg|D]}||^q�S(Nt*tcmdi(t_argstsplittkeys(Rtargst knownargstdataRtktstartkey((s</sys/lib/python2.7/site-packages/mercurial/hgweb/protocol.pytgetargss
cCs�|jjj�}g}d}xPtrp|jjjdt|��}|dkrVPn||g7}|d7}q!W|jt j
dj|�dt��|S(Nit
HTTP_X_HGARG_Rtkeep_blank_values(RtformtcopytTruetenvtgettstrtNonetupdatetcgitparse_qstjoin(RRtchunkstith((s</sys/lib/python2.7/site-packages/mercurial/hgweb/protocol.pyR"s
%cCsJt|jjd�}x-tj|jd|�D]}|j|�q/WdS(NtCONTENT_LENGTHtlimit(tintRRRt
filechunkitertwrite(Rtfptlengthts((s</sys/lib/python2.7/site-packages/mercurial/hgweb/protocol.pytgetfile.scCs;|jj|jjf|_tj�|j_|j_dS(N(Rtfouttferrtoldiot cStringIOtStringIO(R((s</sys/lib/python2.7/site-packages/mercurial/hgweb/protocol.pytredirect2scCs1|jjj�}|j\|j_|j_|S(N(RR/tgetvalueR1R0(Rtval((s</sys/lib/python2.7/site-packages/mercurial/hgweb/protocol.pytrestore5sccsOtj�}x1tr?|jd�}|s.Pn|j|�VqW|j�VdS(Ni(tzlibtcompressobjRtreadtcompresstflush(Rtcgtztchunk((s</sys/lib/python2.7/site-packages/mercurial/hgweb/protocol.pytgroupchunks9s cCs\d|jjjd�pdtj|jjjdd��tj|jjjdd��fS(Nsremote:%s:%s:%sswsgi.url_schemethttptREMOTE_HOSTRtREMOTE_USER(RRRturllibtquote(R((s</sys/lib/python2.7/site-packages/mercurial/hgweb/protocol.pyt_clientAs(
t__name__t
__module__R RRR.R4R7R@RF(((s</sys/lib/python2.7/site-packages/mercurial/hgweb/protocol.pyRs cCs
|tjkS(N(Rtcommands(R((s</sys/lib/python2.7/site-packages/mercurial/hgweb/protocol.pytiscmdGscCsJt||j�}tj|||�}t|t�rP|jttd|�gSt|tj �ry|jtt�|j
St|tj�r�|j�}d|j
|f}|jttd|�gSt|tj�r|j�|j�d|j
}|jttd|�gSt|tj�rF|j}|jttd|�gSdS(Ntbodys%d
%ss0
%s
(RRRtdispatcht
isinstanceRtrespondRtHGTYPEt streamrestgentpushresR7trestpusherrtdraintooberrortmessaget HGERRTYPE(trepoRRtptrspR6((s</sys/lib/python2.7/site-packages/mercurial/hgweb/protocol.pytcallJs.
(R R2R8RDt mercurialRRtcommonRRORXtobjectRRJR\(((s</sys/lib/python2.7/site-packages/mercurial/hgweb/protocol.pyt<module>s08
|