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__/narrowspec.cpython-310.pyc
o

�]LbK.�@sddlmZddlmZddlmZddlmZmZ	m
Z
mZm
Z
mZmZmZdZdZdZd	d
�Zdd�Zd
d�Zd8dd�Zdd�Zdd�Zdd�Zd9dd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Z d'd(�Z!d)d*�Z"d+d,�Z#d-d.�Z$d/d0�Z%d1d2�Z&d3d4�Z'd:d6d7�Z(dS);�)�absolute_import�)�_)�getattr)�error�match�merge�
mergestate�requirements�scmutil�sparse�utils
narrowspecsnarrowspec.dirstate)spath:srootfilesin:cCs|�d�}t|�||fS)z�Returns the normalized version of a pattern and kind.

    Returns a tuple with the normalized kind and normalized pattern.
    �/)�rstrip�_validatepattern)�kind�pat�r�6/usr/lib/python3/dist-packages/mercurial/narrowspec.py�normalizesplitpattern(s
rcCst|d���S)z?Returns the number of lines in s, including ending empty lines.�x)�len�
splitlines)�srrr�	_numlines2srcCsFt|�dkr
t�td���|�d�}d|vsd|vr!t�td���dS)z�Validates the pattern and aborts if it is invalid.

    Patterns are stored in the narrowspec as newline-separated
    POSIX-style bytestring paths. There's no escaping.
    rs,newlines are not allowed in narrowspec pathsr�.s..s0"." and ".." are not allowed in narrowspec pathsN)rr�Abortr�split)r�
componentsrrrr:s	
��r�pathcCst�||�\}}dt||�S)zyReturns the normalized version of a text-format pattern.

    If the pattern has no kind, the default will be added.
    s%s:%s)�matchmod�	_patsplitr)�pattern�defaultkindrrrrr�normalizepatternMsr$cCsdd�|D�}t|�|S)a�Parses an iterable of patterns into a typed pattern set.

    Patterns are assumed to be ``path:`` if no prefix is present.
    For safety and performance reasons, only some prefixes are allowed.
    See ``validatepatterns()``.

    This function should be used on patterns that come from the user to
    normalize and validate them to the internal data structure used for
    representing patterns.
    cSsh|]}t|��qSr)r$)�.0�origrrr�	<setcomp>asz parsepatterns.<locals>.<setcomp>)�validatepatterns)�pats�resrrr�
parsepatternsVsr+cCs�t�dt|���1t|t�st�d|��|D]}|�t�s0tj	t
d�|t
d�d�t�d��qWd�dS1s<wYdS)a�Validate that patterns are in the expected data structure and format.

    And that is a set of normalized patterns beginning with ``path:`` or
    ``rootfilesin:``.

    This function should be used to validate internal data structures
    and patterns that are loaded from sources that use the internal,
    prefixed pattern representation (but can't necessarily be fully trusted).
    z)narrowspec.validatepatterns(pats size=%d)s'narrow patterns should be a set; got %rs$invalid prefix on narrow pattern: %ss8narrow patterns must begin with one of the following: %ss, ��hintN)r
�timedcmr�
isinstance�setr�ProgrammingError�
startswith�VALID_PREFIXESrr�join)r)rrrrr(fs$

�

�����"�r(cCsHd}t||�D]}||d7}q|d7}t|�D]}||d7}q|S)Ns
[include]
�
s
[exclude]
)�sorted)�includes�excludes�output�i�errr�format�sr<NcCs(|st��Stj|dg|pg|pgd�S)N���include�exclude)r �neverr)�rootr?r@rrrr�s
�rcCs>t�||d�\}}}|rt�td���t|�t|�||fS)NsnarrowsJincluding other spec files using '%include' is not supported in narrowspec)r�parseconfigrrrr()�ui�spec�includepats�excludepats�profilesrrrrC�s��rCcCs|j�t�}t|j|�S�N)�svfs�tryread�FILENAMErCrD��reporErrr�load�srOcCs,t|�t|�t||�}|j�t|�dSrI)r(r<rJ�writerL)rNrFrGrErrr�save�s
rQcCs|j�t�}|j�t|�dSrI)rJ�readrL�vfsrP�DIRSTATE_FILENAMErMrrr�copytoworkingcopy�srUcCs@tj|jvrdS|j}|�|�tj|�t�|�|�dd�dS�NT)�hardlink)r
�NARROW_REQUIREMENTrJ�	tryunlinkr
�copyfiler4rL)rN�
backupnamerJrrr�
savebackup�s

 r\cCs0tj|jvrdSt�|j�|�|j�t��dSrI)r
