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 :  /usr/lib64/python3.9/site-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /usr/lib64/python3.9/site-packages/mercurial/__pycache__/transaction.cpython-39.pyc
a

�+�b�g�@s�ddlmZddlZddlmZddlmZmZmZddl	m
Z
dZdZd	Z
d
Zdd�Zddd�ZGdd�dej�Zed�Zddd�ZdS)�)�absolute_importN�)�_)�error�pycompat�util)�
stringutil�sallsprefinalizespostfinalizecs�fdd�}|S)Ncs*|jdkrt�d���|g|�Ri|��S)Nrs;cannot use transaction when it is already committed/aborted)�_countr�ProgrammingError)�self�args�kwds��func��;/usr/lib64/python3.9/site-packages/mercurial/transaction.py�_active"s

�zactive.<locals>._activer)rrrrr�active!srTcCs�tt|����D]�\}}	|	s |s�|o.|df|v}
zL||d|
d�}|��|	krht�td�||	|��f��|�|	�|��Wq�t	y�|td�|��Yq�0qz|�
|�Wqt	tfy�}z|jtj
krԂWYd}~qd}~00qg}
|D�]J\}}}}||v�r"|�r"|d||f�||}z�|�r�|�r�|�|�}|�|�}|�o\||f|v}
ztj|||
d�|
�|�WnDt	�y�}z*t�|�}|td�||f�WYd}~n
d}~00nT|�p�|}z|�
|�Wn:t	tf�y}z|jtj
k�r�WYd}~n
d}~00Wq�t	ttjf�y>|�s:�Yq�0q�d|}|�|��r`|�
|�|�
|�z&|
D]}|�|��rp|�
|��qpWnt	ttjf�y�Yn0dS)	N��a)�
checkambigsBattempted to truncate %s to %d bytes, but it was already %d bytes
sfailed to truncate %s
s.couldn't handle %s: unknown cache location %s
sfailed to recover %s (%s)
�%s.backupfiles)�sorted�dict�items�tellr�Abortr�truncate�close�IOError�unlink�OSError�errno�ENOENT�joinr�copyfile�appendr�forcebytestr�exists)Zjournal�report�opener�vfsmap�entries�
backupentriesr!�checkambigfiles�f�or�fp�instZbackupfiles�l�b�c�vfs�filepath�
backuppath�excZe_msg�targetrrr�	_playback,st
���




,



r<c@speZdZdGdd�Zdd�Zdd�Zed	d
��Zedd��Z	ed
d��Z
edd��Zdd�ZedHdd��Z
dd�ZedIdd��ZedJdd��Zedd ��Zdefd!d"�Zed#d$��Zed%d&��Zed'd(��ZedKd)d*��Zd+d,�Zd-d.�Zd/d0�Zed1d2��Zed3d4��Zed5d6��Zed7d8��Zed9d:��Zed;d<��Z ed=d>��Z!ed?d@��Z"edAdB��Z#dCdD�Z$dEdF�Z%dS)L�transactionN�	<unnamed>cCsNd|_d|_||_||_|��}||d<||_||_i|_t�|_	||_
||_g|_|	durddd�}	|	|_
t�|_|
r�|j�|
�|g|_i|_i|_|�|j
d�|_g|_i|_d|j
|_|�|jd�|_|j�d	t�|du�r|�|j
|d
@�|�|j|d
@�i|_i|_d|_i|_i|_ |du�r>||j d<i|_!i|_"dS)
aBegin a new transaction

        Begins a new transaction that allows rolling back writes in the event of
        an exception.

        * `after`: called after the transaction has been committed
        * `createmode`: the mode of the journal file that will be created
        * `releasefn`: called after releasing (with transaction and result)

        `checkambigfiles` is a set of (path, vfs-location) tuples,
        which determine whether file stat ambiguity should be avoided
        for corresponded files.
        rrNcSsdS�Nr)�tr�successrrr�<lambda>�rz&transaction.__init__.<locals>.<lambda>sw+r�w�%d
i�Fs
001-userhooks)#r
�_usages�_report�_opener�copy�_vfsmap�_after�
_offsetmap�set�	_newfiles�_journal�	_undoname�_queue�
_releasefn�_checkambigfiles�update�_namesZchangesZhookargs�open�_file�_backupentries�
_backupmap�_backupjournal�_backupsfile�write�version�chmod�_filegenerators�_pendingcallback�_anypending�_finalizecallback�_validatecallback�_postclosecallback�_abortcallback)rr*r+r,ZjournalnameZundonameZafterZ
createmodeZ	validatorZ	releasefnr/�namerrr�__init__xsP


ztransaction.__init__cCsd�|j�}d||j|jfS)N�/z*<transaction name=%s, count=%d, usages=%d>)r%rTr
rE�rrerrr�__repr__�s�ztransaction.__repr__cCs|jr|��dSr?)rN�_abort�rrrr�__del__�sztransaction.__del__cCs
|jduSr?�rarkrrr�	finalized�sztransaction.finalizedcCs|j�g�dS)z�delay registration of file entry

        This is used by strip to delay vision of strip offset. The transaction
        sees either none or all of the strip actions to be done.N)rPr'rkrrr�
startgroup�sztransaction.startgroupcCs(|j��}|D]\}}|�||�qdS)z�apply delayed registration of file entry.

        This is used by strip to delay vision of strip offset. The transaction
        sees either none or all of the strip actions to be done.N)rP�pop�	_addentry)r�qr0r1rrr�endgroup�s
ztransaction.endgroupcCsP||jvs||jvs||jvr"dS|jr@|jd�||f�dS|�||�dS)z5record the state of an append-only file before updateN���)rMrKrXrPr'rq�r�file�offsetrrr�add�s���ztransaction.addcCs`||jvs||jvs||jvr"dS|r2||j|<n|j�|�|j�d||f�|j��dS)z3add a append-only entry to memory and on-disk stateN�%s%d
)rMrKrXrxrVr[�flushrurrrrqs���ztransaction._addentryTrcCs�|jrd}t�|��||jvs2||jvs2||jvr6dS|j|}|�|�\}}d|j|f}|�	||�}	|�
|�r�|�|�}
|�|	�}tj
|
||d�nd}	|�|||	df�dS)aWAdds a backup of the file to the transaction

        Calling addbackup() creates a hardlink backup of the specified file
        that is used to recover the file in the event of the transaction
        aborting.

        * `file`: the file path, relative to .hg/store
        * `hardlink`: use a hardlink to quickly create the backup
        s/cannot use transaction.addbackup inside "group"Ns%s.backup.%s��hardlinkrF)rPrrrMrKrXrI�splitrN�reljoinr)r%rr&�_addbackupentry)rrvr|�location�msgr7�dirname�filenameZbackupfilenameZ
