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/fsmonitor/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib64/python3.9/site-packages/hgext/fsmonitor/__pycache__/__init__.cpython-39.pyc
a

�+�b��@sdZddlmZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZddl
mZddlmZmZmZmZmZmZmZmZmZmZmZddlmZdd	lmZmZd
dl m!Z!m"Z"m#Z#dZ$iZ%e�&e%�Z&e&d
ddd�e&d
ddd�e&d
ddd�e&d
de'd�e&d
ddd�e&d
dddd�e&dddd�ddgZ(dd �Z)d!d"�Z*d#d$�Z+e!j�,�Z-e�.��pxe�/�Z0e�1e-�e�1e0�kZ2d%d&�Z3d@d'd(�Z4dAd*d+�Z5Gd,d-�d-e6�Z7d.d/�Z8d0d1�Z9d2d3�Z:d4d5�Z;Gd6d7�d7e6�Z<d8d9�Z=dBd:d;�Z>d<d=�Z?d>d?�Z@dS)Cab	Faster status operations with the Watchman file monitor (EXPERIMENTAL)

Integrates the file-watching program Watchman with Mercurial to produce faster
status results.

On a particular Linux system, for a real-world repository with over 400,000
files hosted on ext4, vanilla `hg status` takes 1.3 seconds. On the same
system, with fsmonitor it takes about 0.3 seconds.

fsmonitor requires no configuration -- it will tell Watchman about your
repository as necessary. You'll need to install Watchman from
https://facebook.github.io/watchman/ and make sure it is in your PATH.

fsmonitor is incompatible with the largefiles and eol extensions, and
will disable itself if any of those are active.

The following configuration options exist:

::

    [fsmonitor]
    mode = {off, on, paranoid}

When `mode = off`, fsmonitor will disable itself (similar to not loading the
extension at all). When `mode = on`, fsmonitor will be enabled (the default).
When `mode = paranoid`, fsmonitor will query both Watchman and the filesystem,
and ensure that the results are consistent.

::

    [fsmonitor]
    timeout = (float)

A value, in seconds, that determines how long fsmonitor will wait for Watchman
to return results. Defaults to `2.0`.

::

    [fsmonitor]
    blacklistusers = (list of userids)

A list of usernames for which fsmonitor will disable itself altogether.

::

    [fsmonitor]
    walk_on_invalidate = (boolean)

Whether or not to walk the whole repo ourselves when our cached state has been
invalidated, for example when Watchman has been restarted or .hgignore rules
have been changed. Walking the repo in that case can result in competing for
I/O with Watchman. For large repos it is recommended to set this value to
false. You may wish to set this to true if you have a very fast filesystem
that can outpace the IPC overhead of getting the result data for the full repo
from Watchman. Defaults to false.

::

    [fsmonitor]
    warn_when_unused = (boolean)

Whether to print a warning during certain operations when fsmonitor would be
beneficial to performance but isn't enabled.

::

    [fsmonitor]
    warn_update_file_count = (integer)
    # or when mercurial is built with rust support
    warn_update_file_count_rust = (integer)

If ``warn_when_unused`` is set and fsmonitor isn't enabled, a warning will
be printed during working directory updates if this many files will be
created.
�)�absolute_importN)�_)�hex)�open)�context�encoding�error�
extensions�	localrepo�merge�pathutil�pycompat�	registrar�scmutil�util)�match)�hashutil�
stringutil�)�
pywatchman�state�watchmanclientsships-with-hg-core�	fsmonitor�modeson)�defaultswalk_on_invalidateFstimeout�2sblacklistusers�watchman_exe�watchman�verboseT)rZexperimental�experimental�fsmonitor.transaction_notifys
largefilesseolc
Cs�|�dtd�|�dd��t��}t�||�}d}z*|�d�}|�dtd�t�	|d��Wn0tj
y�}zt�|�}WYd}~n
d}~00|�
|d	td
�|�|r�dSdS)
Nsfsmonitor-watchmans/fsmonitor checking for watchman binary... (%s)
rrsversionsfsmonitor-watchman-versions watchman binary version %s
�versionsfsmonitor-watchman-errors' watchman binary missing or broken: %s
rr)�writerZ
configpath�tempfileZmkdtempr�client�commandr
Zbytestr�Unavailabler�forcebytestrZ	condwrite)�uiZfm�root�c�err�v�e�r.�>/usr/lib64/python3.9/site-packages/hgext/fsmonitor/__init__.py�debuginstall�s0
�
� �r0cCs�t|tj�rr|jr@|�dd�r@dt�|�vr@|�t�|�d�|jrN|��|�dd�r�|�ddt�|j	��n|�ddt�|��dS)z5Exception handler for Watchman interaction exceptionsrrsillegal_fstypes�
sWatchman unavailable: %s
sWatchman exception: %s
N)
�
isinstancerr&�warn�
configboolrr'�
invalidate�log�msg)r(r�exr.r.r/�_handleunavailable�s"
��r9cCs&t��}|�t�|��t�|���S)z�Calculate hash for ignore patterns and filenames

    If this information changes between Mercurial invocations, we can't
    rely on Watchman information anymore and have to re-scan the working
    copy.

    )r�sha1�updater
