HEX
Server: Apache
System: Linux p102.lithium.hosting 4.18.0-553.141.1.el8_10.x86_64 #1 SMP Fri Jul 10 17:48:02 UTC 2026 x86_64
User: bvzmoamr (9955)
PHP: 8.1.34
Disabled: syslog
Upload Files
File: //proc/self/root/usr/lib64/python2.7/site-packages/hgext/fastannotate/revmap.pyc
�
1�3\c@@s�ddlmZddlZddlZddlZddlmZddlmZ	m
Z
ddlmZdZdZ
dZd	efd
��YZd�ZdS(i(tabsolute_importN(thex(terrortpycompati(RiitrevmapcB@s�eZdZdZdd�Zd�Zed��Ze	de	d�Z
d�Zd�Zd�Z
d	�Ze	d
�Zd�Zd�Zd
�Zed��Zd�ZRS(s~trivial hg bin hash - linelog rev bidirectional map

    also stores a flag (uint8) for each revision, and track renames.
    sREVMAP1cC@s�||_dg|_dg|_i|_dg|_dg|_d|_|r}tjj	|�rp|j
�q}|j�ndS(s=create or load the revmap, optionally associate to a file

        if path is None, the revmap is entirely in-memory. the caller is
        responsible for locking. concurrent writes to a same file is unsafe.
        the caller needs to make sure one file is associated to at most one
        revmap object at a time.iti����N(tpathtNonet_rev2hsht	_rev2flagt_hsh2revt_renamerevst_renamepathst_lastmaxrevtostexistst_loadtflush(tselfR((s?/usr/lib64/python2.7/site-packages/hgext/fastannotate/revmap.pyt__init__9s			
cC@sS|j|_|j|_|jj�|_|j|_|j|_d|_dS(s>copy the map data from another revmap. do not affect self.pathi����N(RR	R
tcopyRRR
(Rtrhs((s?/usr/lib64/python2.7/site-packages/hgext/fastannotate/revmap.pytcopyfromPs



cC@st|j�dS(s"return max linelog revision numberi(tlenR(R((s?/usr/lib64/python2.7/site-packages/hgext/fastannotate/revmap.pytmaxrevYscC@s||jkr+tjdt|���nt|�tkrStjdt��nt|j�}d}|r{|t	O}n|dk	r�||jdkr�|tO}|j
j|�|jj|�n|jj|�|jj|�||j|<|r|j�n|S(s~add a binary hg hash and return the mapped linelog revision.
        if flush is True, incrementally update the file.
        s%r is in revmap alreadyshsh must be %d-char longii����N(R
RtCorruptedFileErrorRRt_hshlenthgerrortProgrammingErrorRtsidebranchflagRRt
renameflagRtappendR	R(Rthsht
sidebranchRRtidxtflag((s?/usr/lib64/python2.7/site-packages/hgext/fastannotate/revmap.pyR^s$



cC@s*||jks|dkrdS|j|S(s>convert linelog revision to hg hash. return None if not found.iN(RRR(Rtrev((s?/usr/lib64/python2.7/site-packages/hgext/fastannotate/revmap.pytrev2hshuscC@s*||jks|dkrdS|j|S(skget the flag (uint8) for a given linelog revision.
        return None if revision does not exist.
        iN(RRR	(RR$((s?/usr/lib64/python2.7/site-packages/hgext/fastannotate/revmap.pytrev2flag{scC@sC||jks|dkrdStj|j|�d}|j|S(scget the path for a given linelog revision.
        return None if revision does not exist.
        iiN(RRtbisecttbisect_rightRR(RR$R"((s?/usr/lib64/python2.7/site-packages/hgext/fastannotate/revmap.pytrev2path�scC@s|jj|�S(s>convert hg hash to linelog revision. return None if not found.(R
tget(RR ((s?/usr/lib64/python2.7/site-packages/hgext/fastannotate/revmap.pythsh2rev�scC@sMdg|_dg|_i|_dg|_d|_|rI|j�ndS(s3make the map empty. if flush is True, write to diskRi����N(RRR	R
t	_rev2pathR
R(RR((s?/usr/lib64/python2.7/site-packages/hgext/fastannotate/revmap.pytclear�s		cC@s�|js
dS|jdkr�t|jd��M}|j|j�x3tjdt|j��D]}|j	||�q]WWdQXnXt|jd��D}x:tj|jdt|j��D]}|j	||�q�WWdQX|j
|_dS(s write the state down to the fileNi����twbitab(RR
topentwritetHEADERRtxrangeRRt	_writerevR(Rtfti((s?/usr/lib64/python2.7/site-packages/hgext/fastannotate/revmap.pyR�s	"c	C@s^|js
dSd}t}t|jd��!}|jt|j��|jkr^tj��n|jdt	�x�t
rG|j|�}|s�Pnt|�}t|j�}|t
@r�|j|�}|jj|�|jj|�n|j|�}t|�|krtj��n||j|<|jj|�|jj|�qqWWdQX|j|_dS(sload state from fileNitrbR(RRR0treadRR2RRR-tFalsetTruetordRRt	_readcstrRRRR
R	RR
(	RtflaglenthshlenR5tbufR#R$RR ((s?/usr/lib64/python2.7/site-packages/hgext/fastannotate/revmap.pyR�s2	!	

cC@s�|j|}|j|}|jtjd|��|t@r�|j|�}|dkrntj	d|��n|j|d�n|j|�dS(sappend a revision data to filetBscannot find path for %ssN(
R	RR1tstructtpackRR)RRR(RR$R5R#R R((s?/usr/lib64/python2.7/site-packages/hgext/fastannotate/revmap.pyR4�s


cC@sUd}xHtrP|jd�}|s3tj��n|dkrCPn||7}q	W|S(s,read a C-language-like ''-terminated stringRis(R:R8RR(R5R?tch((s?/usr/lib64/python2.7/site-packages/hgext/fastannotate/revmap.pyR<�s	cC@s�t|t�r|\}}n|j�|j�}}|j|�}|dkrVtS|dk	r{||j|�kr{tS|j|�t	@dkS(s�(fctx or (node, path)) -> bool.
        test if (node, path) is in the map, and is not in a side branch.
        f can be either a tuple of (node, path), or a fctx.
        iN(
t
isinstancettupletnodeRR+RR9R)R&R(RR5R RR$((s?/usr/lib64/python2.7/site-packages/hgext/fastannotate/revmap.pyt__contains__�s!N(t__name__t
__module__t__doc__R2RRRtpropertyRR9RR%R&R)R+R-RRR4tstaticmethodR<RG(((s?/usr/lib64/python2.7/site-packages/hgext/fastannotate/revmap.pyR1s 										
cC@sxd}yZt|d��E}|jtd�|j�ttj�krY|jt�}nWdQXWnt	k
rsnX|S(s�return the last hash in a revmap, without loading its full content.
    this is equivalent to `m = revmap(path); m.rev2hsh(m.maxrev)`, but faster.
    R7iN(
RR0tseekRttellRRR2R8tIOError(RR R5((s?/usr/lib64/python2.7/site-packages/hgext/fastannotate/revmap.pytgetlastnode�s
(t
__future__RR'RRAtmercurial.nodeRt	mercurialRRRRRRRtobjectRRP(((s?/usr/lib64/python2.7/site-packages/hgext/fastannotate/revmap.pyt<module>s