Ë ù3ýLQ,lãóð—dZddlmZddlmZmZdZedzZdZedzZ ee z Z e dzZ e dz dzZ d „Z d „Zd „Zd „Zd „Zed«D�cgc] }e|«‘Œ c}Zd„Zd„Zd„Zd„ZGd„d«Zycc}w)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 é)Únullrev)ÚpycompatÚutiliÀéééécó:—d}|D]}|dzt|«z}Œ|S)zconvert a bytestring to a longéé)Úord)ÚbsÚvÚbs ú2usr/lib/python3.12/site-packages/mercurial/pvec.pyÚ_binrCs(€à €AÛ ˆØ �‰G”c˜!“fÑ ‰ðà €Hócój—d}t|«D]"}tj|dz«|z}|dz}Œ$|S)Nréÿr)ÚrangerÚbytechr)rÚlrÚps rÚ_strrKs>€à €BÜ �1ŽXˆÜ × Ñ ˜a #™gÓ &¨Ñ +ˆØ ˆa‰‰ðð €IrcóJ—t|dt«t|td«fS)zdepth and bitvecN)rÚ _depthbytes)rs rÚ_splitrTs#€ä ��,”;�Ó ¤$ q¬¨ Ó"7Ð 7Ð7rcóD—t|t«t|t«zS©N)rrÚ _vecbytes)ÚdepthÚbitvecs rÚ_joinr#Ys€Ü �”{Ó #¤d¨6´9Ó&=Ñ =Ð=rcó2—d}|r|dzr|dz }|dz}|rŒ|S)Nr r©)ÚxÚcs rÚ_hweightr(]s/€Ø €AÙ Ø ˆqŠ5Ø �‰FˆAØ ˆa‰ˆò ð €Hrr cóF—||z }d}|r|t|dzz }|dz}|rŒ|S)z+find the hamming distance between two longsr rr)Ú_htab)ÚarÚdr's rÚ_hammingr-is:€à ˆA‰€AØ €AÙ Ø ŒU�1�t‘8‰_ÑˆØ ˆa‰ˆò ð €Hrcóø—|\}}|\}}||kr ||||f\}}}}t||«}||z }|} ||z } d} ||kDr ||z dzdz} nd} || z} | r| r| | zr | | z} | dz} | dz} | rŒ| | fSt| |«} | | fS)Nrr )r-Ú_flipbit)r&Úyr'Úd1Úv1Úd2Úv2ÚhdistÚddistrÚmÚiÚchangesr!s rÚ _mergevecr:ssÖ€ð �F€BˆØ �F€BˆØ ˆB‚wؘR  R˜‰ˆˆB��Bä �R˜Ó €EØ �‰G€EØ €AØ ˆR‰€AØ €Aà ˆu‚}ð˜5‘= 1Ñ$¨Ñ*‰ðˆØ �‰L€Eñ ÙØ�1ŠuØ�Q‘�ؘ1‘ �Ø �!‰GˆAò ð �!ˆ8€Oô �Q˜‹Nˆà �!ˆ8€Orcó<—t|«dztz}|d|zz S)Nlÿÿr)ÚhashÚ_vecbits)rÚnodeÚbits rr/r/™s#€ä �‹:˜ Ñ "¤hÑ .€CØ ��S‘‰>Ðrcót—|j«}tj|d«si|_|j}|j «|vr·|j }t |j «dz«D]Œ}||vsŒ|j|«}|j|«\}}|tk(rdt|dzdt«f||<ŒQ|tk(r||\}} |dzt| |«f||<Œwt|||||«||<ŒŽt||j «Ž} ttj | ««S)z3construct a pvec for ctx while filling in the cacheÚ _pveccacherr éN)ÚreporÚ safehasattrrAÚrevÚ changelogrr>Ú parentrevsrrr r/r:r#ÚpvecÚ b85encode) ÚctxÚrÚpvcÚclÚnr>Úp1Úp2r,rrs rÚctxpvecrQŸs€à �‰‹ €AÜ × Ñ ˜A˜|Ô ,؈Œ Ø �,‰,€CØ ‡w�wƒy˜ÑØ �[‰[ˆÜ�s—w‘w“y 1‘}Ö%ˆAؘŠ|Ø—w‘w˜q“z�ØŸ™ qÓ)‘��BØœ’=ठt¨a¡x°´)Ð&<Ó!=Ð>�C˜’FØœ7’]ؘr™7‘D�A�qØ !™e¤X¨a°Ó%6Ð7�C˜’Fä& s¨2¡w°°B±¸Ó>�C˜’Fð&ô ��C—G‘G“I‘Ð €BÜ ”—‘˜rÓ"Ó #Ð#rcóB—eZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z y ) rHcóª—t|t«r3||_tt j |««\|_|_yt|«|_yr) Ú isinstanceÚbytesÚ_bsrrÚ b85decodeÚ_depthÚ_vecrQ)ÚselfÚ hashorctxs rÚ__init__z pvec.__init__¸s;€Ü �i¤Ô 'Ø ˆDŒHÜ%+¬D¯N©N¸9Ó,EÓ%FÑ "ˆDŒK˜�ä  Ó*ˆD�Ircó—|jSr)rV)rZs rÚ__str__z pvec.__str__¿s €Ø�x‰xˆrcój—|j|jk(xr|j|jk(Sr)rYrX©rZrs rÚ__eq__z pvec.__eq__Âs'€Ø�y‰y˜AŸF™FÑ"Ò> t§{¡{°a·h±hÑ'>Ð>rcóŠ—|j|jz }|dkryt|j|j«|kDryy)Nr FT)rXr-rY©rZrÚdeltas rÚ__lt__z pvec.__lt__Ås;€Ø—‘˜4Ÿ;™;Ñ&ˆØ �1Š9ØÜ �D—I‘I˜qŸv™vÓ &¨Ò .ØØrcó —||kSrr%r`s rÚ__gt__z pvec.__gt__Ís €Ø�4‰xˆrcó�—t|j|jz «}t|j|j«|kryy)NFT)ÚabsrXr-rYrcs rÚ__or__z pvec.__or__Ðs6€Ü�A—H‘H˜tŸ{™{Ñ*Ó+ˆÜ �D—I‘I˜qŸv™vÓ &¨%Ò /ØØrcóT—||zr td«‚|j|jz S)Nsconcurrent pvecs)Ú ValueErrorrXr`s rÚ__sub__z pvec.__sub__Ös(€Ø �!Š8ÜÐ0Ó1Ð 1Ø�{‰{˜QŸX™XÑ%Ð%rcóž—t|j|jz «}t|j|j«}t ||«Sr)rirXr-rYÚmax)rZrr,Úhs rÚdistancez pvec.distanceÛs9€Ü �—‘˜4Ÿ;™;Ñ&Ó 'ˆÜ �T—Y‘Y §¡Ó 'ˆÜ�1�a‹yÐrcóª—t|j|jz «}|tkDs't |j |j «tkDryy)NF)rir!rXÚ_radiusr-rY)rZrÚdists rÚnearz pvec.nearàs?€Ü�1—7‘7˜TŸ[™[Ñ(Ó)ˆØ ”'Š>œX d§i¡i°·±Ó8¼7ÒBØðCrN) Ú__name__Ú __module__Ú __qualname__r\r^rarergrjrmrqrur%rrrHrH·s/„ò+òò?òòòò &ò ó rrHN)Ú__doc__r>rÚrrÚ_sizeÚ_bytesÚ _depthbitsrr r=rsrrrr#r(rr*r-r:r/rQrH)r&s0rÚr~s°ðñ)õX÷ð €Ø �!‰€Ø € ؘA‰o€ Ø �[Ñ € Ø �q‰=€Ø �b‰=˜QÑ €ò òò8ò >ò ñ$ CœjÓ)™j˜‰�!�˜jÑ)€ò ò#òLò $÷0,ò,ùòc *sÁ A3