Zbyterepr�sysbytes�	hexdigest)�ignorer:r.r.r/�_hashignore�sr?c
Cs�z|�t�}Wn8tyF}z tjt�|�dd��WYd}~n
d}~00z|�td�}Wn4t	y�}zt�t�|���WYd}~n
d}~00|S)z�Fix path to match watchman and local filesystem encoding

    watchman's paths encoding can differ from filesystem encoding. For example,
    on Windows, it's always utf-8.
    swatchman encoding error)�hintN�strict)
�decode�_watchmanencoding�UnicodeDecodeErrorrZAbortrr'�encode�_fsencoding�UnicodeEncodeError)�pathZdecodedr-Zencodedr.r.r/�_watchmantofsencodings
�&rIc(
s"����
��fdd�}|r"|d�S�r.|d�S�
j��s@|d�S�
j}|��\}	}
}|	sn|jrf|d�Sd}	g}�
j��
j��r�t��|
kr�|	dkr�|jr�|d�Sg}d}	ntj	�tj	��j
���	�}�
j�t��d	�r܈j�d
d��
j�
�D�}
�
jj}tj}tj}tj}tj}�
j�tj�
d}d}}����r>d
}tj	�n����rLd
}|�sf�
j�rf�
j�	d}nd�	�
����\�}}|�o�|�p�|}�fdd�|D�}|�s�|�s�|�rΈD]}�|=�q��d=�SzR�
j�|jd��
j�dgd�|	ddddggd�ggt|jd�|jd��}WnFt�yf}z,t �
j!||��
j�"�|d�WYd}~Sd}~00|�#t$�%|d��|d�r�|j�r�|�&�|d�Sd
}g}�	�r��
fdd ��D��t$j'd!k}|d"D�]�}|d#}t(|t)��s�|�*t+�}t,�rt-|�}|�r|�.d!d$�}�	�r6�
|�}�	|d
d
�}|�|<|d%}|d&} ||�}!d'|v�sd|�/d(��rp|d)�S| �s�|�v�rP|�v�rP|�s��|��rPd�|<n�|!|k�r�|�v�rP|�sȈ|��rPd�|<n~|!|k�s�|!|k�r.|�v�r
|�s�|��r,|�|<n"|�s�|��rP�|��sP|�|<n"|�v�r�|�sH�|��r�d�|<�qЈ	�rp��	�
fd*d�|D�}����fd+d�|D�}"|�s�|�r�|"�0�fd,d-�|
D��|"�0�fd.d-�|D��n4|"�0��fd/d-�|
D��|"�0��fd0d-�|D��nx|�r:|"�0�fd1d-�t$�1��D��|"�0�fd2d-�|D��n:|"�0��fd3d-�t$�1��D��|"�0��fd4d-�|D��t2j3�
j4d
d5�j5��fd6d�|"D�}#|#�6�|"�7|#�}$|$D]}%d�|%<�q�t8|#�}&t�9�fd7d�|#D��D]&}'t:|&�}%|'�s�|%�v�r�|'�|%<�qވD]}�|=�q
�d=�S)8z�Replacement for dirstate.walk, hooking into Watchman.

    Whenever full is False, ignored is False, and the Watchman client is
    available, use Watchman combined with saved state to possibly return only a
    subset of files.cs"�j�d|������dd�S)Ns'fsmonitor: fallback to core status, %s
