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: //usr/lib64/python2.7/site-packages/mercurial/utils/storageutil.pyc
�
1�3\c
@@s1ddlmZddlZddlZddlZddlmZddlmZm	Z	m
Z
ddlmZm
Z
mZmZeje	�Zd�Zejd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zddd�Zd�Zd�Zdddddeeeed�	Z d�Z!dS(i(tabsolute_importNi(t_(tbintnullidtnullrev(tdagopterrortmdifftpycompatcC@s�|tkr(tj�}|j|�nC||krC|}|}n|}|}tj|�}|j|�|j|�|j�S(s�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.
    (Rt	_nullhashtcopytupdatethashlibtsha1tdigest(ttexttp1tp2tstatb((sA/usr/lib64/python2.7/site-packages/mercurial/utils/storageutil.pythashrevisionsha1s	

s
cC@s�|d dkrdStj|d�j�}|d|!}i}x6|j�D](}|jdd�\}}|||<qLW||dfS(s�Parse metadata header from revision data.

    Returns a 2-tuple of (metadata, offset), where both can be None if there
    is no metadata.
    is
s: iN(NN(tNonetMETADATA_REtsearchtstartt
splitlinestsplit(RRtmtexttmetatltktv((sA/usr/lib64/python2.7/site-packages/mercurial/utils/storageutil.pyt	parsemeta8s
c@s9t��}dj�fd�|D��}d||fS(s2Add metadata to fulltext to produce revision text.tc3@s#|]}d|�|fVqdS(s%s: %s
N((t.0R(R(sA/usr/lib64/python2.7/site-packages/mercurial/utils/storageutil.pys	<genexpr>Lss
%s
%s(tsortedtjoin(RRtkeystmetatext((RsA/usr/lib64/python2.7/site-packages/mercurial/utils/storageutil.pytpackmetaIscC@s t|�d}|od|kS(Nitcensored(R!(RR((sA/usr/lib64/python2.7/site-packages/mercurial/utils/storageutil.pytiscensoredtextOscC@s1|jd�s|S|jdd�}||dS(s�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.
    s
i(t
startswithtindex(Rtoffset((sA/usr/lib64/python2.7/site-packages/mercurial/utils/storageutil.pytfiltermetadataSscC@sp|j|�dtkrtSt|j|��d}|rld|krld|krl|dt|d�fStS(s�Resolve file revision copy metadata.

    Returns ``False`` if the file has no copy metadata. Otherwise a
    2-tuple of the source filename and node.
    iR
tcopyrev(tparentsRtFalseR!trevisionR(tstoretnodeR((sA/usr/lib64/python2.7/site-packages/mercurial/utils/storageutil.pytfilerevisioncopied_scC@s�|jd�rd|}n|}|j|�\}}t|||�}||krYtS|j|j|��r{|dkS|j|�r�|j|�|kStS(shDetermines 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.
    s
s

R"(	R+R0RtTruet
iscensoredtrevtrenamedtreadR1(R3R4tfiledatatrevisiontextRRtcomputednode((sA/usr/lib64/python2.7/site-packages/mercurial/utils/storageutil.pytfiledataequivalentrs


cC@sbd}|dk	rI||kr'd}n||7}||krO|}qOn|}tj|||�S(s)Iterate over revision numbers in a store.ii����N(RRtxrange(tstorelenRtstoptstep((sA/usr/lib64/python2.7/site-packages/mercurial/utils/storageutil.pytiterrevs�s	
cC@snt|t�rVy|j|�SWqVtk
rRtjd||td���qVXnt|�dkr�y|j|�|SWq�tjk
r�q�Xnt|�dkr�y!t	|�}|j|�|SWq�t
k
r�q�XnyTt|�}d||kr	t�ny|j|�SWntt
fk
r3nXWnttfk
rNnXtj||td���dS(s�Resolve the file node for a value.

    ``store`` is an object implementing the ``ifileindex`` interface.

    ``fileid`` can be:

    * A 20 byte binary node.
    * An integer revision number
    * A 40 byte hex node.
    * 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 foundii(N(
t
isinstancetintR4t
IndexErrorRtLookupErrorRtlenR8Rt	TypeErrort
ValueErrort
OverflowError(R3tfileidt
identifiertrawnodeR8((sA/usr/lib64/python2.7/site-packages/mercurial/utils/storageutil.pytfileidlookup�s<



	cC@st�}|d}i}t�}x@|D]8}	||	�}
|
||	<|
|kr)|j|
�q)q)Wx�|r|d8}|j|�}||kr�|j|�n
|j|�xU||�D]G}|tkr�||�}
|
||<|
|kr|j|
�qq�q�WqhW||fS(s�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.
    i(tsettaddtpoptremoveR(t
minlinkrevttiprevtheadrevst	linkrevfntparentrevsfnt
brokenrevst
strippointtheadstfuturelargelinkrevstheadtheadlinkrevtlinkrevtptplinkrev((sA/usr/lib64/python2.7/site-packages/mercurial/utils/storageutil.pytresolvestripinfo�s,	
	

	


c
#@s�|j}
|j�|dkr@g|D]}�|�^q%}n\|dkr�t�fd�|D��}tj||j�}nt�fd�|D��}d}|s�|r�|j|d�d}nt�}x�|D]�}|tkr�q�n|
|�}|j|�\}}|r&||�}nt}|r;|}n�|	rJt}n{|tkr�||krk|}q�|r�|||fkr�|}q�|dk	r�|}q�t}n|dk	r�|}nt}|tkr�|r�|||�r�t}nd}d}d}|
r3|j	|�s&|j	|�r�y|j
|dt�}Wntj
k
r`}|j}nX|tkr0|r�||�}q�t|j
|dt��}q0q3|tkr�|r�|j
|dt�}|j|�q3|r�|||�}n0tj|j
|dt�|j
|dt��}|j|�n|d|d|
|�d	|
|�d
|
|�d|ru||�ndd|d
|d|�V|}q�WdS(s
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.revision(rev, raw=True)``.

       If not defined, ``len(store.revision(rev, raw=True))`` 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.

    ``sendfulltext``
       Whether to send fulltext revisions instead of deltas, if allowed.

    ``nodesorder``
    ``revisiondata``
    ``assumehaveparentrevisions``
    ``deltaprevious``
       See ``ifiledata.emitrevisions()`` interface documentation.
    tnodestlinearc3@s|]}�|�VqdS(N((R#tn(tfrev(sA/usr/lib64/python2.7/site-packages/mercurial/utils/storageutil.pys	<genexpr>Usc3@s|]}�|�VqdS(N((R#Re(Rf(sA/usr/lib64/python2.7/site-packages/mercurial/utils/storageutil.pys	<genexpr>XsitrawR4tp1nodetp2nodetbasenodetflagstbaserevisionsizeR2tdeltaN(R4R8RPRt	linearizet
parentrevsR$RRR7R2R6RtCensoredNodeErrort	tombstoneRHRQRttextdiff(R3Rct
nodesordert	resultclst
deltaparentfnt
candeltafnt	rawsizefnt	revdifffntflagsfntsendfulltexttrevisiondatatassumehaveparentrevisionst
deltaprevioustfnodeRetrevstprevrevt	availableR8R4tp1revtp2revtdeltaparentrevtbaserevR2RmRlte((RfsA/usr/lib64/python2.7/site-packages/mercurial/utils/storageutil.pyt
emitrevisionss�A		"	
							"	
cC@s�tjd�}t|�|kr%tS||�}t|�|}|| tj||�kratSd}t|�}||ko�||||!|kS(sRDetermine 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>llls
censored:(tstructtcalcsizeRHR1Rtreplacediffheader(RmR�t	baselenfnthlentoldlentnewlenRQtaddlen((sA/usr/lib64/python2.7/site-packages/mercurial/utils/storageutil.pytdeltaiscensored�s("t
__future__RRtreR�ti18nRR4RRRR"RRRRR
R	RtcompileRR!R(R*R.R5R>RRCRORbR1R�R�(((sA/usr/lib64/python2.7/site-packages/mercurial/utils/storageutil.pyt<module>s0"							$	6	3