Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/site-packages/mercurial/hook.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


��c@s�ddlmZddlZddlZddlZddlZddlZddlZddlZd�Z	d�Z
d�Zea
d�Zed�ZdS(i�(t_Nc
CsT|jtd�||f�tj�}|}tj|d�s�|jd�}	|	dkr~tjtd�||f��n||	 }
tj}tj	�r�
jj|
�\}}
|r�
r�j|gt_|
}
q�y$tj
�t|
�}tj�Wn�k
r�tjtjtjf}ytd|
�}tj�Wq�k
r�tj�tjtjtjf}|jr�|jtd��n|j|�|jr�|jtd��n|j|�tjtd	�||
f��q�X|t_y1x*|jd�d
D]}t||�}qWWn0tk
rhtjtd�||f��nXtj|d�s�tjtd�||f��q�nz�tjtjtjf}|j|j|jt_t_t_|d
|d|d||�}Wn�tk
r�n�t k
r�}t!|tj�ra|jtd�||j"df�n|jtd�||f�|r��n|j�t#SXWd|\t_t_t_tj�|}|}t!|t$j%�r�j&d|j'}n|j(dd|||�X|rP|r6tjtd�|��n|jtd�|�n|S(s�call python hook. hook is callable object, looked up as
    name in python module. if callable returns "true", hook
    fails, else passes. if hook raises exception, treated as
    hook failure. exception propagates if throw is "true".

    reason for "true" meaning "hook failed" is so that
    unmodified commands (e.g. mercurial.commands.update) can
    be run as hooks without wrappers to convert return values.scalling hook %s: %s
t__call__t.i�s)%s hook is invalid ("%s" not in a module)shgext_%ss,exception from first failed import attempt:
s-exception from second failed import attempt:
s*%s hook is invalid (import of "%s" failed)is(%s hook is invalid ("%s" is not defined)s)%s hook is invalid ("%s" is not callable)tuitrepothooktypeserror: %s hook failed: %s
is'error: %s hook raised an exception: %s
Nt
pythonhooks,pythonhook-%s: %s finished in %0.2f seconds
s%s hook failedswarning: %s hook failed
()tnoteRttimetutiltsafehasattrtrfindtAborttsystpatht
mainfrozentostsplittdemandimporttdisablet
__import__tenabletImportErrortexc_typet	exc_valuet
exc_tracebackt
tracebackflagtwarnt	tracebacktgetattrtAttributeErrortstdouttstderrtstdintfouttferrtfintKeyboardInterruptt	Exceptiont
isinstancetargstTruettypestFunctionTypet
__module__t__name__tlog(RRtnamethnametfuncnameR(tthrowt	starttimetobjtdtmodnametoldpathstmodpathtmodfilete1te2tptoldtrtexctdurationtreadablefunc((s2/sys/lib/python2.7/site-packages/mercurial/hook.pyt_pythonhooks�

	



	
	
	
&"

	c	Cs�|jtd�||f�tj�}i}x�|j�D]}\}}	tj|	d�rf|	�}	nt|	t�r�ddjd�t	|	j��D��d}	n|	|d|j
�<q<W|r�|j}
ntj
�}
d|kr|djd	�rtj|d
|d|
d|�}n$tj|d
|d|
d|j�}tj�|}|jd
d|||�|r�tj|�\}
}|r�tjtd�||
f��n|jtd�||
f�n|S(Nsrunning hook %s: %s
Rt{s, css|]}d|VqdS(s%r: %rN((t.0ti((s2/sys/lib/python2.7/site-packages/mercurial/hook.pys	<genexpr>yst}tHG_tHG_URLsremote:httptenvirontcwdtouttexthooks)exthook-%s: %s finished in %0.2f seconds
s
%s hook %sswarning: %s hook %s
(RRRt	iteritemsR	R
R'tdicttjointsortedtuppertrootRtgetcwdt
startswithtsystemR"R.texplainexitRR(RRR/tcmdR(R2R3tenvtktvRJR>R@tdesc((s2/sys/lib/python2.7/site-packages/mercurial/hook.pyt_exthookms2&
$$
" c	Cs�g}xh|jd�D]W\}}|jd�s|jdd|d�}|j|t|�||f�qqWgt|�D]\}}}}||f^q~S(Nthookstpriorityspriority.%si(tconfigitemsRTt	configinttappendtlenRP(	RR]R/RWR^R<toRYRZ((s2/sys/lib/python2.7/site-packages/mercurial/hook.pyt	_allhooks�s'cCs
|adS(N(t	_redirect(tstate((s2/sys/lib/python2.7/site-packages/mercurial/hook.pytredirect�scKs�|js
tSt}d}z:x3t|�D]%\}}|jd�d|ks)|r[q)n|dkr�r�tjj�}	tjj�}
|	dkr�|
dkr�tjj	�t
j|	�}t
j|
|	�nWq�
tfk
r�q�tj|d�r,t|||||||�p&|}q)|jd�r-|jd�dkr�djdd	�\}}tj|�}|r�t
jj|j|�}nytj|d
|�}Wn+tk
r�|jtd�|��nXt||�}
n|dj�}
t|||||
||�p'|}q)t ||||||�pK|}q)WWdtr�|dkr�t
j||	�t
j!|�nX|S(Ni�RiRspython:t:iiis	hghook.%ssloading %s hook failed:
("t	callhookstFalseRdRReR
t
__stdout__tfilenot
__stderr__tflushRtduptdup2tOSErrorRR	R
RBRTtcounttrsplitt
expandpathRRORRt
extensionstloadpathR&twriteRRtstripR\tclose(RRR/R2R(R>t	oldstdoutR0RWtstdoutnotstderrnoRtmodthookfn((s2/sys/lib/python2.7/site-packages/mercurial/hook.pythook�sN	 
'
')(ti18nRRR
RR*RuR	RRBR\RdRjReRgR(((s2/sys/lib/python2.7/site-packages/mercurial/hook.pyt<module>s0$	a	#		

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.