T)�full)�_ui�debug)�reason)�ignoredr�orig�self�subrepos�unknownr.r/�bail'szoverridewalk.<locals>.bailsfull rewalk requestedslisting ignored filessclient unavailablesno clocksc:0:0signore rules changeds_mapcSs,h|]$\}}|��dks$|��dkr|�qS)�n���)Zv1_stateZv1_mtime)�.0�fr-r.r.r/�	<setcomp>Ps�zoverridewalk.<locals>.<setcomp>FTNcsg|]}�|d�s|�qS)rr.)rV�d)�	dirignorer.r/�
<listcomp>s�z overridewalk.<locals>.<listcomp>�.hg皙�����?squery)rsmtimessize�exists�namesnotsanyofsdirname)r`r]s	wholenamei�)sfieldsssinces
expressionssync_timeoutsempty_on_fresh_instancesexception during runsclocksis_fresh_instancesfresh instancecsi|]}�|�|�qSr.r.)rV�k)�normcaser.r/�
<dictcomp>�r\z overridewalk.<locals>.<dictcomp>�\sfilesr`�/rr_s/.hg/s/.hgsnested-repo-detectedcs$h|]}�|��vr�|dd��qS)Tr.�rVrW)�foldmap�	normalizerbr.r/rX�s�cs0h|](}|�vr�|�r|�vs(�|�s|�qSr.r.rf)�dmapr>�matchfn�resultsr.r/rX�s �c3s|]}|�vr|VqdS�Nr.rf�rkr.r/�	<genexpr>�r\zoverridewalk.<locals>.<genexpr>c3s|]}|�vr|VqdSrlr.rfrmr.r/rn�r\c3s"|]}|�vr�|�r|VqdSrlr.rf�rjrkr.r/rn�sc3s"|]}|�vr�|�r|VqdSrlr.rfror.r/rn�r\c3s|]\}}|�vr|VqdSrlr.�rVrW�strmr.r/rn�sc3s|]}|�vr|VqdSrlr.rfrmr.r/rn�r\c3s&|]\}}|�vr�|�r|VqdSrlr.rpror.r/rn�s�c3s"|]}|�vr�|�r|VqdSrlr.rfror.r/rnr\)�cachedcsg|]}�|�r|�qSr.r.rf)�auditr.r/r[r\csg|]}�|��qSr.r.rf)�joinr.r/r[
r\);�_watchmanclientZ	available�_fsmonitorstate�get�walk_on_invalidate�_ignoreZ
_dirignorer?r�alwaysrj�_map�safehasattr�items�copymap�stat�S_IFMT�S_IFDIR�S_IFREG�S_IFLNKZ_joinrbZisexact�prefixZ
_checkcaseZ_normalizefileZ
_walkexplicit�
settimeout�timeoutr%�int�	Exceptionr9rK�clearconnectionZsetlastclockr
r<r5Zossepr2�bytesrErC�_fixencodingrI�replace�endswithr;Z	iteritemsrZpathauditor�_root�check�sort�
difference�iterZ	statfiles�next)(rOrPrrQrRrNrJrSr�clockZ
ignorehash�	notefilesZmatchalwaysZnonnormalsetr~ZgetkindZdirkindZregkindZlnkkindZfresh_instance�exactZ	skipstep3ZworkZdirsnotfound�s�resultr8Zswitch_slashes�entry�fname�normedZfmodeZfexists�kindZvisitZ	auditpassZ	auditfailrWZnfrqr.)rsrZrirgr>rNrtrrjrhrbrOrkrPrQrRr/�overridewalk sJ
�


����



����





�����

r��.c	 s�|}	|}
|}�fdd�}t|tj�r*|}
n�|}
t|tj�rD|}n�|}|��du}|of|
�dk}|prt��}|o�|��o�t|tjtjf�o�dtj	v}z8�j
jr��j�
d�n�j�
�j
jd��j��}WnTt�y*}z:�j��t�j�j
|�|||||	|
||�WYd}~Sd}~00|�r8d}n|}|�rTt|�}��|�|||||	|
||�}|\}}}}}}}|�s�g}|
�p�|jdu}�j
jdk�r�|�s�d�j_�jj}d�j_�jj�jj}}ttjd��j_�j_z:|||||	|
||�}Wd	�j_|�j_||�j_�j_n$d	�j_|�j_||�j_�j_0�� ��(||||||||g|�Wd�n1�s�0Y|\}}}}}}}t!�"|||||||�S)
Nc	s�z6dtjvr"tjd}t|d�}nd}�j�|d�}Wn,ttfyb�j�td�|�YdS0zbt	t
||��D]F\}\}}t|�t|�krt|�d|�|�d|�|�d|�qtW|�
�n
|�
�0dS)NsFSMONITOR_LOG_FILE�wbsfsmonitorfail.logswarning: unable to write to %s
s sets at position %d are unequal
swatchman returned: %r
sstat returned: %r
)r�environrZvfs�IOError�OSErrorr(r3r�	enumerate�zip�setr"�close)�l1�l2�fnrW�i�s1�s2�rPr.r/�_cmpsets's 

z overridestatus.<locals>._cmpsetsr�s
HG_PENDINGr^Tsparanoidr�F)#r2rZ	changectx�rev�matchmodrzZworkingcommitctxZmemctxrr�rvrxrur�r�Zgetcurrentclockr�r�r9r(�
poststatusZaddpostdsstatusZtraversedir�mode�dirstate�_fsmonitordisable�quiet�fout�ferrr�os�devnull�wlockr�status) rOrPZnode1Znode2rrNZcleanrRZlistsubreposZlistignoredZ	listcleanZlistunknownr�Zctx1Zctx2ZworkingZ
parentworkingZupdatestate�
startclockr8ZstateunknownZps�r�modified�added�removed�deletedrJr�r�r�Zrv2r.r�r/�overridestatuss�
���
�

