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__/repocache.cpython-310.pyc
o

�]Lb��@sdddlmZddlZddlZddlZddlmZmZmZm	Z	m
Z
Gdd�de�Zdd�Z
d	d
�ZdS)�)�absolute_importN�)�error�hg�obsolete�scmutil�utilc@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�
repoloaderz�Load repositories in background thread

    This is designed for a forking server. A cached repo cannot be obtained
    until the server fork()s a worker and the loader thread stops.
    cCs@|��|_tj|d�|_tj|d�|_d|_t	�
�|_d|_dS)N)�max)�maxlenF)
�copy�_uir�lrucachedict�_cache�collections�deque�_inqueue�
_accepting�	threading�Event�	_newentry�_thread)�self�uir�r�5/usr/lib/python3/dist-packages/mercurial/repocache.py�__init__s


zrepoloader.__init__cCs>|jrJ�|jjdkr
dSd|_tj|jd�|_|j��dS)NrT)�target)rrrrr�Thread�	_mainloop�start�rrrrr (s
zrepoloader.startcCsB|jsdSd|_|j��|j��d|_|j��|j��dS)NF)rrr�set�joinr�clearrr!rrr�stop1s


zrepoloader.stopcCs|j�|�|j��dS)z6Request to load the specified repository in backgroundN)r�appendrr"�r�pathrrr�load;szrepoloader.loadcCs(|jr
|j��r
t�d��|j�|d�S)z�Return a cached repo if available

        This function must be called after fork(), where the loader thread
        is stopped. Otherwise, the returned repo might be updated by the
        loader thread.
        s0cannot obtain cached repo while loader is activeN)r�is_aliver�ProgrammingErrorr�peekr'rrr�get@s
�zrepoloader.getcsv�jr9t���j���jr4�j��z�j���Wn	ty$Ynwt	�
�j��fdd���js�jsdSdS)Ncs
����S�N)�_loadr�r(rrr�<lambda>]s
z&repoloader._mainloop.<locals>.<lambda>)r�gc�collectr�waitr$r�popleft�
IndexErrorr�	callcatchr
r!rr0rrMs

���zrepoloader._mainloopcCsrt��}z|j�|�}Wntyt�|j|���}Ynwt	|�|j
�dd|t��|�|j�||�dS)Ns	repocaches&loaded repo into cache: %s (in %.3fs)
)
r�timerr�pop�KeyErrorr�
repositoryr
�
unfiltered�_warmupcacher�log�insert)rr(r �reporrrr/_s�
�zrepoloader._loadN)�__name__�
__module__�__qualname__�__doc__rr r%r)r-rr/rrrrr	s
	

r	cCsV|��|j|jj|jj|jj|jjtjD]}t�	||�q|j
�|�dSr.)�
invalidateall�	changelog�obsstore�_all�
successors�predecessors�childrenr�
cachefuncs�getrevs�_phasecache�
loadphaserevs)r@�namerrrr=rs
r=cCs�|j}|j}d|vr|d|d<}|j|j_|j_d|vr,|d|d<}|j|j_d|vr?|d|d<}|j|j_dSdS)z/Copy cached attributes from srcrepo to destrepos	changelogsobsstores_phasecacheN)�
_filecache�svfs�obj�opener�_realopener)�srcrepo�destrepo�
destfilecache�srcfilecache�cerrr�	copycaches
�r[)�
__future__rrr2r�rrrrr�objectr	r=r[rrrr�<module>s	[