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: //proc/self/root/proc/self/root/lib64/python2.7/site-packages/hgext/infinitepush/sqlindexapi.pyc
�
1�3\c@@s�ddlmZddlZddlZddlZddlZddlZddlm	Z	d�Z
de	j	fd��YZdejj
jfd	��YZdS(
i(tabsolute_importNi(tindexapicC@sH|jdd�}|jdd�}|jd�rD|d d}n|S(Nt_s\_t%s\%t*i����(treplacetendswith(tpattern((sD/usr/lib64/python2.7/site-packages/hgext/infinitepush/sqlindexapi.pyt_convertbookmarkpatterns
tsqlindexapicB@s�eZdZddd�Zd�Zd�Zd�Zd�Zd�Zd	�Z	d
�Z
d�Zd�Zd
�Z
d�Zd�ZRS(s<
    Sql backend for infinitepush index. See schema.sql
    i,ixcC@s�tt|�j�||_i|d6|d6|d6|d6|d6|_d|_d|_|sltj	}nt
jd|�t
j�|_
|j
j|�t|_|	|_|
|_dS(Nthosttporttdatabasetusertpasswordtfilename(tsuperR	t__init__treponametsqlargstNonetsqlconnt	sqlcursortostdevnulltloggingtbasicConfigt	getLoggertlogtsetLeveltFalset
_connectedt_waittimeoutt_locktimeout(tselfRR
RRR
Rtlogfiletlogleveltwaittimeouttlocktimeout((sD/usr/lib64/python2.7/site-packages/hgext/infinitepush/sqlindexapi.pyRs$	
				cC@s.|jrtjd��n|jr6tjd��nd}x�tr�y9tjj|j�|_|jj	t
�t|j_PWq?tjj
jk
r�|d8}|dkr��ntjd�q?Xq?W|jjjd|j�}|jj�|_|jjd|�|jjd	|j�t|_dS(
NsSQL connection already opens*SQL cursor already open without connectioniiig�������?s%ssSET wait_timeout=%ssSET innodb_lock_wait_timeout=%s(RRtindexexceptionRtTruetmysqlt	connectortconnectRtset_converter_classtCustomConverterRt
autocommitterrorstErrorttimetsleept	convertertescapeR tcursortexecuteR!R(R"tretryR%((sD/usr/lib64/python2.7/site-packages/hgext/infinitepush/sqlindexapi.pyt
sqlconnect6s,			
cC@sPtj��,tjd�|jj�|jj�WdQXd|_d|_dS(s(Cleans up the metadata store connection.tignoreN(twarningstcatch_warningstsimplefilterRtcloseRR(R"((sD/usr/lib64/python2.7/site-packages/hgext/infinitepush/sqlindexapi.pyR=Xs


	cC@s|js|j�n|S(N(RR8(R"((sD/usr/lib64/python2.7/site-packages/hgext/infinitepush/sqlindexapi.pyt	__enter__as	
cC@s-|dkr|jj�n
|jj�dS(N(RRtcommittrollback(R"texc_typetexc_valtexc_tb((sD/usr/lib64/python2.7/site-packages/hgext/infinitepush/sqlindexapi.pyt__exit__fsc	
C@sE|js|j�n|jjd|j|f�|jjdd||jf�x�|D]�}|jjdd|j�||jf�|j�}|j	�}|j
d|j	��}t|j�d�}t|j
d|��}|jjdd|j�|j
�|j�j�|j�j�|||||jf	�qYWdS(	NsADD BUNDLE %r %rs5INSERT INTO bundles(bundle, reponame) VALUES (%s, %s)tparamsssINSERT INTO nodestobundle(node, bundle, reponame) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE bundle=VALUES(bundle)t	committeritcommitter_dates�INSERT IGNORE INTO nodesmetadata(node, message, p1, p2, author, committer, author_date, committer_date, reponame) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)(RR8RtinfoRRR6thextextraR
tgettinttdatetdescriptiontp1tp2(	R"tbundleidtnodesctxtctxRJtauthor_nametcommitter_nametauthor_dateRG((sD/usr/lib64/python2.7/site-packages/hgext/infinitepush/sqlindexapi.pyt	addbundlels*	
	
		!	cC@s\|js|j�n|jjd|j||f�|jjdd|||jf�dS(sRTakes a bookmark name and hash, and records mapping in the metadata
        store.s&ADD BOOKMARKS %r bookmark: %r node: %rssINSERT INTO bookmarkstonode(bookmark, node, reponame) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE node=VALUES(node)REN(RR8RRHRRR6(R"tbookmarktnode((sD/usr/lib64/python2.7/site-packages/hgext/infinitepush/sqlindexapi.pytaddbookmark�s	
		cC@s�|js|j�ng}g}x@|j�D]2\}}|jd�|j|||jf�q/Wdj|�}|jjd|d|�dS(Ns(%s, %s, %s)t,siINSERT INTO bookmarkstonode(bookmark, node, reponame) VALUES %s ON DUPLICATE KEY UPDATE node=VALUES(node)RE(	RR8t	iteritemstappendtextendRtjoinRR6(R"t	bookmarkstargstvaluesRXRY((sD/usr/lib64/python2.7/site-packages/hgext/infinitepush/sqlindexapi.pytaddmanybookmarks�s	

	cC@sj|js|j�n|jjd|�x9|D]1}t|�}|jjdd||jf�q1WdS(s�Accepts list of bookmark patterns and deletes them.
        If `commit` is set then bookmark will actually be deleted. Otherwise
        deletion will be delayed until the end of transaction.
        sDELETE BOOKMARKS: %ssFDELETE from bookmarkstonode WHERE bookmark LIKE (%s) and reponame = %sREN(RR8RRHRRR6R(R"tpatternsR((sD/usr/lib64/python2.7/site-packages/hgext/infinitepush/sqlindexapi.pytdeletebookmarks�s	

	cC@s�|js|j�n|jjd|j|f�|jjdd||jf�|jj�}t|�dks�t|d�dkr�|jjd�dS|dd}|jjd|�|S(	sAReturns the bundleid for the bundle that contains the given node.sGET BUNDLE %r %rsBSELECT bundle from nodestobundle WHERE node = %s AND reponame = %sREiisNo matching nodesFound bundle %rN(
RR8RRHRRR6tfetchalltlenR(R"RYtresulttbundle((sD/usr/lib64/python2.7/site-packages/hgext/infinitepush/sqlindexapi.pyt	getbundle�s	
	(cC@s�|js|j�n|jjd|j|f�|jjdd||jf�|jj�}t|�dks�t|d�dkr�|jjd�dS|dd}|jjd|�|S(	sBReturns the node for the given bookmark. None if it doesn't exist.s"GET NODE reponame: %r bookmark: %rsFSELECT node from bookmarkstonode WHERE bookmark = %s AND reponame = %sREiisNo matching bookmarks
Found node %rN(
RR8RRHRRR6RfRgR(R"RXRhRY((sD/usr/lib64/python2.7/site-packages/hgext/infinitepush/sqlindexapi.pytgetnode�s	
		(cC@s�|js|j�n|jjd|j|f�t|�}|jjdd|j|f�|jj�}i}xL|D]D}t	|�dkr�|jjd|�qzn|d||d<qzW|S(Ns&QUERY BOOKMARKS reponame: %r query: %rsSSELECT bookmark, node from bookmarkstonode WHERE reponame = %s AND bookmark LIKE %sREisBad row returned: %sii(
RR8RRHRRRR6RfRg(R"tqueryRhR`trow((sD/usr/lib64/python2.7/site-packages/hgext/infinitepush/sqlindexapi.pytgetbookmarks�s 	
		
cC@s`|js|j�n|jjdd|j||f�|jjdd||j|f�dS(Ns.INSERT METADATA, QUERY BOOKMARKS reponame: %r snode: %r, jsonmetadata: %ssPUPDATE nodesmetadata SET optional_json_metadata=%s WHERE reponame=%s AND node=%sRE(RR8RRHRRR6(R"RYtjsonmetadata((sD/usr/lib64/python2.7/site-packages/hgext/infinitepush/sqlindexapi.pytsaveoptionaljsonmetadata�s	
		(t__name__t
__module__t__doc__RR8R=R>RDRWRZRcReRjRkRnRp(((sD/usr/lib64/python2.7/site-packages/hgext/infinitepush/sqlindexapi.pyR	s	"						
					R-cB@s2eZdZdd�Zdd�Zdd�ZRS(siEnsure that all values being returned are returned as python string
    (versus the default byte arrays).cC@s
t|�S(N(tstr(R"tvaluetdsc((sD/usr/lib64/python2.7/site-packages/hgext/infinitepush/sqlindexapi.pyt_STRING_to_python�scC@s
t|�S(N(Rt(R"RuRv((sD/usr/lib64/python2.7/site-packages/hgext/infinitepush/sqlindexapi.pyt_VAR_STRING_to_python�scC@s
t|�S(N(Rt(R"RuRv((sD/usr/lib64/python2.7/site-packages/hgext/infinitepush/sqlindexapi.pyt_BLOB_to_python�sN(RqRrRsRRwRxRy(((sD/usr/lib64/python2.7/site-packages/hgext/infinitepush/sqlindexapi.pyR-�s(t
__future__RRRR1R:tmysql.connectorR)tRRR	R*t
conversiontMySQLConverterR-(((sD/usr/lib64/python2.7/site-packages/hgext/infinitepush/sqlindexapi.pyt<module>s	