HEX
Server: Apache
System: Linux p102.lithium.hosting 4.18.0-553.141.1.el8_10.x86_64 #1 SMP Fri Jul 10 17:48:02 UTC 2026 x86_64
User: bvzmoamr (9955)
PHP: 8.1.34
Disabled: syslog
Upload Files
File: //proc/thread-self/root/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyo
�
1�3\c@@s�dZddlmZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZddl
mZmZmZmZmZmZmZmZmZmZmZddl
mZdd	lmZmZmZd
ZiZ ej!e �Z!e!ddd
d�e!ddd
e"�e!ddd
d�e!ddd
e#�e!ddd
e"�ddgZ$d�Z%d�Z&ejj'�Z(ej)�p�ej*�Z+ej,e(�ej,e+�kZ-d�Z.e/d�Z0ddde"e"e"e"d�Z2de3fd��YZ4d�Z5d �Z6d!�Z7d"�Z8d#e3fd$��YZ9d%�Z:de"ddd&�Z;d'�Z<dS((s	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)

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.
i(tabsolute_importN(t_(thex(tcontexttencodingterrort
extensionst	localrepotmergetpathutiltpycompatt	registrartscmutiltutil(tmatchi(t
pywatchmantstatetwatchmanclientsships-with-hg-coret	fsmonitortmodetdefaulttontwalk_on_invalidatettimeoutt2tblacklistuserstexperimentalsfsmonitor.transaction_notifyt
largefilesteolcC@s{t|tj�rd|jr5|jt|�d�n|jrK|j�n|jdd|j�n|jdd|�dS(s5Exception handler for Watchman interaction exceptionss
RsWatchman unavailable: %s
sWatchman exception: %s
N(t
isinstanceRtUnavailabletwarntstrt
invalidatetlogtmsg(tuiRtex((s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyt_handleunavailable�s		
cC@s)tj�}|jt|��|j�S(s�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.

    (thashlibtsha1tupdatetreprt	hexdigest(tignoreR(((s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyt_hashignore�scC@s�y|jt�}Wn.tk
rC}tjt|�dd��nXy|jtd�}Wn(tk
r�}tjt|���nX|S(s�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.
    thintswatchman encoding errortstrict(	tdecodet_watchmanencodingtUnicodeDecodeErrorRtAbortR tencodet_fsencodingtUnicodeEncodeError(tpathtdecodedtetencoded((s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyt_watchmantofsencoding�sc.	@s����
��fd�}|r.|d�S�r>|d�S�
jj�sW|d�S�
j}|j�\}	}
}|	s�|jr�|d�Sd}	g}n�
fd�}d�}
�
j��
j}�rt��|
kr"|	dkr"|jr�|d	�Sg}d}	q"ntj	�tj	}�j
��j	�}�
j�tj�d
�r^�j�n�
jj
}�
jj}tj}tj}tj}tj}�
j}tj�t}t}}�j�r�t}tj	}n�j�r�t}n|r�
jr�
j�t}nd1��
j���\�	}}|oB|pA|}g|D]}||d�sL|^qL}|r�|s�|r�x�D]
}�	|=q�W�	d=�	Sy��
jj|jd
��
jj didddddgd6|	d6ddddgdddgggd6t!|jd�d6|jd6�}Wn:t"k
rp}t#�
j$||��
jj%�|d�SX|j&|d�|d r�|jr�|j'�|d!�St}g}n�r�t(�fd"��	D���nt)j*d#k} x�|d$D]�}!|!d}"t+rt,|"�}"n| r7|"j-d#d%�}"n�rh�|"�}#�|"tt�}"|"�|#<n|!d}$|!d}%||$�}&|%s�|"�	kr�|"�kr�|s��|"�r�d1�	|"<q�q�|&|kr|"�kr�|s��|"�r�d1�	|"<q�q�|&|ks|&|krw|"�krH|s8�|"�rt|!�	|"<qtq�|sZ�|"�r��|"�r�|!�	|"<q�q�|"�kr�|s��|"�r�d1�	|"<q�q�W�r�t.���fd&�|D��}nt.����	fd'�|D��}'|s�|r?|'j/�	fd(�|D��|'j/�	fd)�|D��q|'j/��	fd*�|D��|'j/��	fd+�|D��n�|r�|'j/�	fd,��j0�D��|'j/�	fd-�|D��nF|'j/��	fd.��j0�D��|'j/��	fd/�|D��t1j2�
j3d0t�j4}(g|'D]})|(|)�r3|)^q3}*|*j5�|'j6|*�}+x|+D]})d1�	|)<qqWt7|*�j8},xXtj9g|*D]})||)�^q��D].}-|,�})|-s�|)�kr�|-�	|)<q�q�Wx�D]
}�	|=q�W�	d=�	S(2s�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.c@s-�jjd|������dt�S(Ns'fsmonitor: fallback to core status, %s
tfull(t_uitdebugtTrue(treason(tignoredRtorigtselftsubrepostunknown(s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pytbail�ssfull rewalk requestedslisting ignored filessclient unavailablesno clocksc:0:0c@s'�jjd�j|�|f�tS(Ns%s: %s
(R=RtpathtotFalse(tfR#(RC(s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pytfwarn�s#cS@s�td�}tj|�r*td�}nxtj|�rHtd�}nZtj|�rftd�}n<tj|�r�td�}ntj|�r�td�}ntd�|S(NREscharacter devicesblock devicetfifotsockett	directorys"unsupported file type (type is %s)(RtstattS_ISCHRtS_ISBLKtS_ISFIFOtS_ISSOCKtS_ISDIR(Rtkind((s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pytbadtype�ssignore rules changedt_mapis.hgg�������?tqueryRtmtimetsizetexiststnametfieldstsincetnottanyoftdirnamet	wholenamet
expressioni�tsync_timeouttempty_on_fresh_instancesexception during runtclocktis_fresh_instancesfresh instancec3@s!|]}�|�|fVqdS(N((t.0tk(tnormcase(s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pys	<genexpr>fss\tfilest/c3@s3|])}�|��kr�|tt�VqdS(N(R?(RgRI(tfoldmapt	normalizeRi(s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pys	<genexpr>�sc3@sF|]<}|�kr�|�r|�ks:�|�r|VqdS(N((RgRI(tdmapR,tmatchfntresults(s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pys	<genexpr>�sc3@s!|]}|�kr|VqdS(N((RgRI(Rp(s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pys	<genexpr>�sc3@s!|]}|�kr|VqdS(N((RgRI(Rp(s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pys	<genexpr>�sc3@s-|]#}|�kr�|�r|VqdS(N((RgRI(RoRp(s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pys	<genexpr>�sc3@s-|]#}|�kr�|�r|VqdS(N((RgRI(RoRp(s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pys	<genexpr>�sc3@s'|]\}}|�kr|VqdS(N((RgRItst(Rp(s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pys	<genexpr>�sc3@s!|]}|�kr|VqdS(N((RgRI(Rp(s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pys	<genexpr>�sc3@s3|])\}}|�kr�|�r|VqdS(N((RgRIRq(RoRp(s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pys	<genexpr>�s	c3@s-|]#}|�kr�|�r|VqdS(N((RgRI(RoRp(s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pys	<genexpr>�stcachedN(:t_watchmanclientt	availablet_fsmonitorstatetgetRt_ignoret
_dirignoreR-R
talwaysRoRVtsafehasattrtnonnormalsettcopymapRNtS_IFMTtS_IFDIRtS_IFREGtS_IFLNKt_joinRiRHtisexactR?tprefixt
_checkcaset_normalizefiletNonet
_walkexplicitt
settimeoutRtcommandtintt	ExceptionR&R=tclearconnectiontsetlastclockR!tdictR
tossept_fixencodingR;treplacetsetR)t	iteritemsR	tpathauditort_roottchecktsortt
differencetitertnextt	statfiles(.RBRCRRDRERAR<RFRRet
ignorehasht	notefilesRJRUt	dirignoretmatchalwaysR{R|tgetkindtdirkindtregkindtlnkkindtjointfresh_instancetexactt	skipstep3tworktdirsnotfoundtdtstresultR%tswitch_slashestentrytfnametnormedtfmodetfexistsRTtvisittauditRIt	auditpasst	auditfailtnfRq((
RnRlR,RARRoRmRiRBRpRCRDREs>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pytoverridewalk�s


		
					
										
			)


	

	



%%  ## & %

/	
t.c	 @sd|}	|}
|}�fd�}t|tj�r<|}
n
�|}
t|tj�ra|}n
�|}|j�dk}|o�|
�dk}|p�tj�j�j��}|o�|j�o�t|tj	tj
f�o�dtjk}yL�j
jr�jjd�n�jj�j
jd��jj�}WnOtk
r�}�jj�t�j�j
|�|||||	|
||�SX|r�t}n|}|r�t|�}�j|�n|||||	|
||�}|\}}}}}}}|sg}n|
p |jdk	}�j
jdkrE|rEt�j_�jj}t�j_�jj�jj }}t!t"j#d��j_�j_ z"|||||	|
||�}Wdt$�j_|�j_||�j_�j_ X�j%��'||||||||g|�WdQX|\}}}}}}}nt&j'|||||||�S(Nc@syMdtjkr1tjd}t|d�}nd}�jj|d�}Wn2ttfk
r��jjtd�|�dSXz~xwt	t
||��D]`\}\}}t|�t|�kr�|jd|�|jd|�|jd|�q�q�WWd|j
�XdS(NtFSMONITOR_LOG_FILEtwbsfsmonitorfail.logswarning: unable to write to %s
s sets at position %d are unequal
swatchman returned: %s
sstat returned: %s
(RtenvirontopentvfstIOErrortOSErrorR$RRt	enumeratetzipR�twritetclose(tl1tl2tfnRItits1ts2(RC(s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyt_cmpsets�s 
(R�t
HG_PENDINGg�������?tparanoidR�((RRt	changectxtrevR�tmatchmodRytroottgetcwdtworkingcommitctxtmemctxRR�RuRRsR�RtgetcurrentclockR�R�R&R$R?t
poststatustaddpostdsstatusttraversedirRtdirstatet_fsmonitordisabletquiettfouttferrR�tostdevnullRHtwlockRtstatus( RBRCtnode1tnode2RRAtcleanREtlistsubrepostlistignoredt	listcleantlistunknownR�tctx1tctx2tworkingt
parentworkingtupdatestatet
startclockR%tstateunknowntpstrtmodifiedtaddedtremovedtdeletedR<R�R�R�trv2((RCs>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pytoverridestatus�sx	
	
!		
			"


R�cB@seZd�Zd�ZRS(cC@s
||_dS(N(t_startclock(RCR�((s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyt__init__AscC@s{|j�jj�p|j}t|j�jj�}|j|j|j	|j
|j}|j�jj|||�dS(N(
trepoRutgetlastclockR�R-R�RwR�R�R�R�RER�(RCtwctxR�Ret
hashignoreR�((s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyt__call__Ds%(t__name__t
__module__R�R�(((s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyR�@s	c@s9d|jf�fd��Y��|_|j|�dS(Ntfsmonitordirstatec@s>eZd�Z�fd�Z�fd�Z�fd�ZRS(cS@s7t|_|j|_|j|_tj|�|_dS(N(RHR�RuRstweakreftproxyt_repo(RCR�((s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyt_fsmonitorinitMs	c@s;t�|�j}|jr(|||�St||||�S(N(tsupertwalkR�R�(RCtargstkwargsRB(R(s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyRTs	
c@s&|jj�t�|�j||�S(N(RuR!Rtrebuild(RCRR	(R(s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyR
Zs
c@s&|jj�t�|�j||�S(N(RuR!R(RCRR	(R(s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyR!^s
(R�RRRR
R!((R(s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyRLs	(t	__class__R(R�R�((Rs>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pytmakedirstateKs	cC@s2||�}tj|d�r.t||�n|S(NRu(R
RzR(RBRCtds((s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pytwrapdirstateescC@sLtjtjdt�tjr5tjtdt	�ntjt
dt�dS(NR�tsymlinkR)(Rt
wrapfilecacheRtlocalrepositoryRR
tisdarwintwrapfunctionR�twrapsymlinkRt
wrapupdate(R$((s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pytextsetupls
	cC@sMz|||�SWdy tjtjj|�d�Wntk
rGnXXdS(s{ if we create a dangling symlink, also touch the parent dir
    to encourage fsevents notifications to work more correctly N(R�tutimeR7R`R�R�(RBtsourcet	link_name((s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyRus 
tstate_updatecB@sVeZdZddded�Zd�Zd�Zd�Zed�Z	dd�Z
RS(	s 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.cC@sR|j�|_||_||_||_||_||_d|_t	|_
dS(N(t
unfilteredR�R[toldnodetnewnodetdistancetpartialR�t_lockRHt
need_leave(RCR�R[RRRR((s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyR��s						cC@s|j�dS(N(tenter(RC((s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyt	__enter__�scC@s�|jdkr(|jdj�|_n|jj�dkr|tj|jd�rg|jj�|_q||jj	�|_n|j
dt|j��|_|S(NR�twlocknostateupdatesstate-enter(
RR�R�tnodetcurrentwlockR
RzR$R R�t_stateRR!(RC((s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyR"�scC@s&|rtnt}|jd|�dS(Ntabort(R?RHtexit(RCttype_tvaluettbR(((s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyt__exit__�scC@s�z�|jr�|rdnd}|jdkrF|jdj�|_n|jdkrvt|j|j|j�|_n|jdt	|j�d|�nWdt
|_|jr�|jj�nXdS(NtfailedtokR�sstate-leaveR�(
R!RR�R�R%RtcalcdistanceRR'RRHR trelease(RCR(R�((s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyR)�s			R/cC@s�tj|jd�stSy`|jjj|i|jd6i|d6|jrT|jndd6|d6|jd6d6�t	SWn0t
k
r�}|jjjd	d
||�tSXdS(NRsR[R�iRR�RtmetadatatwatchmansException %s while running %s
(
R
RzR�RHRsR�R[RRR?R�R$R"(RCtcmdt
commithashR�R9((s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyR'�s
N(R�Rt__doc__R�RHR�R#R"R-R)R'(((s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyR�s	
			cC@s[|jj||�}||j�}t||j�|�t||j�|�}|S(N(t	changelogtancestorR�tabs(R�RRtanctancrevR((s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyR0�s
c	K@s�d}
t}|dj�}||j�}
|dksD|j�ret}t|j�||
�}
nt|ddd|d|
d|
d|��'||||||||||	�SWdQXdS(	NiR�R[s	hg.updateRRRR(R?R%R�RyRHR0RR(RBR�R%tbranchmergetforceR8t
mergeancestortlabelstmatcherR	RRRR((s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyR�sc	@sFtj�}x5tD]-}||kr�jtd�|�dSqW|j�rB|jjd�st|jjd�rxdStj|�}|j	dkr�dSyt
j|�}Wn$tk
r�}t
�||�dSX||_||_tj|d�\}}|rt||�nd|jf��fd��Y��|_ndS(NsUThe fsmonitor extension is incompatible with the %s extension and has been disabled.
s.hgsubstates.hgsubtoffR�t
fsmonitorrepoc@s8eZ�fd�Z�fd�Z��fd�ZRS(c@s%t�|�j}t||||�S(N(RR�R�(RCRR	RB(RB(s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyR�sc@st�|�j||�S(N(RR�(RCRR	(RB(s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyR$sc@s�t�|�j||���jdd�s1�S�jdkrD�S�j���fd�}y8d�_t|dd��_�jj�|�_Wn)t	k
r�}|j
jdd|�nX�S(	NRsfsmonitor.transaction_notifyic@s6�r��n�jr2�jj�d�_ndS(N(tstateupdateR)R�((tltorigrelease(s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pytstaterelease(s

	
R[shg.transactionR3sException in state update %s
(RR�t
configbooltheldt	releasefnR�RCRR"R�R$R"(RCRR	RFR9(RBR$(RDREs>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyR�s"		

	(R�RR�R$R�((RBR$(s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyRBs(Rtenabledt
_blacklistRRtlocaltwvfsRZRRRtclientR�R&RuRsRtisfilecachedRR(	R$R�textstexttfsmonitorstateRNR%R�Rr((RBR$s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyt	reposetup�s0
$		"#(=R6t
__future__RtcodecsR'R�RNtsysRtmercurial.i18nRtmercurial.nodeRt	mercurialRRRRRRR	R
RRR
RR�tRRRt
testedwithtconfigtablet
configitemRHtlistRKR&R-tget_local_encodingR1tgetfilesystemencodingtgetdefaultencodingR5tlookupR�R;R?R�R�R�tobjectR�RRRRRR0RRS(((s>/usr/lib64/python2.7/site-packages/hgext/fsmonitor/__init__.pyt<module>PsZL

			�}					W