backupfiler8r9rrr�	addbackups(
���



ztransaction.addbackupcCsB|j�|�t|j�d|j|d<|j�d|�|j��dS)z0register a new backup entry and write it to diskr�%s%s%s%d
N)rWr'�lenrXrZr[rz)r�entryrrrr:sztransaction._addbackupentrycCs|�|d|df�dS)z�register a temporary transaction file

        Such files will be deleted when the transaction exits (on both
        failure and success).
        rFN)r)rZtmpfiler�rrr�registertmpAsztransaction.registertmprFcCs|||||f}||j|<dS)a]add a function to generates some files at transaction commit

        The `genfunc` argument is a function capable of generating proper
        content of each entry in the `filename` tuple.

        At transaction close time, `genfunc` will be called with one file
        object argument per entries in `filenames`.

        The transaction itself is responsible for the backup, creation and
        final write of such file.

        The `genid` argument is used to ensure the same set of file is only
        generated once. Call to `addfilegenerator` for a `genid` already
        present will overwrite the old entry.

        The `order` argument may be used to control the order in which multiple
        generator will be executed.

        The `location` arguments may be used to indicate the files are located
        outside of the the standard directory for transaction. It should match
        one of the key of the `transaction.vfsmap` dictionary.

        The `post_finalize` argument can be set to `True` for file generation
        that must be run after the transaction has been finalized.
        N�r^)r�genid�	filenames�genfunc�orderr��
