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

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


��c@swddlZddlZddlZddlZddlZddlZddlZdefd��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�cCsS||_d|_||_||_||_g|_tj�|_|j	�dS(Ni(
tftheldttimeoutt	releasefntdesctpostreleasetostgetpidtpidR(tselftfileRRR((s2/sys/lib/python2.7/site-packages/mercurial/lock.pyt__init__ s						cCs<|jr.tjddtdd�d|_n|j�dS(Ns$use lock.release instead of del locktcategoryt
stacklevelii(RtwarningstwarntDeprecationWarningtrelease(R
((s2/sys/lib/python2.7/site-packages/mercurial/lock.pyt__del__*s	cCs�|j}x�tr�y|j�dSWqtjk
r�}|dkrqtjd�|dkr|d8}qqntjtj|j	|j
|j��qXqWdS(Nii(RtTruettrylockterrortLockHeldttimetsleepterrnot	ETIMEDOUTtfilenameRtlocker(R
Rtinst((s2/sys/lib/python2.7/site-packages/mercurial/lock.pyR6s		


cCs|jr|jd7_dStjdkr=tj�t_ndtj|jf}x�|jsy tj||j	�d|_WqVt
tfk
r}|jtj
kr�j�}|dk	rtjtj|j	|j|��qqtj|j|j|j|j��qVXqVWdS(Nis%s:%s(RRt_hosttNonetsockettgethostnameR	tutiltmakelockRtOSErrortIOErrorRtEEXISTttestlockRRtEAGAINRtLockUnavailabletstrerrorR(R
tlocknametwhyR((s2/sys/lib/python2.7/site-packages/mercurial/lock.pyREs$	
cCsytj|j�}Wn,tk
rD}|jtjkr>dS�nXy|jdd�\}}Wntk
ru|SX|t	j
kr�|Syt|�}Wntk
r�|SXtj|�r�|Sy7t	|jddd�}tj
|j�|j�Wntjk
r|SXdS(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.breakRiN(R#treadlockRR%RtENOENTR tsplitt
ValueErrorRRtintttestpidtunlinkRRt	LockError(R
RR-thostR	tl((s2/sys/lib/python2.7/site-packages/mercurial/lock.pyR(Zs0

cCs�|jdkr!|jd8_n�|jdkr�d|_tj�|jkrRdS|jrh|j�nytj|j�Wntk
r�nXx|j	D]
}|�q�WndS(s�release 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(
RRRR	RR#R5RR%R(R
tcallback((s2/sys/lib/python2.7/site-packages/mercurial/lock.pyR�s		

N(t__name__t
__module__t__doc__R RRRRRR(R(((s2/sys/lib/python2.7/site-packages/mercurial/lock.pyRs

				&cGs.x'|D]}|dk	r|j�qqWdS(N(R R(tlocksR((s2/sys/lib/python2.7/site-packages/mercurial/lock.pyR�s
(
R#RRRR!RRtobjectRR(((s2/sys/lib/python2.7/site-packages/mercurial/lock.pyt<module>s0

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].