HEX
Server: Apache
System: Linux p102.lithium.hosting 4.18.0-553.141.1.el8_10.x86_64 #1 SMP Fri Jul 10 17:48:02 UTC 2026 x86_64
User: bvzmoamr (9955)
PHP: 8.1.34
Disabled: syslog
Upload Files
File: //usr/lib64/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.pyc
�
1�3\c@@smddlmZddlZddlZddlZddlmZddlmZm	Z	m
Z
mZmZm
Z
mZmZmZddlmZmZmZmZmZmZmZmZmZmZmZmZddlmZm Z!m"Z"m#Z#dd	l$m%Z%d
�Z&d�Z'd�Z(d
�Z)dd�Z*d�Z+de,dd�Z-de.fd��YZ/dS(i(tabsolute_importNi(t_i(	t
ErrorResponsetHTTP_SERVER_ERRORt	cspvaluestget_contactt	get_mtimetismembert	paritygent
staticfilet
statusmessage(tconfigitemstencodingterrorthgt	profilingtpycompatt	registrartscmutilt	templaterttemplateutiltuitutil(t	hgweb_modtrequesttwebutiltwsgicgi(tdateutilcC@s5g|D]*\}}tj|�jd�|f^qS(Nt/(Rtpconverttstrip(titemstnametpath((sB/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.pyt
cleannames4scC@s�g}x�t|�D]�\}}tjj|�\}}yitd6td6|}Wn'tk
r||j||f�qnXtjjtjj	|��}t
j|dtd|�}|jt
|||��qW|S(Nt*s**t	followsymtrecurse(R"tosR!tsplittFalsetTruetKeyErrortappendtnormpathtabspathRt	walkrepostextendturlrepos(tpathstrepostprefixtroottrootheadtroottailR%((sB/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.pyt	findrepos7s
cc@s_xX|D]P}tjj|�}|dtj|t|��jd�jd�|fVqWdS(s�yield url paths and filesystem paths from a list of repo paths

    >>> conv = lambda seq: [(v, util.pconvert(p)) for v,p in seq]
    >>> conv(urlrepos(b'hg', b'/opt', [b'/opt/r', b'/opt/r/r', b'/opt']))
    [('hg/r', '/opt/r'), ('hg/r/r', '/opt/r/r'), ('hg', '/opt')]
    >>> conv(urlrepos(b'', b'/opt', [b'/opt/r', b'/opt/r/r', b'/opt']))
    [('r', '/opt/r'), ('r/r', '/opt/r/r'), ('', '/opt')]
    RN(R&R!R,RRtlentlstripR(R3R5R1R!((sB/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.pyR0Is	
cC@s}|j}|jdddt�}|rD|s@t|||�rDtS|jdddt�}|sut|||�rytStS(s�Check allow_read and deny_read config options of a repo's ui object
    to determine user permissions.  By default, with neither option set (or
    both empty), allow all users to read the repo.  There are two ways a
    user can be denied read access:  (1) deny_read is not empty, and the
    user is unauthenticated or deny_read contains user (or *), and (2)
    allow_read is not empty and the user is not in allow_read.  Return True
    if user is allowed to read the repo, else return False.twebt	deny_readt	untrustedt
allow_read(t
remoteusert
configlistR)RR((RtreqtuserR;R=((sB/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.pytreadallowedWs		tc#@s�|jdd�}|jdd�}t�}t�}x�|D]~\}}	|j|�s^q=n|t|�}t}
d|kr?|s�q=n|jd�}|d}|s�q?||kr�q=q?||kr�q?t}
|}dj|d�}
|	t|
�d }	ytj	||	�}t}
Wq?t
tjfk
r;q?Xn|j
jd�|jd�|jd�g}ddjd�|D��d}|
rdy t|	�tj�df}Wntk
r�q=nXidd	6dd
6|dd6|d6|d
6dd6dd6|d6|d|dd6tjg�d6td6tjgdd�d6}|j|�|Vq=n|j��y#�jtjj|	dd��Wn3tk
r�}�jtd�|	|f�q=nXtj�fd�}�jdddt�r�q=nt �|�sq=nytj	||	�}WnXt
k
rT�jtd�|	�q=n.tjk
r��jtd�|	�q=nXy#t|j!�tj�df}Wntk
r�q=nXt"|�}|dd�}|j|�|dd|�}�j#dddt�}i|pdd	6|j$�p-dd
6|d6|d6|d
6|pOdd6|j$�pbdd6|d6|d|dd6t%j&�d|�d6dd6tj|dd�d6}|Vq=WdS(NR:tdescendtcollapseRiics@s|]}|r|VqdS(N((t.0tp((sB/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.pys	<genexpr>�sRCtcontacttcontact_sortR t	name_sortturltdescriptiontdescription_sortt
lastchangetlastchange_sorttarchivestisdirectorytlabeltlabelss.hgthgrcserror reading %s/.hg/hgrc: %s
c@s�j|||dt�S(NR<(tconfigR)(tsectionR tdefault(tu(sB/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.pytget�sthiddenR<s!error accessing repository at %s
tunknownttip((t
configbooltsett
startswithR8R(R'R)tjoinRt
repositorytIOErrorR
t	RepoErrortapppathRRRtmakedatetOSErrorRtmappinglistt
hybridlisttaddtcopyt
readconfigR&R!t	ExceptiontwarnRtuimodt_unsetRBtspathRR?tupperRtarchivelisttNone(RR2R@tsubdirRDREt	seenrepostseendirsR R!t	directoryt	namepartstrootnamet	discardedtrtpartsRKtdtrowteRYRHRLRS((RXsB/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.pytrawindexentriesms�		

! 


#
#


c#@s�t|||d|�}dtf}	|rj|	||fkrjd|�t|d�fd�d|�}nx2t|t|��D]\}
}||
d<|
Vq�WdS(NRts%s_sorttkeyc@s|�S(N((tx(tsortkey(sB/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.pyt<lambda>�RCtreversetparity(R�RsR(tsortedtzipR(tcontextRR2R@tstripecountt
sortcolumnt
descendingRttrowstsortdefaultR~R�((R�sB/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.pyt_indexentriesgen�s
"
cC@s.|||||||f}tjtd|�S(Ntargs(RtmappinggeneratorR�(RR2R@R�R�R�RtR�((sB/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.pytindexentries�sthgwebdircB@s\eZdZd
d�Zd�Zd�Zd�Zd�Zd�Z	dd�Z
d	�ZRS(s�HTTP server for multiple repositories.

    Given a configuration, different repositories will be served depending
    on the request path.

    Instances are typically used as WSGI applications.
    cC@s;||_||_d|_d|_d|_|j�dS(Ni(tconftbaseuiRsRtlastrefreshtmotdtrefresh(tselfR�R�((sB/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.pyt__init__s					c
C@s�|jr!|jjdd�}ntjdd}|j}|dkrd|j|tj�krddS|jr|jj�}nQt	jj
�}|jdddd�|jddd	d�|jd
dd	d�t|j
tttf�s�id
d6}tjj|j
�s,tjtd�|j
��n|j|j
d|dt�g}x�|jd
�D]<\}}x-|jd
|�D]}|j||f�q}Wq^WnHt|j
ttf�r�|j
}n$t|j
t�r�|j
j�}nt|�}	x�|jd�D]�\}
}tj|
�}
x|tj |dt�D]e}tjj!|�}tj|�}|j"|
�r|t#|
�}n|	j|j$d�|f�q6WqW|	|_%||_|jj&dd�t'_'|jj&dd�|_(|jj&dddt)�|_*|jj&dd�|_+|j+r9t,|j+�|_+n|jj&dd�}
|
j"d�rj|
d}
n|
j-d�r�|
d }
n|
|_.tj�|_dS(NR:trefreshintervaliRtreport_untrustedtoffR�tnonttyttruetprogresstdisablethgwebshgweb-pathsR1sconfig file %s not found!tremapttrusttcollectionsR$RRtstylet	templatesR<tstripesR3ii����(/Rt	configintRt	coreitemsRWR�ttimeR�RjRntloadt	setconfigt
isinstanceR�tdicttlistttupleR&R!texistsR
tAbortRRkR)R?R+RR7RRRR.R,R_R8R9R2RURR�R(ttemplatepathR�tinttendswithR3(
R�R�titemRXtmapR1R tignoredR!R2R3R4trepo((sB/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.pyR�sd			
$			

	cC@s>tjjdd�jd�s-td��ntj|�dS(NtGATEWAY_INTERFACERCsCGI/1.sJThis function is only intended to be called while running as a CGI script.(RtenvironRYR_tRuntimeErrorRtlaunch(R�((sB/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.pytrunNscC@sL|jjdd�}tj|d|�}tj||�}|j||�S(NR:tbaseurlt
altbaseurl(RRUt
requestmodtparserequestfromenvtwsgiresponsetrun_wsgi(R�tenvtrespondR�R@tres((sB/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.pyt__call__Uscc@sl|jjdd�}tj|jd|��9z&x|j||�D]}|VqDWWdtj�XWdQXdS(NRtenabled(RR]Rtprofilet_runwsgitgctcollect(R�R@R�R�R{((sB/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.pyR�\s
	c	@s1z#y�|j�t|j�\}}|r;||jd<n|jjd��|j||�}|jditjd6�}d|_	||jd<�j
d�s�d|jkrn�j
d�r��d	}n
|jd}|jjd
ddt
�}|sT|jptj�}	t|	t�r)|	g}	ng|	D]}
tjj|
d�^q0}nt|||�|j�St|j�}�s��dkr��|kr�|j|||�S�jd
�r�|kr�td� �t�fd�|D��r|j|||��Sn�fd�}x |�D]}
|j|
�}|r)|j}tj rod�|j!�D�}nt"j#|d|
d|jjd
d�d|j$�}y8t%j&|jj'�|�}t(j)|�j*||�SWq>t+k
r}tj,|j-�}t.t/|��q>t0j1k
r:}t.t/t2|���q>Xq)q)W�d�g|D]}|j
��rS|^qSr�|j|||��Sd|_	|j3|j4di�d6��|j�SWnat.k
r!}t5|j6tj7|��|_	|j3|j4di|j8pdd6��|j�SXWdd}XdS(NsContent-Security-PolicyRtmimetypeRs200 Script output followssContent-Typesstatic/tstaticiR:R<tindexs/indexc3@s|]}|j��VqdS(N(R_(RFR{(Rt(sB/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.pys	<genexpr>�sc3@s<�dkr3�Vxtj��D]}|Vq!WndVdS(NRC(Rtfinddirs(RG(tvirtual(sB/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.pyt_virtualdirs�s
cS@s(i|]\}}||jd��qS(tlatin1(tdecode(RFtktv((sB/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.pys
<dictcomp>�s	treponameR�R�tbodyfhs
404 Not FoundtnotfoundR�R
RC(:R�RRtheaderstdispatchpathRRtrenderRtstatusR_tqsparamsRUR(R�t
templatepathsR�tstrR&R!R`R	tsendresponseR�R2t	makeindexR�R8tanyRYtrawenvRtispy3t	iteritemsR�R�R�RRaRjRR�R�Rbt
strtolocaltstrerrorRRR
Rctbytest
setbodygentgenerateR
tcodetbytestrtmessageRs(R�R@R�tcsptnoncettmpltctypetfnameR�ttpRGR2R�tvirtualrepotrealtuenvR�tinsttmsgR{R((RtR�sB/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.pyR�lsz
	


+

		 
(	 )RCcC@sk|j�ddddg}dt}}d|jkr|jd}|jd�}|rg|d}n||krd}qng|D]9}d	|d
|r�||kr�dp�d|ff^q�}	|j�t|j|j||jd|d|d
|�}
i|
d6|d
6t	j
d||j�d6|d6|d6}|j|	�|j
|jd|��|j�S(NR RLRHRNtsortt-iRCssort_%ss%s%sR�R�RttentriesRtpathdefR�(R�RsR(R�R_R�RR2R�RtmakebreadcrumbR3tupdateR�R�R�(R�R@R�R�RttsortableR�R�tcolumnR�R�tmapping((sB/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.pyR��s2



C


c@sgtjt�fd��i}tj|��j�\}\}}||dkr_||d<ntj|d�}�dd�}�dd�}	�dd�p�|jj	d	�d
}
|
j
d	�s�|
d	7}
nitjd6|jd	d6|d6|	d6|
d6|d
6|d6|d6}tj
|�}|ddd���fd��}
tjj|d|�}|S(Nc@s�jj||||�S(N(RRU(RVR RWR<(R�(sB/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.pyRU�siR�t?R:tlogourltlogoimgt	staticurlRs/static/RRKtsessionvarsR�R�trequiresc3@s,�jdk	r�jVn�dd�VdS(NR:R�(R�Rs(R�R(RUR�(sB/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.pyR�stdefaults((RnRoR)RtgetstyleR�RR	RdtrstripR�RRttemplatekeywordRtfrommapfile(R�R@R�tvarststylesR�tmapfileR	RRRRRR�R�((RUR�sB/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.pyR�s4



$N(t__name__t
__module__t__doc__RsR�R�R�R�R�R�R�R(((sB/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.pyR�s	>				b"(0t
__future__RR�R&R�ti18nRtcommonRRRRRRRR	R
RCRRR
RRRRRRRRRnRRRR�RRtutilsRR"R7R0RBR�R�R(R�tobjectR�(((sB/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.pyt<module>	s"@R"