^c-ddlZddlZddlZddlZddlmZddlmZddlm Z m Z m Z m Z mZm Z ddlmZmZmZdZdZeZd Zdd Zd ad Zd ZddZejdZddZdS)N)_)getattr) demandimportencodingerror extensionspycompatutil)procutil resourceutil stringutilc n t|r(|}tj|jdz|jz}n|d}|dkr&t jtd||fz|d|} tj } tj rJtj | \} } | r&| r$tj dd| gzt_ | } tj5 t#tj| }n6#t&t(f$r!tj} t#dtj| z}n#t&t(f$rtj}|jr"|td|| |jr"|td|||jstd }nd}t jtd || fz| wxYwYnwxYwdddn #1swxYwY| t_ |dd dD]}t3||}n4#t4$r't jtd ||fzwxYwt|s&t jtd||fz|td||fzt9j} |d|||dtj|}n#t>$r}tA|t j!r3|td||j"dfzn9|td|tGj$|fz|r|js"|td|Yd}~t9j|z }|%dd|||dSd}~wwxYw t9j|z }|%dd|||n4#t9j|z }|%dd|||wxYw|rK|r$t j&td|z|td|z|dfS)acall 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...s(%s hook is invalid: "%s" not in a moduleNzhgext_%ss,exception from first failed import attempt: s-exception from second failed import attempt: s$run with --traceback for stack traces)%s hook is invalid: import of "%s" failedhintrs'%s hook is invalid: "%s" is not defineds(%s hook is invalid: "%s" is not callablescalling hook %s: %s )uirepohooktypeserror: %s hook failed: %s rs'error: %s hook raised an exception: %s s'(run with --traceback for stack trace) s pythonhooks,pythonhook-%s: %s finished in %0.2f seconds )TTs%s hook failedswarning: %s hook failed F)'callabler sysbytes __module____name__rfindr HookLoadErrorrsyspathr mainfrozenossplitr deactivated __import__sysstr ImportError SyntaxErrorexc_info tracebackflagwarn tracebackrAttributeErrornoter timer strkwargs Exception isinstanceAbortargsr forcebytestrlog HookAbort)rrhtypehnamefuncnamer4throwobjdmodnameoldpathsmodpathmodfilee1e2 tracebackhintp starttimerexcdurations 0/usr/lib/python3/dist-packages/mercurial/hook.py pythonhookrKsE$S^c%9CL%HII NN4  77%=>>(#$ 2A2,8  " $ $ "!w}}W55 GW "7 "8AAA;'2!  % ' '% % $  !9!9::-" " " \^^ $Z(/'2J2J%JKKCC#[1B'!. LL$$$'!. LL$$$+-()C)) )- -FGG '*+*3C " % % % % % % % % % % % % % % % L ^^D))!""- & &c1oo &   %<==(#$   }} %=>>(#$  GGA& ' '5(*; ;<<< I C M2D5 M MH4Ft4L4L M M     c5; ' '  GGA455 8LL M M M M GG=>>*1#6678       D GGAABB C C C zzz:<<)+   <         !  :<<)+   <        :<<)+   <         9  @/!$5"6"6">?? ? .//%7888 e8Os?I&!D$"I&$%I $E/.I/C"III&II&&I*-I*>0J//1K M31R23 Q>>CQ9R29Q>>R221S#c>tj}i}|N|} |j| | r| r |j|d<||d<||d<|dd|zdkr|} n| dd|z} | rd|d<nd |d<| D]o\} } | d kr t| r | } t| ttfrtj| } | |d | z<p| dd |zd rB|} t%j||}|| kr%|t+d|z|t+d||fz|r|j}nt-j}||||d|fz}tj|z }|dd||||rct%j|}|r&t7jt+d||fz|t+d||fz|S)Ns HG_PENDINGs HG_HOOKTYPEs HG_HOOKNAMEhookss%s:run-with-plainsauto1sHGPLAINschangessHG_s tonative.%sFsconverting hook "%s" to native srunning hook %s: %s s exthook-%s)environcwd blockedtagsexthooks)exthook-%s: %s finished in %0.2f seconds s %s hook %sswarning: %s hook %s )r r/currenttransactiondirstatewrite writependingrootconfigplain configboolitemsrr2dictlistrpprintupperr shelltonativer.rrgetcwdsystemr6 explainexitrr7r+)rrr8namecmdr4r;rFenvtrrYkvoldcmdrQrGrIdescs rJ_exthookrls I C   $ $ & & B  +"//## +!%C CC yy/$6777BB  h(z_allhooks..s$ < < d LrOc |adS)N) _redirect)states rJredirectrs IIIrOc|jsdSt|D])\}}|dd|kr|rdS*dS)z/return True if a hook is configured for 'htype'FrrT) callhooksrr#)rr8r9res rJhashookrsX <umm s ;;t  Q 5 ( (S (44 5rOc |jsdSg}t|D]=\}}|dd|kr|r|||f>t ||||fd|i|}d} |D]\}}||dp| } | S)NFrrr;)rrr#appendrunhooks) rrr8r;r4rxr9reresrGs rJhookrs <u Emm'' s ;;t  Q 5 ( (S ( LL% & & & 2tUE ? ? ?$ ? ?C A s JqM Q HrOc# Kd} tr tj}tj}|dkrM|dkrGtjt j|}t j||n#ttf$rYnwxYwdV tjnU#t$rH}|j tj tjtjfvrt!j|Yd}~nd}~wwxYwtr|dkr tjnU#t$rH}|j tj tjtjfvrt!j|Yd}~nd}~wwxYwt j||t j|dSdSdS# tjnU#t$rH}|j tj tjtjfvrt!j|Yd}~nd}~wwxYwtr|dkr tjnU#t$rH}|j tj tjtjfvrt!j|Yd}~nd}~wwxYwt j||t j|wwwxYw)z(Redirects stdout to stderr, if possible.rrN)rr stdoutfilenostderrflushr"dupdup2OSErrorr-IOErrorerrnoEPIPEEIOEBADFr StdioErrorclose) oldstdoutstdoutnostderrnoerrs rJredirect_stdiors*I!   #?1133#?1133q==X]]O))+++ "x 0 0IGHh///^,       , O ! ! # # # # , , ,yei EEE&s+++FEEEE ,  a 0%%'''' 0 0 09U[%)U[$III*3///JIIII 0 GIx ( ( ( HY         , O ! ! # # # # , , ,yei EEE&s+++FEEEE ,  a 0%%'''' 0 0 09U[%)U[$III*3///JIIII 0 GIx ( ( ( HY     sGBBGB2/G1B22G:C D+#>D&&D+<E F-%>F((F-L!H?L I >I L IL#JL K >K LK/Lc 2tj|}i}t5|D]\}}|tur`|r3t jt d|zt d|t d|zd} d} n_t|rt|||||||\} } n6| dr | dd kr|d d dd\} }tj| } |r%tj|j| } t'j| d |z} n4#t*$r'|t d |zwxYwt/| |} n|d d} t||||| ||\} } nt3|||||||} d} | | f||< dddn #1swxYwY|S) Nsuntrusted hook %s not executedssee 'hg help config.trusted'rs(warning: untrusted hook %s not executed rFspython:rs hghook.%ssloading %s hook failed: )r byteskwargsrrurr7rr+rrKrcountrsplitr expandpathr"r joinrWr loadpathr1rUrstriprl)rrr8rxr;r4rr9rerGraisedr modhookfns rJrrAs   % %D C   "#"#! #! #JE3n$$/;<??FGG%OPPP# &r4sD%PP 66 ++ 99T??a'' #ABBtQ 7 7ID#?400D=!w||DIt<<(1$ u8LMM$#?!@!@5!HIII%S#..FF W]]__F&eUFD% 66RueS$FFFCJJC! #"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#H Js+D&H  E%$H %1FA)H  HH)F) contextlibrr"ri18nrr rrrrr r utilsr r rrKrlobjectrurrsrrrrcontextmanagerrrrrOrJrs qqqh< < < @ = = =             % % % P((((((rO