�
�c@sqddklZddkZddkZddkZddkZd�Zd�Zea d�Z
ed�ZdS(i�(t_NcCs�|itd�||f�|}t|d�p�|id�}|djo#titd�||f��n|| } ti}
ttd�oDtii | �\}}|o!|otii
|�|} q�nyt| �}Wn\tj
oPytd| �}WqItj
o&titd�|| f��qIXnX|
t_y1x*|i d�d D]}t
||�}qiWWn2tj
o&titd
�||f��nXt|d�p#titd�||f��q�ny"|d|d
|d||�}
Wn�tj
o
�n�tj
o}}t|ti�o(|itd�||idf�n|itd�||f�|o�n|i�tSnX|
o?|otitd�|��n|itd�|�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)tfrozenshgext_%ss*%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
s%s hook failedswarning: %s hook failed
(tnoteRthasattrtrfindtutiltAborttsystpathtostsplittappendt
__import__tImportErrortgetattrtAttributeErrortKeyboardInterruptt Exceptiont
isinstancetwarntargst tracebacktTrue(RRtnamethnametfuncnameRtthrowtobjtdtmodnametoldpathsR
tptrtexc((s!/sys/lib/python/mercurial/hook.pyt_pythonhooksh
"
cCs|itd�||f�h}xK|i�D]=\}}t|d�o
|�}n||d|i�<q0W|o
|i} n
ti�} ti |d|d| �}
|
o`ti
|
�\}}
|o#titd�||f��n|itd�||f�n|
S(Nsrunning hook %s: %s
RtHG_tenvirontcwds
%s hook %sswarning: %s hook %s
(
RRt iteritemsRtuppertrootRtgetcwdR
tsystemtexplain_exitRR(RRRtcmdRRtenvtktvR*R%tdesc((s!/sys/lib/python/mercurial/hook.pyt_exthookPs"
#!cCs
|adS(N(t _redirect(tstate((s!/sys/lib/python/mercurial/hook.pytredirectfsc
Ks�t}to>titii��}titii�tii��nzLxE|i d�D]4\}}|i
d�d|jp|oq^nt|d�o)t|||||||�p|}q^|i
d�o�|id�djoE|didd �\} }ti| d
|�}
t|
|�}n|di�}t|||||||�p|}q^t||||||�p|}q^WWdto*ti|tii��ti|�nX|S(NthooksRiRspython:t:iiis hghook.%s(tFalseR7RtdupRt
__stdout__tfilenotdup2t
__stderr__tconfigitemsRRR't
startswithtcounttrsplitt
extensionstloadpathRtstripR6tclose(RRRRRR%t oldstdoutRR1R
tmodthookfn((s!/sys/lib/python/mercurial/hook.pythookjs.&"))*(ti18nRRRRFR
R'R6R<R7R9RM(((s!/sys/lib/python/mercurial/hook.pys<module>s D
|