��
�
�$�r�c@seZdZdd�Zdd�ZdS)r�cCst�|�|_dSrl)r
r<�_startclock)rPr�r.r.r/�__init__�szpoststatus.__init__cCsZ|��j��p|j}t|��jj�}|j|j|j	|j
|j}|��j�|||�dSrl)
�reporvZgetlastclockr�r?r�ryr�r�r�r�rRr�)rPZwctxr�r�Z
hashignorer�r.r.r/�__call__�s�����zpoststatus.__call__N)�__name__�
__module__�__qualname__r�r�r.r.r.r/r��sr�cs*G�fdd�d|j���|_|�|�dS)NcsBeZdZdd�Z��fdd�Z��fdd�Z��fdd�Z�ZS)	z'makedirstate.<locals>.fsmonitordirstatecSs&d|_|j|_|j|_t�|�|_dS�NF)r�rvru�weakref�proxyZ_repo)rPr�r.r.r/�_fsmonitorinit�sz6makedirstate.<locals>.fsmonitordirstate._fsmonitorinitcs8t�|�j}|jr ||i|��St||g|�Ri|��Srl)�super�walkr�r��rP�args�kwargsrO��	__class__�fsmonitordirstater.r/r��sz,makedirstate.<locals>.fsmonitordirstate.walkcs |j��t�|�j|i|��Srl)rvr5r��rebuild�rPr�r�r�r.r/r��s
z/makedirstate.<locals>.fsmonitordirstate.rebuildcs |j��t�|�j|i|��Srl)rvr5r�r�r�r.r/r5�s
z2makedirstate.<locals>.fsmonitordirstate.invalidate)r�r�r�r�r�r�r5�
__classcell__r.�r��r�r/r��sr�)r�r�)r�r�r.r�r/�makedirstate�sr�cCs"||�}t�|d�rt||�|S)Ns_fsmonitorstate)rr|r�)rOrPZdsr.r.r/�wrapdirstate�s
r�cCs6t�tjdt�tjr$t�tdt	�t�t
dt�dS)N�dirstatessymlinks_update)r	Z
wrapfilecacher
Zlocalrepositoryr�r
ZisdarwinZwrapfunctionr��wrapsymlinkr�
wrapupdate)r(r.r.r/�extsetup�s�r�cCs�zf|||�Wzt�tj�|�d�WSty6YS0Szt�tj�|�d�Wq�tydYq�0n.zt�tj�|�d�Wnty�Yn00dS)zyif we create a dangling symlink, also touch the parent dir
    to encourage fsevents notifications to work more correctlyN)r��utimerH�dirnamer�)rO�sourceZ	link_namer.r.r/r��s
��r�c@sFeZdZdZddd�Zdd�Zdd	�Zd
d�Zddd
�Zddd�Z	dS)�state_updatea�This context manager is responsible for dispatching the state-enter
    and state-leave signals to the watchman service. The enter and leave
    methods can be invoked manually (for scenarios where context manager
    semantics are not possible). If parameters oldnode and newnode are None,
    they will be populated based on current working copy in enter and
    leave, respectively. Similarly, if the distance is none, it will be
    calculated based on the oldnode and newnode in the leave method.NFcCs8|��|_||_||_||_||_||_d|_d|_dSr�)	�
unfilteredr��name�oldnode�newnode�distance�partial�_lock�
need_leave)rPr�r�r�r�r�r�r.r.r/r�s	
zstate_update.__init__cCs|��dSrl)�enterr�r.r.r/�	__enter__szstate_update.__enter__cCsh|jdur|jd��|_|j��durPt�|jd�rD|j��|_n|j��|_|�	dt
|j��|_|S)Nr�swlocknostateupdatesstate-enter)r�r��nodeZcurrentwlockrr|�wlocknostateupdater�r��_staterr�r�r.r.r/r�s
zstate_update.entercCs|rdnd}|j|d�dS)NTF)�abort)�exit)rP�type_�value�tbr�r.r.r/�__exit__*szstate_update.__exit__cCs�zz|jrb|rdnd}|jdur.|jd��|_|jdurLt|j|j|j�|_|jdt|j�|d�Wd|_|j	r�|j	�
�nd|_|j	r�|j	�
�0dS)Nsfailed�okr�sstate-leave)r�F)r�r�r�r�r��calcdistancer�r�rr��release)rPr�r�r.r.r/r�.s 

