HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/mercurial/__pycache__/dirstateguard.cpython-310.pyc
o

�]LbY�@sNddlmZddlZddlmZddlmZmZmZm	Z	Gdd�de	j
�ZdS)�)�absolute_importN�)�_)�error�
narrowspec�requirements�utilc@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�
dirstateguardanRestore dirstate at unexpected failure.

    At the construction, this class does:

    - write current ``repo.dirstate`` out, and
    - save ``.hg/dirstate`` into the backup file

    This restores ``.hg/dirstate`` from backup file, if ``release()``
    is invoked before ``close()``.

    This just removes the backup file at ``close()`` before ``release()``.
    csx�|_d|_d|_�fdd�}|d|�|_�j����|j�d|_tj	�jvr7|d|�|_t
��|j�d|_dS)NFcs �jj|d�\}}t�|�|S)N)�prefix)�vfs�mkstemp�os�close)r
�fd�fname��repo��9/usr/lib/python3/dist-packages/mercurial/dirstateguard.py�getname(s
z'dirstateguard.__init__.<locals>.getnamesdirstate.backup.%s.snarrowspec.backup.%s.T)�_repo�_active�_closed�_backupname�dirstate�
savebackup�currenttransaction�_narrowspecbackupnamer�NARROW_REQUIREMENTr�savewcbackup)�selfr�namerrrr�__init__#s�
zdirstateguard.__init__cCs|jr	|��dSdS)N)r�_abort�r rrr�__del__9s�zdirstateguard.__del__cCs\|jstd�|j}t�|��|jj�|j��|j�|j	r&t
�|j|j	�d|_d|_dS)Ns*can't close already inactivated backup: %sFT)
rrrr�Abortrr�clearbackuprrr�
clearwcbackupr�r �msgrrrrAs��
�
zdirstateguard.closecCs8|jrt�|j|j�|jj�|j��|j�d|_dS)NF)	rr�restorewcbackuprr�
restorebackuprrrr$rrrr#Qs�
zdirstateguard._abortcCs4|js|jstd�|j}t�|��|��dSdS)Ns,can't release already inactivated backup: %s)rrrrrr&r#r)rrr�releaseYs��
�zdirstateguard.releaseN)	�__name__�
__module__�__qualname__�__doc__r"r%rr#r-rrrrr	s
r	)�
__future__rr
�i18nr�rrrr�
transactionalr	rrrr�<module>s