403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /lib64/python3.9/site-packages/hgext/infinitepush/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib64/python3.9/site-packages/hgext/infinitepush/__pycache__/sqlindexapi.cpython-39.opt-1.pyc
a

�+�b�&�@s�ddlmZddlZddlZddlZddlZddlZddlm	Z	ddl
mZdd�ZGdd	�d	ej�Z
Gd
d�dejjj�ZdS)�)�absolute_importN)�pycompat�)�indexapicCs6|�dd�}|�dd�}|�d�r2|dd�d}|S)N�_s\_�%s\%�*���)�replace�endswith)�pattern�r
�D/usr/lib64/python3.9/site-packages/hgext/infinitepush/sqlindexapi.py�_convertbookmarkpatterns

rcs�eZdZdZd�fdd�	Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Z�ZS)�sqlindexapiz<
    Sql backend for infinitepush index. See schema.sql
    �,�xcsttt|���||_|||||d�|_d|_d|_|s<tj}t	j
|d�t	��|_|j�
|�d|_|	|_|
|_dS)N)shostsportsdatabasesuserspassword)�filenameF)�superr�__init__�reponame�sqlargs�sqlconn�	sqlcursor�os�devnull�loggingZbasicConfigZ	getLogger�logZsetLevel�
_connected�_waittimeout�_locktimeout)�selfr�host�portZdatabase�user�passwordZlogfileZloglevel�waittimeoutZlocktimeout��	__class__r
rr#s$
�
zsqlindexapi.__init__cCs�|jrt�d��|jr t�d��d}z2tjjfi|j��|_|j�t	�d|j_
Wq�Wq$tjjjy�|d8}|dkr|�t
�d�Yq$0q$|jj�d|j�}|j��|_|j�d	|�|j�d
|j�d|_dS)NsSQL connection already opens*SQL cursor already open without connection�Frrg�������?s%ssSET wait_timeout=%ssSET innodb_lock_wait_timeout=%sT)rrZindexexceptionr�mysql�	connectorZconnectrZset_converter_class�CustomConverterZ
autocommit�errors�Error�time�sleepZ	converter�escaperZcursor�executer r)r!Zretryr&r
r
r�
sqlconnectDs0
��zsqlindexapi.sqlconnectcCsVt���.t�d�|j��|j��Wd�n1s<0Yd|_d|_dS)z(Cleans up the metadata store connection.signoreN)�warnings�catch_warnings�simplefilterr�closer�r!r
r
rr7hs


(zsqlindexapi.closecCs|js|��|S�N)rr3r8r
r
r�	__enter__qszsqlindexapi.__enter__cCs"|dur|j��n
|j��dSr9)rZcommitZrollback)r!�exc_typeZexc_valZexc_tbr
r
r�__exit__vszsqlindexapi.__exit__c	Cs�|js|��|j�d|j|f�|jjd||jfd�|D]�}|jjd|��||jfd�|��}|�	�}|�
d|�	��}t|��d�}t|�
d|��}|jjd|��|�
�|����|����|||||jf	d�q>dS)	NsADD BUNDLE %r %rs5INSERT INTO bundles(bundle, reponame) VALUES (%s, %s)��paramsssINSERT INTO nodestobundle(node, bundle, reponame) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE bundle=VALUES(bundle)s	committerrscommitter_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))rr3r�inforrr2�hex�extrar$�get�int�date�descriptionZp1Zp2)	r!ZbundleidZnodesctx�ctxrAZauthor_nameZcommitter_nameZauthor_dateZcommitter_dater
r
r�	addbundle|s<��

��zsqlindexapi.addbundlecCsB|js|��|j�d|j||f�|jjd|||jfd�dS)zRTakes 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)r=N�rr3rr?rrr2)r!�bookmark�noder
r
r�addbookmark�s
��
�zsqlindexapi.addbookmarkcCsh|js|��g}g}t�|�D]$\}}|�d�|�|||jf�q d�|�}|jj	d||d�dS)Ns(%s, %s, %s)�,siINSERT INTO bookmarkstonode(bookmark, node, reponame) VALUES %s ON DUPLICATE KEY UPDATE node=VALUES(node)r=)
rr3rZ	iteritems�append�extendr�joinrr2)r!�	bookmarks�args�valuesrIrJr
r
r�addmanybookmarks�s

��zsqlindexapi.addmanybookmarkscCsJ|js|��|j�d|�|D]"}t|�}|jjd||jfd�q"dS)z�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 = %sr=N)rr3rr?rrr2r)r!�patternsrr
r
r�deletebookmarks�s�zsqlindexapi.deletebookmarkscCs�|js|��|j�d|j|f�|jjd||jfd�|j��}t|�dks`t|d�dkrp|j�d�dS|dd}|j�d|�|S)	zAReturns the bundleid for the bundle that contains the given node.sGET BUNDLE %r %rsBSELECT bundle from nodestobundle WHERE node = %s AND reponame = %sr=rrsNo matching nodeNsFound bundle %r�	rr3rr?rrr2�fetchall�len)r!rJ�resultZbundler
r
r�	getbundle�s�
zsqlindexapi.getbundlecCs�|js|��|j�d|j|f�|jjd||jfd�|j��}t|�dks`t|d�dkrp|j�d�dS|dd}|j�d|�|S)	zBReturns 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 = %sr=rrsNo matching bookmarkNs
Found node %rrV)r!rIrYrJr
r
r�getnode�s ��
zsqlindexapi.getnodecCs�|js|��|j�d|j|f�t|�}|jjd|j|fd�|j��}i}|D]2}t	|�dkrv|j�d|�qT|d||d<qT|S)Ns&QUERY BOOKMARKS reponame: %r query: %rsSSELECT bookmark, node from bookmarkstonode WHERE reponame = %s AND bookmark LIKE %sr=�sBad row returned: %srr)
rr3rr?rrrr2rWrX)r!�queryrYrP�rowr
r
r�getbookmarks�s$��
zsqlindexapi.getbookmarkscCsB|js|��|j�d|j||f�|jjd||j|fd�dS)NsHINSERT METADATA, QUERY BOOKMARKS reponame: %r node: %r, jsonmetadata: %ssPUPDATE nodesmetadata SET optional_json_metadata=%s WHERE reponame=%s AND node=%sr=rH)r!rJZjsonmetadatar
r
r�saveoptionaljsonmetadata
s
��
�z$sqlindexapi.saveoptionaljsonmetadata)rr)�__name__�
__module__�__qualname__�__doc__rr3r7r:r<rGrKrSrUrZr[r_r`�
__classcell__r
r
r'rrs �!$	'rc@s.eZdZdZd	dd�Zd
dd�Zddd�ZdS)r,ziEnsure that all values being returned are returned as python string
    (versus the default byte arrays).NcCst|�Sr9��str�r!�valueZdscr
r
r�_STRING_to_python#sz!CustomConverter._STRING_to_pythoncCst|�Sr9rfrhr
r
r�_VAR_STRING_to_python&sz%CustomConverter._VAR_STRING_to_pythoncCst|�Sr9rfrhr
r
r�_BLOB_to_python)szCustomConverter._BLOB_to_python)N)N)N)rarbrcrdrjrkrlr
r
r
rr,s

r,)Z
__future__rrrr/r4Zmysql.connectorr*Z	mercurialr�rrrr+�
conversionZMySQLConverterr,r
r
r
r�<module>s

Youez - 2016 - github.com/yon3zu
LinuXploit