rXr
�renamerJr4rL�rNr[rrr�
restorebackup�s r_cCsNtj|jvrdS|j}|�|�|�t�r%tj|�t�|�|�dd�dSdSrV)	r
rXrSrY�existsrTr
rZr4)rNr[rSrrr�savewcbackup�s


��racCs@tj|jvrdS|j�|�rt�|j�|�|j�t��dSdSrI)r
rXrSr`r
r]r4rTr^rrr�restorewcbackup�s
 �rbcCs tj|jvrdS|j�|�dSrI)r
rXrSrYr^rrr�
clearwcbackup�srcc
Cs�t|�}|�|�g}|st|�}nNd|vr\g}|D]2}t�t�|��}||vr.|�|�qd}|D]}	|�|	d�rDd}|�|�nq2|sL|�|�qt|�dkrWdh}n	t|�}nt|�}|||fS)aVRestricts the patterns according to repo settings,
    results in a logical AND operation

    :param req_includes: requested includes
    :param req_excludes: requested excludes
    :param repo_includes: repo includes
    :param repo_excludes: repo excludes
    :return: include patterns, exclude patterns, and invalid include patterns.
    spath:.FrTr)r0�updater
�
expandpath�normpath�appendr2r)
�req_includes�req_excludes�
repo_includes�
repo_excludes�res_excludes�invalid_includes�res_includes�req_include�valid�repo_includerrr�restrictpatterns�s6




�
�

rrcCs|D]}|j�|�qdSrI)�wvfs�
unlinkpath)rN�files�frrr�_deletecleanfiless�rwcCsht��}|d��}|D]}|j�|�s"|�|tj|�|�dfd�qtj	|||d|dddd�dS)NrFsnarrowspec updated)�wctx�mctx�	overwrite�wantfiledata)
r�mergeresult�manifestrsr`�addfile�
mergestatemod�
ACTION_GET�flags�applyupdates)rN�pctxru�mresult�mfrvrrr�_writeaddedfiless&��
�r�cCsJt|dd�rdS|j�t�}|j�t�}||kr#tjtd�td�d��dS)N�_updatingnarrowspecFs"working copy's narrowspec is stales&run 'hg tracked --update-working-copy'r,)	rrJrKrLrSrTr�
StateErrorr)rN�	storespec�wcspecrrr�checkworkingcopynarrowspec(s��r�Fcs�|j�t�}|j�t�}d|_t|j|�\}}t|j|�\}}t|j	||d�}t|j	||d�}	t
�|	|�}
t
�||	�}|j��j
|gdddd�\}}
}|
j|
j}|
j}|r\|�|�n|�|�t||�t�|�}t|�D]}|j�
td�||��qot|
j�D]}|j�
td�||��q�t|
j�D]}|j�
td�||��q�||D]
}�j|ddd�q�|d	}t
�|
t�|��}
�fd
d�|���|
�D�}|D]}�j|dddd�q�t|||�d|_d
S)z�updates the working copy and dirstate from the store narrowspec

    When assumeclean=True, files that are not known to be clean will also
    be deleted. It is then up to the caller to make sure they are clean.
    Tr>)�subrepos�ignored�clean�unknowns$not deleting possibly dirty file %s
snot deleting unknown file %s
snot deleting ignored file %s
F)�
p1_tracked�
wc_trackedrcsg|]}|�vr|�qSrr)r%rv��dsrr�
<listcomp>asz%updateworkingcopy.<locals>.<listcomp>)r�r��possibly_dirtyN) rSrKrTrJrLr�rCrDrrBr �differencematcher�dirstate�status�modified�addedr��extendrwr�getuipathfnr6rr�r��update_file�intersectmatchersr�matcherr}�walkr�)rN�assumeclean�oldspec�newspec�oldincludes�oldexcludes�newincludes�newexcludes�oldmatch�newmatch�
addedmatch�removedmatch�lookupr��_mtime_boundary�trackeddirtyr��uipathfnrvr��newfilesrr�r�updateworkingcopy5sJ
�


�
r�)r)NN)F))�
__future__r�i18nr�pycompatr�rrr rr	rr
rrr
rLrTr3rrrr$r+r(r<rCrOrQrUr\r_rarbrcrrrwr�r�r�rrrr�<module>s:(

	

)

https://t.me/RX1948 - 2025