Plan 9 from Bell Labs’s /usr/web/sources/contrib/bichued/root/sys/lib/python/mercurial/hgweb/webcommands.pyc

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


�
�c@s�ddkZddkZddkZddkZddkZddkZddklZlZl	Z	l
Z
ddklZl
Z
ddklZddklZlZlZlZddklZlZlZddklZdd	d
ddd
ddddddddddddgZd�Zd�Zd�Zd�Zd�Zed�Z d �Z!d!�Z"e"Z#d"�Z$d#�Z%d$�Z&d%�Z'd&�Z(e(Z)d'�Z*d(�Z+d)�Z,d*�Z-d+�Z.dS(,i�N(terrortarchivalt	templaterttemplatefilters(tshortthex(tbinary(t	paritygent
staticfiletget_contactt
ErrorResponse(tHTTP_OKtHTTP_FORBIDDENtHTTP_NOT_FOUND(tgraphmodtlogtrawfiletfilet	changelogtshortlogt	changesettrevtmanifestttagstbranchestsummarytfiledifftdifftannotatetfilelogtarchivetstatictgraphcCsJd|ijo&|iddot|||�Snt|||�SdS(NRi(tformRR(twebtreqttmpl((s./sys/lib/python/mercurial/hgweb/webcommands.pyRs"c		CsUti|i|iiddg�d�}|p-t|||�}|it|i�|Snyti	|i|�}Wnat
ij
oR}y-t|||�}|it|i�|SWq�tj
o
|�q�XnX|i
�}|i�}ti|�d}|djot|�odpd}n|it||t|��|gS(NRtisapplication/octet-streams
text/plain(twebutilt	cleanpathtrepoR!tgetRtrespondRtctypetfilectxRtLookupErrorR
tpathtdatat	mimetypest
guess_typetNoneRtlen(	R"R#R$R.tcontenttfctxtinstttexttmt((s./sys/lib/python/mercurial/hgweb/webcommands.pyR s*+
cs)|i�}|i��t|i��t��o(ti|�dpd}d|�n��fd�}|dd|dti|�d|�d	|i	�d
t
|i��d|i�d|i
�d
|i�dti|�dti|�dti|�dti|�d|i�i|��
S(Nisapplication/octet-streams(binary:%s)c3sixbt�it��D]K\}}h|d<d|dd<d|dd<�i�d<VqWdS(Ntlinesl%ditlineids% 6dt
linenumbertparity(t	enumeratet
splitlinestTruetnext(tlinenott(R<R7(s./sys/lib/python/mercurial/hgweb/webcommands.pytlinesCs
tfilerevisionRR.R7Rtnodetauthortdatetdesctbranchtparenttchildtrenametpermissions(R.R/RtstripecountRR0R1R&tupRRREtuserRGtdescriptiontnodebranchnodefaulttparentstchildrent
renamelinkRtflags(R"R$R5tfR8RC((R<R7s./sys/lib/python/mercurial/hgweb/webcommands.pyt
_filerevision:s*
		c	Cs�ti|i|iiddg�d�}|pt|||�Sny#t||ti|i|��SWnHti	j
o9}yt|||�SWq�t
j
o
|�q�XnXdS(NRR%i(R&R'R(R!R)RRXR,RR-R
(R"R#R$R.R6((s./sys/lib/python/mercurial/hgweb/webcommands.pyRYs+#csj����fd�}�ii}t�i���dd�dt|i��d|d�id��S(Nc
";s��ii�d}�i�i�}��fd�}x�|�D]�}d}xm|D]e}||i�i�jp8||i�i�jp|di|i��i�jpd}PqSqSW|oq@n|d7}|i�}t	i
�i�d|�}t	i�|i�|�i�}	�dd�i
�d|i�d	t	i|�d
t	i|�d|d|i�d|i�d
|	d|i�dt|�dt	i�i|�dt	i�i|�dt	i�i|��
V|�ijoPq@q@WdS(Nic3s�x�tt��ddd�D]q}g}xBttd|d�|d�D] }�i|}|i|�qJW|i�x|D]}|VqWqWdS(Niii��(txrangeR3tmaxR(tappendtreverse(titltjtctxte(R"tcl(s./sys/lib/python/mercurial/hgweb/webcommands.pytrevgenls!

t itchangelogtagtsearchentryR<RFRJRKRHRGtfilesRRERtinbranchR(R(RtlowertsplitRPRQtjoinRgRER&tshowtagt
listfilediffstmaxfilesR@RSRTRGRRtnodetagsdicttnodeinbranchtnodebranchdictt
maxchanges(
tmaptcounttqwRcR`tmisstqtntshowtagsRg(R"R<tqueryR$(Rbs./sys/lib/python/mercurial/hgweb/webcommands.pyt
changelistgsH

"	
!	tsearchRzREtentriestarchivesttip(R(RRRNRRtarchivelist(R"R$RzR{Rb((R<R"RzR$s./sys/lib/python/mercurial/hgweb/webcommands.pyt_searches1	cs�d|ijoti�i|�}nsd|ijo|idd}nt�i�d}y�i|}Wn&tij
ot��|�SnXd�����fd��|o
�ip�i	}�ii
}t|�}|i�}	td|	|d��t
|�|���d}	t�id����ti|	||�ii�}
�|odpdd	|
dt|i��d|	d
|d�fd�d
�fd�d�id��S(NRERiic		;s�g}x\t���D]K}�i|}|i�}ti�i�d|�}ti�|i�|�i�}|idh�i	�d<|i
�d<ti||d�d<ti||d�d<|d<|i
�d<|i�d	<|d
<|d<t|�d<ti�i|�d
<ti�i|�d<ti�i|�d<�qW|djo|| }nx|D]}|Vq�WdS(NReiR<RFiRJRKRHRGRgRRERRhR(RYR(RER&RlRmRgRntinsertR@RPRSRTRQRGRRoRpRq(	tlimitRsR^R]R`RxRyRgRa(tendR"tstartR<R$(s./sys/lib/python/mercurial/hgweb/webcommands.pyR{�s2
!			
toffsetRRt	changenavt
changesetsR}cs�dd|�S(R�i((tx(R{(s./sys/lib/python/mercurial/hgweb/webcommands.pyt<lambda>�stlatestentrycs�dd|�S(R�i((R�(R{(s./sys/lib/python/mercurial/hgweb/webcommands.pyR��sR~R(R!R&t	changectxR(R3Rt	RepoErrorR�tmaxshortchangesRrRRRZtminRRNt	revnavgenRRER�(R"R#R$RR`thiRrRbRttposR�((R<R{R"R�R�R$s./sys/lib/python/mercurial/hgweb/webcommands.pyR�s4
cCst|||dt�S(NR(RR?(R"R#R$((s./sys/lib/python/mercurial/hgweb/webcommands.pyR�sc&Cs�ti|i|�}ti|i|d|i��}ti|�}g}t|i�}x_|i�D]Q}||jodpd}	|i	||	d|i
�d|d|i���qgWt|i�}ti|i||d|�}
|dd|
d	|i�d|i
�d
ti|�dti|�d|d|d
|i�d|i�d|i�d|d|i|i
��dti|i|i��dti|�dti|i|�dti|i|��S(Ntchangesettagtfilenodelinkt
filenolinkRERR<RRRRJRKtchangesetbranchRFRHRGRgR~RRIRhR(R&R�R(RlRERRRRNRgR[RR@tdiffsR2RRSRTRPRQRGR�RoRpRq(R"R#R$R`Ryt
showbranchRgR<RWttemplateR�((s./sys/lib/python/mercurial/hgweb/webcommands.pyR�s<!
	cs�ti|i|��ti|i|iiddg�d�}�i���i�}h�h�t|i	��|o|ddjo|d7}nt
|�}d|�x��i�D]�\}}|| |joq�n||}|id�}	t
|	�djo|�|<q��}
xR|	dd!D]C}||
joh|
|<n|
|}
t
|
�djoPq.q.Wd|
d<q�W�o'�o�ottd|��n����fd�}���fd	�}
|d
d�i�dt|�d
�dti��d�i�d|d|
d|it|��dti|i|�dti|i��dti|i���S(NRR%ii�t/ispath not found: c;s�x�t��D]u}�|}�i|�}h|d<�i�d<|d<|i�d<|i�d<�i|�d<Vq
WdS(NRR<tbasenameRGtsizeRM(tsortedR,R@RGR�RV(RsRWtfullR5(RgR`tmfR<(s./sys/lib/python/mercurial/hgweb/webcommands.pytfilelist's


	c;s�x�t��D]�}g}�|}x\t|t�oKt|�djo8|i�d\}}|o|i|�n|}q&Wd�|f}h�i�d<|d<di|�d<|d<Vq
WdS(	Niis%s%sR<R.R�t	emptydirsR�(R�t
isinstancetdictR3titemsR[R@Rk(RstdR�thtktvR.(tdirsR<tabspath(s./sys/lib/python/mercurial/hgweb/webcommands.pytdirlist3s

&	RRRER.ROtupparitytfentriestdentriesR~RRhR(R&R�R(R'R!R)RRERRNR3t	iteritemsRjR2R
R
RRROR@R�RoRpRq(R"R#R$R.RER^RWRxtremaintelementsR�telemR�R�((R<R�RgR�R�R`s./sys/lib/python/mercurial/hgweb/webcommands.pyRsX+




		cs��ii���i�t�i��td���fd��|ddt�iii��d�fd�d�fd�d	�fd
��S(Nic;s�d}x��D]�\}}|o|djoq
n|djo||joq
n|d}h�i�d<|d<�i|i�d<t|�d<Vq
WdS(NiRiR<ttagRGRE(R@R(RGR(tnotipR�RsRtR�Rx(R<R]R"(s./sys/lib/python/mercurial/hgweb/webcommands.pyR}Vs
	RRER}cs�td|�S(i(tFalse(R�(R}(s./sys/lib/python/mercurial/hgweb/webcommands.pyR�estentriesnotipcs�td|�S(i(R?(R�(R}(s./sys/lib/python/mercurial/hgweb/webcommands.pyR�fsR�cs�td|�S(i(R?(R�(R}(s./sys/lib/python/mercurial/hgweb/webcommands.pyR�gs(	R(ttagslistR\RRNR�RRR(R"R#R$((R"R<R]R}s./sys/lib/python/mercurial/hgweb/webcommands.pyRQs

	cs��ii�}�fd��ii�i�D���ii��t�i��d�������fd��|ddt�iii��d�fd�d�fd	��S(
Nc3s&x|]\}}�i|VqWdS(N(R((t.0RBRx(R"(s./sys/lib/python/mercurial/hgweb/webcommands.pys	<genexpr>kscSsd|i�j|i�fS(tclose(textraR(R`((s./sys/lib/python/mercurial/hgweb/webcommands.pyR�nsc;s�d}x�t�d�dt�D]�}|djo||jodSn|d7}|i��jo
d}n*�ii|i��p
d}nd}h�i�d<|i�d	<|d
<|i�d<|i�d<VqWdS(
NitkeyR\itinactivetclosedtopenR<RItstatusRERG(	R�R?RER(tbranchheadsRIR@RRG(R�RsRtR`R�(theadsR"tsortkeyR<ttips(s./sys/lib/python/mercurial/hgweb/webcommands.pyR}ps 


	RRER}cs
�d|�S(i((R�(R}(s./sys/lib/python/mercurial/hgweb/webcommands.pyR��sR�cs
�d|�S(i((R�(R}(s./sys/lib/python/mercurial/hgweb/webcommands.pyR��s(	R(t
branchtagsR�R�RRNRRR(R"R#R$tb((R"R�R�R}R<R�s./sys/lib/python/mercurial/hgweb/webcommands.pyRis%	!cs�ii���i����fd�}�fd�}����fd�}�ii}t|�}td|�i��t|��i���dd�iddd	�d
t	�i�pd	d|i
|i��dd
|d|d|dt|i��d�i
d��S(Nc;s�t�i�}d}x��D]x\}}|djoqn|d7}|djoPn�dd|i�d|dt|�d	�i|i��VqWdS(
NiRii
ttagentryR<R�RERG(RRNR@RR(RG(RsR<RtR�Rx(R"R]R$(s./sys/lib/python/mercurial/hgweb/webcommands.pyt
tagentries�s


	c;s�t�i�}�ii�}g}|i�D],\}}|�iii|�||fq/~}x_t|�D]Q\}}}h|i�d<|d<t	|�d<�i|i
�d<VqqWdS(NR<RIRERG(RRNR(R�R�RRR�R@RRG(RsR<R�t_[1]RBRxR^tr(R"(s./sys/lib/python/mercurial/hgweb/webcommands.pyR�sF
	c;s�t�id���}g}x�t���D]�}�i|}|i�}t|�}|id�dd|i�d|i�d|i	�d|i
�d|d	|d
ti�i|�dti
�i|�dti�i|��	�q/W|VdS(
NR�it
shortlogentryR<RFRHRGRRERRhR(RRNRYR(RERR�R@RPRQRGR&RoRpRq(RsR<R^R]R`Rxthn(R�R"R�R$(s./sys/lib/python/mercurial/hgweb/webcommands.pyR{�s&
iRRHR"RQtunknowntownert
lastchangeiRRRRER~R(R(R�R\RR3RZRrR�tconfigR	treadRRR�(R"R#R$R�RR{RbRt((R"R$R]R�R�s./sys/lib/python/mercurial/hgweb/webcommands.pyR�s$
	c
Cs�d\}}yti|i|�}Wnbtj
oVti|i|�}ti|i|idd�}||i�jo�q�nX|dj	o|i	�}|i
�}n
|i	�}t|i�}ti
|i||p||g|�}|oti|�pg}	|o|p|}|dd|dt|�d|i�d|i�d|i�d|i�d	|	d
ti|�dti|�dti|�d
|�S(NRiRRERRGRHRFRLRIRJRKR(NN(R2R&R,R(R-R�R'R!RgRER.RRNR�RURRRGRQRPRRRSRT(
R"R#R$R5R`R.RxR<R�RL((s./sys/lib/python/mercurial/hgweb/webcommands.pyR�s8 
(	cs�ti|i|���i�}t|i����fd�}|dd|d|dti|�d�i�dt�i	��d�i
�d	�i�d
�i�dti
��dti��d
ti��dti��d�i�i|��
S(Nc	;sld}t�i��oRti�i��dpd}t�i�i��dfd|fg�}nt�i	dt
dt
��}x�|D]�\}\\}}}|i�}||jo
|}nh�i�d<t
|i��d<|i�d	<|i�d
<|i�d<|i�d<|d
<|d<d|dd<d|dd<Vq�WdS(Nisapplication/octet-streamis(binary:%s)tfollowR;R<RERRFRHRt
targetlineR9sl%dR:s% 6d(R2RR/R0R1R.R=R,tfilerevRR?tfilenodeR@RRERRPRQ(	RstlastR8RCRARWR�R^tfnode(R5R<(s./sys/lib/python/mercurial/hgweb/webcommands.pyR�s,

		tfileannotateRRR.RRERFRGRHRLRIRJRKRM(R&R,R(R.RRNRORRRERPRGRQRURRRSRTRRV(R"R#R$RWR((R5R<s./sys/lib/python/mercurial/hgweb/webcommands.pyR�s$	csy1ti�i|���i���i�}Wn�ij
o�ti�i|idd���ii	��}t
|�}|p�nti�i|�i�}|i
d�}||jo�n|d}x%|i
|�|jo|d8}q�W�ii�|i
|���nX�i�d}�i}	td�i�|	d��t|�|	��t�id����d������fd���fd�}
ti�d|	||
�}|dd�dt�i��d	|d
�fd�d�fd
��S(NRiiR�c;smg}�i}x&t���D]}�i|�}|idh�i�d<|d<�d<t|i��d<|i�d<|i�d<t	i
|�d<t	i|�d	<t	i|�d
<|i
�d<t	i||i��d<t	i|�d
<t	i||�d<t	i||�d<�qW|djo|| }nx|D]}|VqZWdS(NiR<R�RRERFRGRLRJRKRHRRIRhR(R(RYR,R�R@RRERPRGR&RURSRTRQRoRRRpRq(R�RsR^R(R]titerfctxRa(R�R"RWR�R5R<(s./sys/lib/python/mercurial/hgweb/webcommands.pyR}8s0			
cs�id|�S(tfileid(R,(R�(R5(s./sys/lib/python/mercurial/hgweb/webcommands.pyR�TsRREtnavR}cs�dd|�S(R�i((R�(R}(s./sys/lib/python/mercurial/hgweb/webcommands.pyR�WsR�cs�dd|�S(R�i((R�(R}(s./sys/lib/python/mercurial/hgweb/webcommands.pyR�Xs(R&R,R(R.RRR-R'R!RR3R�RtlinkrevR�R�RZR�RRNR�RRE(R"R#R$tfltnumrevsRtfirsttfrevRttpagelentnodefuncR�((R<R"R�R�R}RWR5s./sys/lib/python/mercurial/hgweb/webcommands.pyRs: 

#	!'cCs�|iiddg�d}|idd�}|idd}||ijod|}tt|��n||jp|idd|t�pd|}tt	|��nt
id	d
ti
i|i��}|ii|�}|}	||jp
|djot|�}	nd||	f}
|i|\}}}
}d
|fdd|
|
ffg}|o|id|f�n|i|�|it�ti|i|||d|
�gS(NttypeiR"t
allow_archiveREsUnsupported archive type: %stallowsArchive type not allowed: %ss\W+t-Rs%s-%ssContent-TypesContent-Dispositionsattachment; filename=%s%ssContent-Encodingtprefix(R!R)R2t
configlistR~R
R
t
configboolR�RtretsubtosR.R�treponameR(tlookupRt
archive_specsR[theaderR*RRR(R"R#R$ttype_tallowedR�tmsgR�tcnodetarch_versiontnametmimetypetartypet	extensiontencodingtheaders((s./sys/lib/python/mercurial/hgweb/webcommands.pyR[s2


$	

cCs�|idd}|iddddt�}|pg|ip
ti�}t|t�o
|g}ng}|D]}|ti	i
|d�qq~}nt|||�gS(NRiR"Rt	untrusted(R!R�R2R�ttemplatepathRR�tstrR�R.RkR(R"R#R$tfnameRttpR�tp((s./sys/lib/python/mercurial/hgweb/webcommands.pyR|s
4cCs�ti|i|�i�}d}d}d|ijo7t|iid|g�d�}||idd<nti|id�}|d|d<ti|id�}|d|d<t	|i�d}t
||�}|iii|�}	t
|	�}
t
|||�}td||�}t	|i�}
ti|||
|ii�}ti|i||�}tti|��}t	|�d|d}g}x|D]�}}}}}|tijoq�nt|i��}ti|i��}ti|i��}titi|��}titi|i���}|i �}||ii!�i|�|i�jf}|i"||||||||i#�f�q�W|d	d
|d|d|d|d
|d|d|d|d|d|
d|�S(Ni'itrevcountitsessionvarsiiiR Rtuprevtlessvarstmorevarstdownrevtcanvasheighttjsdatat	bg_heightRER�($R&R�R(RR!tintR)tdefaultstcopyR3R�RRERRZR�Rt	revisionstlisttcoloredt	CHANGESETRRtageRGt	firstlineRQtcgitescapetnonemptytpersonRPRIR�R[R(R"R#R$RR	RRRtmax_revtrevnodetrevnode_hexRRRtR�tdagttreeRR/tidR�R`tvtxtedgesRERRHRPRI((s./sys/lib/python/mercurial/hgweb/webcommands.pyR �sL"*/(/R�R0R�RRR&t	mercurialRRRRtmercurial.nodeRRtmercurial.utilRtcommonRRR	R
RRR
Rt__all__RRRXRR�R�RRRRRRRRRRRRRRR (((s./sys/lib/python/mercurial/hgweb/webcommands.pys<module>s<<""					<=		!	M			E	"	.	>	!	

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.