File: //usr/lib/python3/dist-packages/mercurial/__pycache__/chgserver.cpython-310.pyc
o
�]Lb�h � @ sV d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl Z ddl
mZ ddlm
Z
mZ ddlmZ ddlmZmZmZmZmZmZ dd lmZmZmZ d
d� Zg d�Zd
gZe�dej�Z dd� Z!dd� Z"dd� Z#G dd� de$�Z%dd� Z&dd� Z'G dd� de$�Z(g d�Z)G dd� dej*�Z+d d!� Z,d"d#� Z-G d$d%� d%e$�Z.d&d'� Z/dS )(aR command server extension for cHg
'S' channel (read/write)
propagate ui.system() request to client
'attachio' command
attach client's stdio passed by sendmsg()
'chdir' command
change current directory
'setenv' command
replace os.environ completely
'setumask' command (DEPRECATED)
'setumask2' command
set umask
'validate' command
reload the config and check if the server is up to date
Config
------
::
[chgserver]
# how long (in seconds) should an idle chg server exit
idletimeout = 3600
# whether to skip config or env change checks
skiphash = False
� )�absolute_importN� )�_)�getattr�setattr)�hex)�
commandserver�encoding�error�
extensions�pycompat�util)�hashutil�procutil�
stringutilc C s t t�t�| ���� �S )z return sha1 hexdigest for a list)r r �sha1r �pprint�digest)�items� r �5/usr/lib/python3/dist-packages/mercurial/chgserver.py� _hashlistK s r )s aliass
diff-toolss eols extdiffs
extensionss fastannotates merge-toolss schemes)s commandss show.aliasprefixs~ \A(?:
CHGHG
|HG(?:DEMANDIMPORT|EMITWARNINGS|MODULEPOLICY|PROF|RCPATH)?
|HG(?:ENCODING|PLAIN).*
|LANG(?:UAGE)?
|LC_.*
|LD_.*
|PATH
|PYTHON.*
|TERM(?:INFO)?
|TZ
)\Zc s� g }t D ]
}|�| �|�� qtD ]
\}}|�| �||�� qt|�}dtjv r,dh� nt� � � fdd�t �
tj�D �}tt|��}|dd� |dd� S )a� return a quick hash for detecting config/env changes
confighash is the hash of sensitive config items and environment variables.
for chgserver, it is designed that once confighash changes, the server is
not qualified to serve its client and should redirect the client to a new
server. different from mtimehash, confighash change will not mark the
server outdated and exit since the user can have different configs at the
same time.
s CHGHGs HGc s* g | ]\}}t �|�r|� vr||f�qS r )�_envre�match��.0�k�v��ignoredr r �
<listcomp>� s ��z_confighash.<locals>.<listcomp>N� )�_configsections�append�configitems�_configsectionitems�configr r �environ�setr � iteritems�sorted)�ui�sectionitems�section�item�sectionhash�envitems�envhashr r r �_confighashr s
�r2 c C s� dd� t � | �D �}z
ddlm} |�|� W n ty Y nw g }tjr,|�tj� |D ]}z
|�t�t� |��� W q. t
yF Y q.w tt|��S )z�get a list of paths that should be checked to detect change
The list will include:
- extensions (will not cover all files for complex extensions)
- mercurial/__version__.py
- python binary
c S s g | ]\}}|�qS r r )r �n�mr r r r � s z"_getmtimepaths.<locals>.<listcomp>r )�__version__)
r � r5 r# �ImportErrorr �
sysexecutable�fsencode�inspect�
getabsfile� TypeErrorr* r( )r+ �modulesr5 �filesr4 r r r �_getmtimepaths� s"