\x89\x50\x4E\x47\x0D\x0A\x1A\x0A PNG  \x89\x50\x4E\x47\x0D\x0A\x1A\x0A  13\c@@sddlmZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z m Z mZmZddlmZdZejdZd Zd efd YZd ZdS( i(tabsolute_importNi(t_(tencodingterrortpycompattutil(tprocutilcC@stjtj}tjjdry|dtjdj 7}Wqt k r}|j t j t j t jfkrqqXn|S(s Return a string which is used to differentiate pid namespaces It's useful to detect "dead" processes and remove stale locks with confidence. Typically it's just hostname. On modern linux, we include an extra Linux-specific pid namespace identifier. tlinuxs/%xs/proc/self/ns/pid(Rt strtolocaltsockett gethostnameRt sysplatformt startswithtoststattst_inotOSErrorterrnotENOENTtEACCEStENOTDIR(tresulttex((s4/usr/lib64/python2.7/site-packages/mercurial/lock.pyt_getlockprefixs! c#@s<gti}dfd}zxWdddddgD]@}tt|d}|rI||krItj|||s c@s$rj|n |dS(N(tappend(Rtframe(t assertedsigstblockedR (s4/usr/lib64/python2.7/site-packages/mercurial/lock.pyt catchtermDsRRtSIGBREAKtSIGHUPtSIGTERMNi(tFalseRRRt getsignalt ValueErrortTruetitems(t orighandlersR%tnameRthandler((R#R$R s4/usr/lib64/python2.7/site-packages/mercurial/lock.pyt_delayedinterrupt/s2      c @sfd}t||ddt|||r?|r?dnd}d} |sZd} n|ri|} nd} xtr1yjPWqrtjk r-} | |kr||j| jn| | kr||j| jn|| krtjt j | j j | jnt jd| d7} qrXqrW| _jrd| ko^jknr|jtdjq|jdjnjrjnS(sreturn an acquired lock or raise an a LockHeld exception This function is responsible to issue warnings and or debug messages about the held lock while trying to acquires it.c@sd|kr^|jdd\}}tdtjjtj|tj|f}n"tdjtj|f}||dS(s=issue the usual "waiting on lock" message through any channelt:is5waiting for lock on %s held by process %r on host %r s"waiting for lock on %s held by %r N(tsplitRRtbytestrtdesc(tprintertlockerthosttpidtmsg(tl(s4/usr/lib64/python2.7/site-packages/mercurial/lock.pyt printwarningos   itdolockiisgot lock after %d seconds (tlockR)R,t_trylockRtLockHeldtdebugR7twarnRt ETIMEDOUTtfilenameR5ttimetsleeptdelayRt acquirefn( tuitvfstlocknamettimeoutt warntimeouttargstkwargsR<tdebugidxt warningidxRGtinst((R;s4/usr/lib64/python2.7/site-packages/mercurial/lock.pyttrylockis>             R>c B@seZdZdZddddddeedZdZdZdZ dZ dZ dZ d Z d Zd Zejd Zd ZRS(sAn advisory lock held by one process to control access to a set of files. Non-cooperating processes or incorrectly written scripts can ignore Mercurial's locking scheme and stomp all over the repository, so don't do that. Typically used via localrepository.lock() to lock the repository store (.hg/store/) or localrepository.wlock() to lock everything else under .hg/.ic C@s||_||_d|_||_||_||_||_||_||_t |_ t |_ | rut |_ n tj|_ g|_|j|_| r|j|_|jr|jqndS(Ni(RJtftheldRLt releasefnRHR5t_inheritcheckert parentlockR)t _parentheldt _inheritedR1t_maybedelayedinterruptRtnullcontextmanagert postreleaset_getpidR9R>RG( tselfRJtfnameRLRVRHR5tinheritcheckerRXt signalsafeR=((s4/usr/lib64/python2.7/site-packages/mercurial/lock.pyt__init__s(               cC@s|S(N((R_((s4/usr/lib64/python2.7/site-packages/mercurial/lock.pyt __enter__scC@s|jdS(N(trelease(R_texc_typet exc_valuetexc_tb((s4/usr/lib64/python2.7/site-packages/mercurial/lock.pyt__exit__scC@s<|jr.tjddtddd|_n|jdS(Ns$use lock.release instead of del locktcategoryt stacklevelii(RUtwarningsRBtDeprecationWarningRe(R_((s4/usr/lib64/python2.7/site-packages/mercurial/lock.pyt__del__s    cC@s tjS(N(Rtgetpid(R_((s4/usr/lib64/python2.7/site-packages/mercurial/lock.pyR^scC@s|j}xtry|j|j|SWq tjk r}|dkrxtjd|dkr |d8}q q ntjtj|j |j |j q Xq WdS(Nii( RLR,R?RR@RERFRRCRDR5R7(R_RLRR((s4/usr/lib64/python2.7/site-packages/mercurial/lock.pyR>s       cC@s|jr|jd7_dStjdkr:tt_ndtj|jf}d}x7|j r|r|d8}y6|j$|jj||j d|_WdQXWqYt t fk r}|j t j krd|j}|dkrqYn||jkrt|_d|_dS|j|}|dk rtjt j|jj|j |j|qqtj|j |j|j|jqYXqYW|jstjt j|jj|j |jdndS(Nis%s:%dit(RUR>t_hostRRR9R[RJtmakelockRTRtIOErrorRtEEXISTt _readlockRXR,RYt _testlockRR@tEAGAINtjoinR5tLockUnavailabletstrerrorRD(R_RKtretrytwhyR7((s4/usr/lib64/python2.7/site-packages/mercurial/lock.pyR?s@           cC@sPy|jj|jSWn2ttfk rK}|jtjkrEdSnXdS(sread lock and return its value Returns None if no lock exists, pid for old-style locks, and host:pid for new-style locks. N(RJtreadlockRTRRsRRR(R_R|((s4/usr/lib64/python2.7/site-packages/mercurial/lock.pyRus cC@s|dkrdSy|jdd\}}Wntk r@|SX|tjkrT|Syt|}Wntk rx|SXtj|r|Sy@t|j|j ddd}|jj |j |j Wnt j k r|SXdS(NR2is.breakRLi(RR3R+R>RqtintRttestpidRJRTtunlinkReRt LockError(R_R7R8R9R;((s4/usr/lib64/python2.7/site-packages/mercurial/lock.pyRv)s(   cC@s|j}|j|S(soreturn id of locker if lock is valid, else None. If old-style lock, we cannot tell what machine locker is on. with new-style lock, if locker is on this machine, we can see if locker is alive. If locker is on this machine but not alive, we can safely break lock. The lock file is only deleted when None is returned. (RuRv(R_R7((s4/usr/lib64/python2.7/site-packages/mercurial/lock.pyttestlockAs cc@s|jstjdn|jr6tjdn|jdk rR|jn|jrh|jn|jr}|j}ndt j |j f}t |_z |VWd|j r|j nt|_XdS(scontext for the lock to be inherited by a Mercurial subprocess. Yields a string that will be recognized by the lock in the subprocess. Communicating this string to the subprocess needs to be done separately -- typically by an environment variable. s-inherit can only be called while lock is helds8inherit cannot be called while lock is already inheriteds%s:%dN(RURt LockInheritanceContractViolationRZRWRRVRYRXR>RqR9R,RHR)(R_RK((s4/usr/lib64/python2.7/site-packages/mercurial/lock.pytinheritOs&             cC@s|jdkr!|jd8_n|jdkrd|_|j|jkrRdSz|jrk|jnWd|jsy|jj|jWqtk rqXnX|jsx|j D] }|qWd|_ qndS(srelease the lock and execute callback function if any If the lock has been acquired multiple times, the actual release is delayed to the last release call.iiN( RUR^R9RVRYRJRRTRR]R(R_tcallback((s4/usr/lib64/python2.7/site-packages/mercurial/lock.pyRems$      N(t__name__t __module__t__doc__RRqR,RcRdRiRnR^R>R?RuRvRt contextlibtcontextmanagerRRe(((s4/usr/lib64/python2.7/site-packages/mercurial/lock.pyR>s         +  cG@s.x'|D]}|dk r|jqqWdS(N(RRe(tlocksR>((s4/usr/lib64/python2.7/site-packages/mercurial/lock.pyRes  (t __future__RRRR RR RERlti18nRRpRRRRtutilsRRRR1RStobjectR>Re(((s4/usr/lib64/python2.7/site-packages/mercurial/lock.pyts       " : 6