403Webshell
Server IP : 108.167.183.253  /  Your IP : 216.73.216.180
Web Server : Apache
System : Linux gator4209.hostgator.com 5.14.0-687.39.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Aug 18 06:09:16 EDT 2026 x86_64
User : raghunath ( 2558)
PHP Version : 8.3.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib64/python3.9/site-packages/hgext/fastannotate/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib64/python3.9/site-packages/hgext/fastannotate/__pycache__/revmap.cpython-39.opt-1.pyc
a

�+�b�"�@s�ddlmZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZm
Z
ddlmZdZdZd	ZGd
d�de�Zdd
�ZdS)�)�absolute_importN)�hex)�open)�error�pycompat�)r��c@s�eZdZdZdZd!dd�Zdd�Zedd	��Zd"dd�Z	d
d�Z
dd�Zdd�Zdd�Z
d#dd�Zdd�Zdd�Zdd�Zedd��Zdd �ZdS)$�revmapz~trivial hg bin hash - linelog rev bidirectional map

    also stores a flag (uint8) for each revision, and track renames.
    sREVMAP1NcCsX||_dg|_dg|_i|_dg|_dg|_d|_|rTtj�|�rL|�	�n|�
�dS)a=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.Nr����)�path�_rev2hsh�	_rev2flag�_hsh2rev�_renamerevs�_renamepaths�_lastmaxrev�os�exists�_load�flush)�selfr
�r�?/usr/lib64/python3.9/site-packages/hgext/fastannotate/revmap.py�__init__<s
zrevmap.__init__cCsV|jdd�|_|jdd�|_|j��|_|jdd�|_|jdd�|_d|_dS)z>copy the map data from another revmap. do not affect self.pathNr)rrr�copyrrr)rZrhsrrr�copyfromSszrevmap.copyfromcCst|j�dS)z"return max linelog revision numberr)�lenr)rrrr�maxrev\sz
revmap.maxrevFcCs�||jvrt�dt|���t|�tkr6t�dt��t|j�}d}|rP|t	O}|dur�||j
dkr�|tO}|j�
|�|j
�
|�|j�
|�|j�
|�||j|<|r�|��|S)z~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 longrNr)rr�CorruptedFileErrorrr�_hshlen�hgerrorZProgrammingErrorr�sidebranchflagr�
renameflagr�appendrr)r�hshZ
sidebranchr
r�idx�flagrrrr%as,

��

z
revmap.appendcCs ||jks|dkrdS|j|S)z>convert linelog revision to hg hash. return None if not found.rN)rr�r�revrrr�rev2hsh|szrevmap.rev2hshcCs ||jks|dkrdS|j|S)zkget the flag (uint8) for a given linelog revision.
        return None if revision does not exist.
        rN)rrr)rrr�rev2flag�szrevmap.rev2flagcCs2||jks|dkrdSt�|j|�d}|j|S)zcget the path for a given linelog revision.
        return None if revision does not exist.
        rNr)r�bisectZbisect_rightrr)rr*r'rrr�rev2path�szrevmap.rev2pathcCs|j�|�S)z>convert hg hash to linelog revision. return None if not found.)r�get)rr&rrr�hsh2rev�szrevmap.hsh2revcCs4dg|_dg|_i|_dg|_d|_|r0|��dS)z3make the map empty. if flush is True, write to diskNrr)rrrZ	_rev2pathrr)rrrrr�clear�szrevmap.clearcCs�|js
dS|jdkrrt|jd��@}|�|j�t�dt|j��D]}|�	||�q@Wd�q�1sf0YnVt|jd��:}t�|jdt|j��D]}|�	||�q�Wd�n1s�0Y|j
|_dS)z write the state down to the fileNrswbrsab)r
rr�write�HEADERrZxrangerr�	_writerevr)r�f�irrrr�s
.�,zrevmap.flushc	Cs|js
dSd}t}t|jd���}|�t|j��|jkr>t���|jdd�|�|�}|sZq�t	|�}t|j
�}|t@r�|�|�}|j
�|�|j�|�|�|�}t|�|kr�t���||j|<|j�|�|j
�|�qJWd�n1s�0Y|j|_dS)zload state from fileNr�rbF)r)r
r!r�readrr3rr r1�ordrr$�	_readcstrrr%rrrrr)	rZflaglenZhshlenr5�bufr(r*r
r&rrrr�s0




,zrevmap._loadcCsj|j|}|j|}|�t�d|��|t@r\|�|�}|durNt�d|��|�|d�|�|�dS)zappend a revision data to file�BNscannot find path for %s�)	rrr2�struct�packr$r.rr )rr*r5r(r&r
rrrr4�s


zrevmap._writerevcCs2d}|�d�}|st���|dkr$q.||7}q|S)z,read a C-language-like ''-terminated stringrrr=)r8rr )r5r;Zchrrrr:�s

zrevmap._readcstrcCsht|t�r|\}}n|��|��}}|�|�}|dur<dS|durV||�|�krVdS|�|�t@dkS)z�(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.
        NFr)�
isinstance�tupleZnoder
r0r.r,r#)rr5r&r
r*rrr�__contains__�s


zrevmap.__contains__)N)FNF)F)�__name__�
__module__�__qualname__�__doc__r3rr�propertyrr%r+r,r.r0r1rrr4�staticmethodr:rBrrrrr
4s$
	

	

r
cCsvd}zZt|d��<}|�ttj�|��ttj�kr>|�	t�}Wd�n1sR0YWnt
ypYn0|S)z�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.
    Nr7)r�seekr!�io�SEEK_END�tellrr
r3r8�IOError)r
r&r5rrr�getlastnode�s,rN)Z
__future__rr-rJrr>Zmercurial.noderZmercurial.pycompatrZ	mercurialrr"r�r#r$r!�objectr
rNrrrr�<module>sH

Youez - 2016 - github.com/yon3zu
LinuXploit