��zstate_update.exitr�c
Cs�t�|jd�sdSz6|jj�||j||jr0|jnd||jd�d��WdSty�}z"|jj	�
dd||�WYd}~dSd}~00dS)	Ns_watchmanclientFr)srevsdistancesstatusspartial)r`smetadataTrsException %s while running %s
)rr|r�rur%r�r�r�r�r(r6)rP�cmdZ
commithashr�r-r.r.r/r�>s&����zstate_update._state)NNNF)F)r�)
r�r�r��__doc__r�r�r�r�r�r�r.r.r.r/r��s�

r�cCsF|j�||�}||��}t||��|�t||��|�}|Srl)Z	changelog�ancestorr��abs)r�r�r�ZancZancrevr�r.r.r/r�\s�r�c	
Ks�d}
d}|d��}||��}
|dus0|��rDd}t|��||
�}
t|d||
|
|d��.|||||||||fi|	��Wd�S1s�0YdS)NrTr�Fs	hg.update)r�r�r�r�r�)r�rzr�r�r�)rOr�r�Zbranchmerge�forcer�Z
mergeancestor�labelsZmatcherr�r�r�r�r�r.r.r/r�is6
��	�r�cCsH|j��D]8}tj�tj�|j|d��r
d}|j�||�dSq
dS)Nr]s:fsmonitor: sub-repository %r detected, fsmonitor disabled
TF)	�wvfs�listdirr�rH�isdirrtr)r(rL)r�rWr7r.r.r/�repo_has_depth_one_nested_repo�src	
st��}tD]$}||vr��td�|�dSq|���r|j�d�sT|j�d�rXdSt|�rddSt	�	|�}|j
dkr|dSzt�|j
|j�}Wn2ty�}zt�||�WYd}~dSd}~00||_||_t�|d�\}}|r�t||�G��fdd�d|j���|_dS)NsUThe fsmonitor extension is incompatible with the %s extension and has been disabled.
s.hgsubstates.hgsubsoffr�cs<eZdZ��fdd�Z��fdd�Z���fdd�Z�ZS)z reposetup.<locals>.fsmonitorrepocs$t�|�j}t||g|�Ri|��Srl)r�r�r�r��r��
fsmonitorrepor.r/r��sz'reposetup.<locals>.fsmonitorrepo.statuscst�|�j|i|��Srl)r�r�r�rr.r/r��sz3reposetup.<locals>.fsmonitorrepo.wlocknostateupdatec
s�t�|�j|i|�����dd�s&�S�jdkr4�S�j���fdd�}z(d�_t|dd��_�j��|�_Wn4ty�}z|j	�
dd	|�WYd}~n
d}~00�S)
Nrr rcs$�r
���jr �j��d�_dSrl)�stateupdater�r.��lZorigreleaser.r/�staterelease�s

z<reposetup.<locals>.fsmonitorrepo.wlock.<locals>.statereleaseshg.transaction)r�rsException in state update %s
)r�r�r4ZheldZ	releasefnrr�r�r�r(r6)rPr�r�r
r-)r�rr(rr/r��s&�


�z&reposetup.<locals>.fsmonitorrepo.wlock)r�r�r�r�r�r�r�r.�rr(r�r/r�sr)r	Zenabled�
_blacklistr3r�localr�existsrrr�rr$r(r)r�r9rvrur
Zisfilecachedr�r�)	r(r�Zexts�extZfsmonitorstater$r8r�rrr.rr/�	reposetup�s>���



%r)T)r�NNFFFF)NFNN)Ar�Z
__future__r�codecsr�r�sysr#r�Zmercurial.i18nrZmercurial.noderZmercurial.pycompatrZ	mercurialrrrr	r
rrr
rrrrr�Zmercurial.utilsrr�rrrZ
testedwithZconfigtableZ
configitem�listrr0r9r?Zget_local_encodingrC�getfilesystemencoding�getdefaultencodingrF�lookupr�rIr�r��objectr�r�r�r�r�r�r�r�rrr.r.r.r/�<module>s�f4


�������

|�
`�
*	

Youez - 2016 - github.com/yon3zu
LinuXploit