post_finalizer�rrr�addfilegeneratorJs%ztransaction.addfilegeneratorcCs||jvr|j|=dS)z=reverse of addfilegenerator, remove a file generator functionNr�)rr�rrr�removefilegeneratorrs
ztransaction.removefilegeneratorc
Cs(d}|tkrd}}n|tk}|tk}tt�|j��D]�\}}d}|\}}	}
}}|r\|r\q6n
|rf|sfq6|j|}
g}z�|	D]V}||7}|r�|j||d�d}n|j	||d�||f|j
v}|�|
|dd|d��qz|
|�|D]}|��q�|dd�=W|D]}|�
�q�q6|D]}|�
��q0q6|S)NFT)r�rC)Z
atomictempr)�
GEN_GROUP_ALL�GEN_GROUP_POST_FINALIZE�GEN_GROUP_PRE_FINALIZErrZ	iteritemsr^rIr�r�rRr'r�discard)r�suffix�group�anyZ	skip_postZskip_pre�idr�r�r�r�r�r�r7�filesrerr0rrr�_generatefilesxsD

�
�ztransaction._generatefilescCs||jvrdS|j�|�S�Nr)rMrK�get)rrvrrr�
findoffset�s
ztransaction.findoffsetcCsD|j�d�g}|j��D]$}|�d�\}}|�|t|�f�q|S)Nr�)rV�seek�	readlinesr}r'�int)rr-r4rvZtroffsetrrr�readjournal�sztransaction.readjournalcCs�||jvr*|sdS|j�|�||j|<n8||jvrZ|sN|j|=|j�|�qb||j|<nt|��|j�d||f�|j��dS)zn
        replace can only replace already committed entries
        that are not pending in the queue
        Nry)rM�removerKrx�KeyErrorrVr[rzrurrr�replace�s

ztransaction.replacecCs,|jd7_|jd7_|j�|�|S)Nr)r
rErTr'rhrrr�nest�sztransaction.nestcCsH|jdkr|jd8_|jr(|j��|jdkrD|jdkrD|��dS)Nrr)r
rErTrprjrkrrr�release�s

ztransaction.releasecCs
|jdkSr�)r
rkrrr�running�sztransaction.runningcCs||j|<dS)z�add a callback to be called when the transaction is pending

        The transaction will be given as callback's first argument.

        Category is a unique identifier to allow overwriting an old callback
        with a newer callback.
        N)r_�r�category�callbackrrr�
