³ò ø$•Jc @swddkZddkZddkZddkZddkZddkZddkZdefd„ƒYZd„Z dS(iÿÿÿÿNtlockcBsSeZdZdZdddd„Zd„Zd„Zd„Zd„Z d„Z RS( sŠAn 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/.iÿÿÿÿcCs;||_d|_||_||_||_|iƒdS(Ni(tftheldttimeoutt releasefntdescR(tselftfileRRR((s./mercurial/lock.pyt__init__ s      cCs>|io&tiddtddƒd|_n|iƒdS(Ns$use lock.release instead of del locktcategoryt stacklevelii(RtwarningstwarntDeprecationWarningtrelease(R((s./mercurial/lock.pyt__del__(s    cCs |i}xy|iƒdSWq tij oi}|djo/tidƒ|djo|d8}q q ntiti|i|i |i ƒ‚q Xq dS(Nii( RttrylockterrortLockHeldttimetsleepterrnot ETIMEDOUTtfilenameRtlocker(RRtinst((s./mercurial/lock.pyR4s     cCs*|io|id7_dSntidjotiƒt_ndtitiƒf}xÆ|ip»y ti ||i ƒd|_Wq`t t fj o‚}|i t ijoB|iƒ}|dj o%tit i|i |i|ƒ‚qq!ti|i |i|i|iƒ‚q`Xq`WdS(Nis%s:%s(RRt_hosttNonetsockett gethostnametostgetpidtutiltmakelockRtOSErrortIOErrorRtEEXISTttestlockRRtEAGAINRtLockUnavailabletstrerrorR(RtlocknametwhyR((s./mercurial/lock.pyRCs$     c Csòti|iƒ}y|iddƒ\}}Wntj o |SnX|tijo|Snyt|ƒ}Wn |SnXti|ƒo|Sny;t|idƒ}|i ƒt i |iƒ|i ƒWnt ij o |SnXdS(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. t:is.breakN(R treadlockRtsplitt ValueErrorRRtintttestpidRRtunlinkRRt LockError(RRthosttpidtl((s./mercurial/lock.pyR%Xs(   cCsz|idjo|id8_nT|idjoCd|_|io|iƒnyti|iƒWqvqvXndS(Nii(RRRR1R(R((s./mercurial/lock.pyRzs  N( t__name__t __module__t__doc__RRRRRRR%R(((s./mercurial/lock.pyR s    "cGs0x)|D]!}|dj o|iƒqqWdS(N(RR(tlocksR((s./mercurial/lock.pyR…s ( R RRRRRR tobjectRR(((s./mercurial/lock.pyss0 y