Ë 6›ÉöéóÌã ó@—ddlZddlZddlmZddlmZmZmZddlm Z m Z m Z ddl m Z ddlmZddlmZej&ej(«Zd Zd „Zej0d «Zd „Zd „Zd„Zd„Zd„Zd„Zdd„Z d„Z!d„Z"ddddde jFddddf d„Z$d„Z%y)éNé)Ú_)ÚbinÚnullrevÚsha1nodeconstants)ÚdagopÚerrorÚmdiff)Ú repository)Úsidedata)Úhashutilécó—|tjk(r&tj«}|j |«n4||kr|}|}n|}|}t j |«}|j |«|j |«|j«S)zéCompute the SHA-1 for revision data and its parents. This hash combines both the current file contents and its history in a manner that makes it easy to distinguish nodes with the same content in the revision graph. )rÚnullidÚ _nullhashÚcopyÚupdater Úsha1Údigest)ÚtextÚp1Úp2ÚsÚaÚbs ú?usr/lib/python3.12/site-packages/mercurial/utils/storageutil.pyÚhashrevisionsha1r"sw€ð Ô × %Ñ %Ò%ä �N‰NÓ ˆØ �‰�� ð �Š7؈A؉AàˆA؈AÜ �M‰M˜!Ó ˆØ �‰�Œ ؇H�HˆT„NØ �8‰8‹:Ðóó cóÖ—|dddk7rytj|d«j«}|d|}i}|j«D]}|j dd«\}}|||<Œ||dzfS)z�Parse metadata header from revision data. Returns a 2-tuple of (metadata, offset), where both can be None if there is no metadata. Nrr)NNs: r)Ú METADATA_REÚsearchÚstartÚ splitlinesÚsplit)rrÚmtextÚmetaÚlÚkÚvs rÚ parsemetar+?s€€ð ˆBˆQ€x�9ÒØÜ×ј4 Ó#×)Ñ)Ó+€AØ ��1ˆI€EØ €DØ × Ñ Ö ˆØ�w‰w�u˜aÓ ‰ˆˆ1؈ˆQŠð ð ��Q‘ˆ;Ðrcó\‡—t‰«}djˆfd„|D««}d||fzS)z2Add metadata to fulltext to produce revision text.rc3ó2•K—|]}d|‰|fz–—Œy­w)s%s: %s N©)Ú.0r)r's €rÚ zpackmeta..Tsøèø€ÐA¹D°q˜  q¨$¨q©' lÕ2¹Dùsƒs %s %s)ÚsortedÚjoin)r'rÚkeysÚmetatexts` rÚpackmetar5Qs0ø€ä �$‹<€DØ�x‰xÓA¹DÓAÓA€HØ  (¨DÐ!1Ñ 1Ð1rcó.—t|«d}|xrd|vS)Nrscensored)r+)rr's rÚiscensoredtextr7Xs €Ü �T‹?˜1Ñ €DØ Ò '�K 4Ð'Ð'rcó\—|jd«s|S|jdd«}||dzdS)z«Extract just the revision data from source text. Returns ``text`` unless it has a metadata header, in which case we return a new buffer without hte metadata. rrN)Ú startswithÚindex)rÚoffsets rÚfiltermetadatar<]s6€ð �?‰?˜9Ô %؈ à �Z‰Z˜  1Ó %€FØ �˜‘ � Ð ÐrcóÄ—|j|«dtjk7ryt|j |««d}|rd|vrd|vr|dt |d«fSy)z›Resolve file revision copy metadata. Returns ``False`` if the file has no copy metadata. Otherwise a 2-tuple of the source filename and node. rFscopyscopyrev)Úparentsrrr+Úrevisionr)ÚstoreÚnoder's rÚfilerevisioncopiedrBjsl€ð  ‡}�}�TÓ˜1ÑÔ!2×!9Ñ!9Ò9ðä �U—^‘^ DÓ)Ó *¨1Ñ -€Dñ  �˜4‘ J°$Ñ$6Ø�G‰}œc $ zÑ"2Ó3Ð3Ð3à rcó—|jd«rd|z}n|}|j|«\}}t|||«}||k(ry|j|j |««r|dk(S|j |«r|j |«|k(Sy)ahDetermines whether file data is equivalent to a stored node. Returns True if the passed file data would hash to the same value as a stored revision and False otherwise. When a stored revision is censored, filedata must be empty to have equivalence. When a stored revision has copy metadata, it is ignored as part of the compare. rs  TrF)r9r>rÚ iscensoredÚrevÚrenamedÚread)r@rAÚfiledataÚ revisiontextrrÚ computednodes rÚfiledataequivalentrK…s“€ð×ј9Ô%Ø&¨Ñ1‰ àˆ à �]‰]˜4Ó �F€Bˆä# L°"°bÓ9€Là�tÒØð ×јŸ ™  $›Ô(ؘ3‰Ðð ‡}�}�TÔØ�z‰z˜$Ó 8Ñ+Ð+à rcóP—d}|�||kDrd}||z }||kDr|}n|}t|||«S)z)Iterate over revision numbers in a store.réÿÿÿÿ)Úrange)Ústorelenr#ÚstopÚsteps rÚiterrevsrRªsB€à €Dà ÐØ �4Š<؈DØ �‰ ˆØ �(Š?؉Dàˆä �˜˜dÓ #Ð#rcóÔ—t|t«r |j|«St|«t|j«k(r |j|«|St|«dt|j«zk(r t|«}|j|«|S t|«}d|z|k7rt‚ |j|«S#t$r$t j d|z|t d««‚wxYw#tj $rYŒ´wxYw#t$rYŒ€wxYw#ttf$rYnwxYwn#ttf$rYnwxYwt j ||t d««‚)aüResolve the file node for a value. ``store`` is an object implementing the ``ifileindex`` interface. ``fileid`` can be: * A binary node of appropiate size (e.g. 20/32 Bytes). * An integer revision number * A hex node of appropiate size (e.g. 40/64 Bytes). * A bytes that can be parsed as an integer representing a revision number. ``identifier`` is used to populate ``error.LookupError`` with an identifier for the store. Raises ``error.LookupError`` on failure. s%dsno match foundr)Ú isinstanceÚintrAÚ IndexErrorr Ú LookupErrorrÚlenrrErÚ TypeErrorÚ ValueErrorÚ OverflowError)r@ÚfileidÚ identifierÚrawnoderEs rÚ fileidlookupr_ºsm€ô"�&œ#Ôð Ø—:‘:˜fÓ%Ð %ô  ˆ6ƒ{”c˜%Ÿ,™,Ó'Ò'ð Ø �I‰I�fÔ ØˆMô ˆ6ƒ{�aœ#˜eŸl™lÓ+Ñ+Ò+ð ܘ&“kˆGØ �I‰I�gÔ ØˆNð  Ü�&‹kˆà �3‰;˜&Ò ÜÐ ð Ø—:‘:˜c“?Ð "øô7ò Ü×#Ñ#ؘ‘  ¬AÐ.?Ó,@óð ð ûô× Ñ ò Ù ð ûôò Ù ð ûôœIÐ&ò Ù ð úØ øÜ œ Ð &ò Ù ð úô × Ñ ˜F J´Ð2CÓ0DÓ EÐEs_’CÁC7Á=DÂD5Â6DÃ-C4Ã7D Ä D Ä DÄDÄD1Ä.D5Ä0D1Ä1D5Ä5EÅEcó’—t«}|dz}i}t«}|D]&} || «} | || <| |k\sŒ|j| «Œ(|r||dz}|j|«} | |kr|j|«n|j| «||«D]0} | tk7sŒ || «} | || <| |k\sŒ |j| «Œ2|rŒ|||fS)a’Resolve information needed to strip revisions. Finds the minimum revision number that must be stripped in order to strip ``minlinkrev``. Returns a 2-tuple of the minimum revision number to do that and a set of all revision numbers that have linkrevs that would be broken by that strip. ``tiprev`` is the current tip-most revision. It is ``len(store) - 1``. ``headrevs`` is an iterable of head revisions. ``linkrevfn`` is a callable that receives a revision and returns a linked revision. ``parentrevsfn`` is a callable that receives a revision number and returns an iterable of its parent revision numbers. r)ÚsetÚaddÚpopÚremover)Ú minlinkrevÚtiprevÚheadrevsÚ linkrevfnÚ parentrevsfnÚ brokenrevsÚ strippointÚheadsÚfuturelargelinkrevsÚheadÚ headlinkrevÚlinkrevÚpÚplinkrevs rÚresolvestripinforsòsá€ô"“€Jؘ!‘€Jà €EÜ›%ÐÛˆÙ “oˆ Ø!ˆˆd‰ Ø ˜*Ó $Ø × #Ñ # KÕ 0ð ñ Ø�a‰ˆ Ø—)‘)˜JÓ'ˆà �ZÒ Ø �N‰N˜:Õ &à × &Ñ & wÔ /á˜jÖ)ˆAØ”G‹|Ù$ Q›<�Ø#��a‘ؘzÓ)Ø'×+Ñ+¨HÕ5ð *ò ð �zÐ !Ð!rFc #óT ‡%‡&‡'‡(K—|j}|jŠ'|jŠ(|dk(r|D�cgc] }‰'|«‘Œ }}nO|dk(r6|D�chc] }‰'|«’Œ }}tj||j«}nt ˆ'fd„|D««}d}| t jk(s| r‰(|d«d}t«Š&t«Š%| r8tˆ(fd„|D««}|j|«|j|d¬«Š%ˆ%ˆ&fd „}|D�]0}|tk(rŒd}| � | d xxd z cc<||«}‰(|«\}}| �$||k7r|tk7r|tk7r | d xxd z cc<|r/||«}| �+|tk(r| d xxd z cc<n| dxxd z cc<nt}| t jk(r| �d}|}n¡| t jk(r | �d}t}nƒ| t jk(r| �d}|}ni||«r| �d}|}nZ|tk(r| �d}|}nJ|tk7r| �| dxxd z cc<n1||«r| �d}|}n"||«r| �d}|}n|�| �d}|}n | �d}t}tk7r"|� |||«s| �d}| dxxd z cc<t}d}d}d}| �r|j|«s|j|«rD |j|«}|tk7�rÚ|r ||«}�nÎt'|j|««}�n²|tk(rS| t jk7r@| �| dxxd z cc<| dxxd z cc<|j|«}‰&j)|«�nV|r†| �z|dk(r| dxxd z cc<| dxxd z cc<nZ|dk(r| dxxd z cc<| dxxd z cc<n:|dk(r| dxxd z cc<| dxxd z cc<n|dk(r| dxxd z cc<nJd«‚|||«}n½| �‡|dk(r| dxxd z cc<| dxxd z cc<ng|dk(r| dxxd z cc<| dxxd z cc<nG|dk(r| dxxd z cc<| dxxd z cc<n'|dk(r| dxxd z cc<| dxxd z cc<nJd«‚t+j,|j|«|j|««}‰&j)|«d}d} | rE |j/|«}!t1j2|| |!|¬«\}"} |"rt1j4|"«}|r||«nd}#d}$|r|$t6z}$|#| d| d zz}#||||«||«||«|#|||||$¬« –—|}�Œ3ycc}wcc}w#t j"$r(}| �d}| dxxd z cc<|j$}Yd}~�ŒÃd}~wwxYw#t j"$ri}"YŒÊwxYw­w) a® Generic implementation of ifiledata.emitrevisions(). Emitting revision data is subtly complex. This function attempts to encapsulate all the logic for doing so in a backend-agnostic way. ``store`` Object conforming to ``ifilestorage`` interface. ``nodes`` List of revision nodes whose data to emit. ``resultcls`` A type implementing the ``irevisiondelta`` interface that will be constructed and returned. ``deltaparentfn`` (optional) Callable receiving a revision number and returning the revision number of a revision that the internal delta is stored against. This delta will be preferred over computing a new arbitrary delta. If not defined, a delta will always be computed from raw revision data. ``candeltafn`` (optional) Callable receiving a pair of revision numbers that returns a bool indicating whether a delta between them can be produced. If not defined, it is assumed that any two revisions can delta with each other. ``rawsizefn`` (optional) Callable receiving a revision number and returning the length of the ``store.rawdata(rev)``. If not defined, ``len(store.rawdata(rev))`` will be called. ``revdifffn`` (optional) Callable receiving a pair of revision numbers that returns a delta between them. If not defined, a delta will be computed by invoking mdiff code on ``store.revision()`` results. Defining this function allows a precomputed or stored delta to be used without having to compute on. ``flagsfn`` (optional) Callable receiving a revision number and returns the integer flags value for it. If not defined, flags value will be 0. ``deltamode`` constaint on delta to be sent: * CG_DELTAMODE_STD - normal mode, try to reuse storage deltas, * CG_DELTAMODE_PREV - only delta against "prev", * CG_DELTAMODE_FULL - only issue full snapshot. Whether to send fulltext revisions instead of deltas, if allowed. ``nodesorder`` ``revisiondata`` ``assumehaveparentrevisions`` ``sidedata_helpers`` (optional) If not None, means that sidedata should be included. See `revlogutil.sidedata.get_sidedata_helpers`. ``debug_info` An optionnal dictionnary to gather information about the bundling process (if present, see config: debug.bundling.stats. snodesslinearc3ó.•K—|] }‰|«–—Œy­w©Nr.)r/ÚnÚfrevs €rr0z emitrevisions..†søèø€Ð-¡u !‘d˜1—g¡uùsƒNrc3ó<•K—|]}‰|«D]}|–—ŒŒy­wrvr.)r/Úrrqr>s €rr0z emitrevisions..‘søèø€Ð?¡d ±G¸A¶J¨qœ1°J˜1¡dùsƒT)Ú inclusivecó,•—|tk(ry|‰vxs|‰vS)z5Is a delta against this revision usable over the wireF)r)rEÚ availableÚemitteds €€rÚis_usable_basez%emitrevisions..is_usable_base•s!ø€à ”'Š>ØØ�gˆ~Ò1 ¨ Ð!1Ð1rzrevision-totalrz merge-totalzavailable-fullzavailable-deltaÚprevÚfullrÚstoragezdenied-base-not-availablerzdenied-delta-candeltafnzdenied-delta-not-availablezcomputed-deltaz delta-fullzdelta-against-prevzdelta-against-p1zreused-storage-deltaÚ unreachable)rr)r@Úsidedata_helpersr rE) rAÚp1nodeÚp2nodeÚbasenodeÚflagsÚbaserevisionsizer?Údeltar Úprotocol_flags)rArEÚ parentrevsrÚ linearizer1r ÚCG_DELTAMODE_PREVraÚdifference_updateÚ ancestorsrÚCG_DELTAMODE_FULLÚCG_DELTAMODE_P1rDÚrawdatar ÚCensoredNodeErrorÚ tombstonerXrbr Útextdiffr Ú sidedatamodÚrun_sidedata_helpersÚserialize_sidedataÚCG_FLAG_SIDEDATA))r@ÚnodesÚ nodesorderÚ resultclsÚ deltaparentfnÚ candeltafnÚ rawsizefnÚ revdifffnÚflagsfnÚ deltamodeÚ revisiondataÚassumehaveparentrevisionsr„Ú debug_infoÚfnoderwÚrevsÚprevrevÚ common_headsrrEÚdebug_delta_sourcerAÚp1revÚp2revÚdeltaparentrevÚbaserevr?rŠr‰ÚeÚserialized_sidedataÚsidedata_flagsÚ old_sidedatar rˆr‹r}r~rxr>s) @@@@rÚ emitrevisionsr´&sžûèø€ðl �J‰J€EØ �9‰9€DØ×Ñ€Gà�XÒÙ!&Ó'¡˜A‘�Q• ˆÑ'Ø �yÒ Ù!&Ó'¡˜A‘�Q• ˆÐ'Ü�‰˜t U×%5Ñ%5Ó6‰äÓ-¡uÓ-Ó-ˆà€Gà”J×0Ñ0Ò0Ñ4MÙ˜$˜q™'Ó" 1Ñ%ˆô‹e€GÜ“€IÙ ÜÓ?¡dÓ?Ó?ˆ Ø×&Ñ& tÔ,Ø—O‘O L¸D�OÓAˆ õ2ô ˆØ ”'Š>Ø à!ÐØ Ð !Ø Ð'Ó (¨AÑ -Ó (á�S‹zˆÙ˜s“|‰ ˆˆuà Ð !ؘŠ~ %¬7Ò"2°uÄÒ7Gؘ=Ó)¨QÑ.Ó)á Ù*¨3Ó/ˆNØÐ%Ø!¤WÒ,ØÐ/Ó0°AÑ5Ô0àÐ0Ó1°QÑ6Ô1ô%ˆNð œ ×4Ñ4Ò 4ØÐ%Ø%+Ð"؉Gðœ*×6Ñ6Ò 6ØÐ%Ø%+Ð"܉Gà œ*×4Ñ4Ò 4ØÐ%Ø%)Ð"؉Gñ ˜NÔ +ØÐ%Ø%.Ð"Ø$‰GØ œwÒ &ØÐ%Ø%.Ð"Ø$‰Gà¤Ò(¨ZÐ-CØÐ6Ó7¸1Ñ<Ô7ñ  Ô&ØÐ)Ø)-Ð&Ø‘á Ô&ØÐ)Ø)-Ð&Ø‘ðÐ$ØÐ)Ø)/Ð&Ø!‘àÐ)Ø)/Ð&Ü!�ð ”wÒ ØÐ&Ù˜w¨Ô,àÐ%Ø%+Ð"ØÐ4Ó5¸Ñ:Ó5܈GàˆØˆØÐâ Ø×Ñ Ô(¨E×,<Ñ,<¸SÔ,Að+Ø$Ÿ}™}¨TÓ2�HðœgÓ%Ù Ù+4°WÓ+=Ò(ä+.¨u¯}©}¸WÓ/EÓ+FÒ(ðœ7Ò" y´J×4PÑ4PÒ'PàÐ)ØÐ/Ó0°AÑ5Ó0ؘ|Ó,°Ñ1Ó,Ø Ÿ=™=¨Ó.�Ø— ‘ ˜CÖ áØ!Ð-Ø-°Ò7Ø&Ð'7Ó8¸AÑ=Ó8Ø& |Ó4¸Ñ9Ô4Ø/°6Ò9Ø&Ð'7Ó8¸AÑ=Ó8Ø&Ð';Ó<ÀÑAÔ<Ø/°4Ò7Ø&Ð'7Ó8¸AÑ=Ó8Ø&Ð'9Ó:¸aÑ?Ô:Ø/°9Ò<Ø&Ð'=Ó>À!ÑCÔ>à7¨-Ó7 5á% g¨sÓ3‘Eà!Ð-Ø-°Ò7Ø&Ð'7Ó8¸AÑ=Ó8Ø& |Ó4¸Ñ9Ô4Ø/°6Ò9Ø&Ð'7Ó8¸AÑ=Ó8Ø&Ð';Ó<ÀÑAÔ<Ø/°4Ò7Ø&Ð'7Ó8¸AÑ=Ó8Ø&Ð'9Ó:¸aÑ?Ô:Ø/°9Ò<à&Ð'7Ó8¸AÑ=Ó8Ø&Ð'=Ó>À!ÑCÔ>à7¨-Ó7 5Ü!ŸN™NØŸ ™  gÓ.°· ± ¸cÓ0Bó�Eð— ‘ ˜CÔ à"ÐØˆÙ ð Ø$Ÿ~™~¨cÓ2� ô ,7×+KÑ+KØØ%5Ø)Øô ,Ñ(�˜.ñ Ü&1×&DÑ&DÀXÓ&NÐ#á '‘˜” ¨QˆØˆÙ à Ô.Ñ .ˆNà˜N¨1Ñ-°ÀÑ1BÐ0BÑBÑBˆEáØÙ˜“<Ù˜“<Ù˜7“^ØØ-ØØØ(Ø)ô  ò ðŠñ_ùò5(ùâ'øôF×.Ñ.ò+Ø!Ð-Ø-3Ð*Ø"Ð#?Ó@ÀAÑEÓ@Ø Ÿ{™{–Hûð +ûôD×*Ñ*ò à’ð üsm†.V(´UÁ V(ÁU ÁIV(Ê1UËG*V(Ò-V Ò>BV(ÕV Õ"VÕ?V(ÖV Ö V(Ö V%Ö"V(Ö$V%Ö%V(cóî—tjd«}t|«|kry||«}t|«|z }|d|tj||«k7ryd}t|«}||k\xr ||||z|k(S)aRDetermine if a delta represents censored revision data. ``baserev`` is the base revision this delta is encoded against. ``baselenfn`` is a callable receiving a revision number that resolves the length of the revision fulltext. Returns a bool indicating if the result of the delta represents a censored revision. s>lllFNs  censored:)ÚstructÚcalcsizerXr Úreplacediffheader)rŠr¯Ú baselenfnÚhlenÚoldlenÚnewlenrbÚaddlens rÚdeltaiscensoredr¾ms…€ô �?‰?˜7Ó #€DÜ ˆ5ƒz�TÒØá �wÓ €FÜ �‹Z˜$Ñ €FØ ˆUˆd€|”u×.Ñ.¨v°vÓ>Ò>Øà €CÜ �‹X€FØ �VÑ Ò B  d¨T°F©]Ð ;¸sÑ BÐBr)rN)&Úrer¶Úi18nrrArrrÚrr r Ú interfacesr Ú revlogutilsr r—Úutilsr rrrršrÚcompiler!r+r5r7r<rBrKrRr_rsÚCG_DELTAMODE_STDr´r¾r.rrÚrÇsÉðó Û å÷ñ÷ ñõ $Ý1Ýà ˆH�M‰MÐ+×2Ñ2Ó 3€ ðÐòð4ˆb�j‰j˜Ó#€ òò$2ò(ò òò6"óJ $ò 5Fòp1"ðrØØØØ Ø×)Ñ)ØØ#ØØóDóN Cr