addpending�sztransaction.addpendingcCsLt|j�}|D] }|j�|�|�}|jp*||_q|j|jdd�O_|jS)zpwrite pending file to temporary version

        This is used to allow hooks to view a transaction before commits.pending)r�)rr_rpr`r�)r�
categories�catr�rrr�writepending�s
ztransaction.writependingcCs
||jvS)z0check is a callback already exist for a categoryrm�rr�rrr�hasfinalize�sztransaction.hasfinalizecCs||j|<dS)z�add a callback to be called when the transaction is closed

        The transaction will be given as callback's first argument.

        Category is a unique identifier to allow overwriting old callbacks with
        newer callbacks.
        Nrmr�rrr�addfinalize�s	ztransaction.addfinalizecCs||j|<dS)z�add or replace a callback to be called after the transaction closed

        The transaction will be given as callback's first argument.

        Category is a unique identifier to allow overwriting an old callback
        with a newer callback.
        N)rcr�rrr�addpostcloses	ztransaction.addpostclosecCs|j�|d�S)z1return a postclose callback added before, or NoneN)rcr�r�rrr�getpostclosesztransaction.getpostclosecCs||j|<dS)aadd a callback to be called when the transaction is aborted.

        The transaction will be given as the first argument to the callback.

        Category is a unique identifier to allow overwriting an old callback
        with a newer callback.
        N)rdr�rrr�addaborts	ztransaction.addabortcCs||j|<dS)z�adds a callback to be called when validating the transaction.

        The transaction will be given as the first argument to the callback.

        callback should raise exception if to abort transactionN)rbr�rrr�addvalidatorsztransaction.addvalidatorcCs�|jdkr~t|j�D]}|j||�qd|_|jtd�|jrl|j}i|_t|�}|D]}|||�qXq:d|_|jtd�|jd8_|jdkr�dS|j��|j	��|j
D]�\}}}}||jvr�|r�|�d||f�q�|j|}	|s�|r�|	�
|�r�z|	�|�Wq�tttjf�yZ}
z,|�s.�|�d|	�|�|
f�WYd}
~
q�d}
~
00q�i|_t�|_|��|j�r�|��d|_|j�|j��r�|j�|j�|j�|j��r�|j�|j�|j
D]�\}}}}||jv�r|�r|�d||f��q�|j|}	|�r�|	�
|��r�z|	�|�WnNtttjf�yx}
z,|�sL�|�d|	�|�|
f�WYd}
~
n
d}
~
00�q�g|_
d|_|�|d�d|_t|j�}|D]}|j||��q�d|_dS)	zcommit the transactionrN)r�rs.couldn't remove %s: unknown cache location %s
scouldn't remove %s: %s
�-couldn't remove %s: unknown cache location%s
T)r
rrbr�r�rar�rVrrZrWrIrFr)r!r r"rrr%rKrLrM�
_writeundorJrG�isfilerYrNrQrc)rr�Z	callbacksr�r�r4r0r5r6r7r3Z_frrrr's�




�
���
�
ztransaction.closecCs|��dS)z�abort the transaction (generally called on error, or when the
        transaction is not explicitly committed before going out of
        scope)N)rjrkrrr�abortysztransaction.abortcCs|jdurdSd|j}|j�|d�}|�dt�|jD]�\}}}}|sLq:|sVd}n�||jvrx|rx|�d||f�q:|j|}|�|�\}	}
|
�	|j
�s�J|
��|
�|j
|jd�}|�|	|�}t
j|�|�|�|�dd	�|�d
||||f�q:|��dS)z4write transaction data for possible future undo callNrrCrDrr�rTr{r�)rOrGrUr[r\rWrIrFr}�
startswithrNr�r~rr&r%r)rZundo_backup_pathZundobackupfiler4r0r5r6�ur7�basere�unamerrrr��s2

��
ztransaction._writeundoc
Csl|��}d|_d|_|j��|j���z"|s||js||jrJ|j�	|j�|j
r^|j�	|j
�Wd|_
|�|d�d|_dS|�t
d��zZt|j�D]}|j||�q�d|_t|j
|j|j|j||jd|jd�|�t
d��WnLt�y0}z2|�t
d��|�t
d�t�|��WYd}~n
d}~00Wd|_
|�|d�d|_nd|_
|�|d�d|_0dS)NrFstransaction abort!
�r/srollback completed
s(rollback failed - please run hg recover
s(failure reason: %s)
)r�r
rErVrrZrWrYrGr!rNrQrFrrrdr<rIrR�
BaseExceptionrr()rr-r�r:rrrrj�sV


��
��ztransaction._abort)NNNNNNr>)Tr)r)rrF)r>)&�__name__�
__module__�__qualname__rfrirl�propertyrnrrorsrxrqr�rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�r�rjrrrrr=ws~�
_


	
!�'
,


	











Q
r=s8journal was created by a different version of Mercurial
c	CsHg}g}|�|��}|��}Wd�n1s00Y|D]R}	z$|	�d�\}
}|�|
t|�f�Wq>ty�|td�t�|	��Yq>0q>d|}|�	|��r.|�|�}|��}|�r.|ddd�}
|
dt
kr�|t�nJ|dd�D]<}|r�|dd�}|�d�\}	}
}}|�|	|
|t|�f�q�t
|||||||d	�dS)
a�Rolls back the transaction contained in the given file

    Reads the entries in the specified file, and the corresponding
    '*.backupfiles' file, to recover from an incomplete transaction.

    * `file`: a file containing a list of entries, specifying where
    to truncate each file.  The file should contain a list of
    fileoffset pairs, delimited by newlines. The corresponding
    '*.backupfiles' file should contain a list of filebackupfile
    pairs, delimited by .

    `checkambigfiles` is a set of (path, vfs-location) tuples,
    which determine whether file stat ambiguity should be avoided at
    restoring corresponded files.
    Nr�s couldn't read journal entry %r!
rrrts%drr�)rUr�r}r'r��
ValueErrorrrZbytestrr)r\�BAD_VERSION_MSG�boolr<)r+r,rvr*r/r-r.r2�linesr4r0r1Z
backupjournalZver�liner5r6rrr�rollback�sD&�

�r�)TN)N)Z
__future__rr#Zi18nr�rrrZutilsrr\r�r�r�rr<Z
transactionalr=r�r�rrrr�<module>s*�
KV�

Youez - 2016 - github.com/yon3zu
LinuXploit