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: //proc/self/root/usr/lib64/python2.7/site-packages/mercurial/narrowspec.pyo
�
1�3\c@@s�ddlmZddlZddlmZddlmZmZm	Z	m
Z
mZdZdZ
d	�Zd
�Zd�Zdd
�Zd�Zd�Zd�Zddd�Zd�Zd�Zd�Zd�Zd�Zd�ZdS(i(tabsolute_importNi(t_(terrortmatcht
repositorytsparsetutilt
narrowspecspath:srootfilesin:cC@s#|jd�}t|�||fS(s�Returns the normalized version of a pattern and kind.

    Returns a tuple with the normalized kind and normalized pattern.
    t/(trstript_validatepattern(tkindtpat((s:/usr/lib64/python2.7/site-packages/mercurial/narrowspec.pytnormalizesplitpattern"s
cC@st|dj��S(s?Returns the number of lines in s, including ending empty lines.tx(tlent
splitlines(ts((s:/usr/lib64/python2.7/site-packages/mercurial/narrowspec.pyt	_numlines+scC@smt|�dkr*tjtd���n|jd�}d|ksQd|kritjtd���ndS(s�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.
    is,newlines are not allowed in narrowspec pathsRt.s..s0"." and ".." are not allowed in narrowspec pathsN(RRtAbortRtsplit(Rt
components((s:/usr/lib64/python2.7/site-packages/mercurial/narrowspec.pyR
2s
	tpathcC@s)tj||�\}}dt||�S(syReturns the normalized version of a text-format pattern.

    If the pattern has no kind, the default will be added.
    s%s:%s(tmatchmodt	_patsplitR
(tpatterntdefaultkindRR((s:/usr/lib64/python2.7/site-packages/mercurial/narrowspec.pytnormalizepatternBscC@sd�|D�}t|�|S(s�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.
    cS@sh|]}t|��qS((R(t.0torig((s:/usr/lib64/python2.7/site-packages/mercurial/narrowspec.pys	<setcomp>Us	(tvalidatepatterns(tpatstres((s:/usr/lib64/python2.7/site-packages/mercurial/narrowspec.pyt
parsepatternsJs
cC@s~t|t�s%tjd|��nxR|D]J}|jt�s,tjtd�|dtd�djt���q,q,WdS(s�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).
    s'narrow patterns should be a set; got %rs$invalid prefix on narrow pattern: %sthints8narrow patterns must begin with one of the following: %ss, N(	t
isinstancetsetRtProgrammingErrort
startswithtVALID_PREFIXESRRtjoin(R R((s:/usr/lib64/python2.7/site-packages/mercurial/narrowspec.pyRYs
	

	cC@sbd}x&t||�D]}||d7}qW|d7}x"t|�D]}||d7}qFW|S(Ns
[include]
s
s
[exclude]
(tsorted(tincludestexcludestoutputtite((s:/usr/lib64/python2.7/site-packages/mercurial/narrowspec.pytformatps
cC@sA|stj|d�Stj|dgd|p1gd|p=g�S(Nttincludetexclude(RtneverR(trootR2R3((s:/usr/lib64/python2.7/site-packages/mercurial/narrowspec.pyRyscC@s�y|jjt�}Wn8tk
rP}|jtjkrJt�t�fS�nXtj|j	|d�\}}}|r�t
jtd���nt
|�t
|�||fS(NtnarrowsJincluding other spec files using '%include' is not supported in narrowspec(tsvfstreadtFILENAMEtIOErrorterrnotENOENTR%RtparseconfigtuiRRRR(trepotspecR/tincludepatstexcludepatstprofiles((s:/usr/lib64/python2.7/site-packages/mercurial/narrowspec.pytload�s

cC@s:t|�t|�t||�}|jjt|�dS(N(RR0R7twriteR9(R?RARBR@((s:/usr/lib64/python2.7/site-packages/mercurial/narrowspec.pytsave�s

cC@s[tj|jkrdS|j}|j|�tj|jjt	�|j|�dt
�dS(Nthardlink(RtNARROW_REQUIREMENTtrequirementstvfst	tryunlinkRtcopyfileR7R)R9tTrue(R?t
backupnameRJ((s:/usr/lib64/python2.7/site-packages/mercurial/narrowspec.pyt
savebackup�s
	
cC@sBtj|jkrdStj|jj|�|jjt��dS(N(	RRHRIRtrenameRJR)R7R9(R?RN((s:/usr/lib64/python2.7/site-packages/mercurial/narrowspec.pyt
restorebackup�scC@s*tj|jkrdS|jj|�dS(N(RRHRIRJtunlink(R?RN((s:/usr/lib64/python2.7/site-packages/mercurial/narrowspec.pytclearbackup�sc
C@s+t|�}|j|�g}|s4t|�}n�d|krg}x�|D]�}tjtj|��}||kr�|j|�qMnt}x8|D]0}	|j|	d�r�t}|j|�Pq�q�W|sM|j|�qMqMWt	|�dkrdh}qt|�}nt|�}|||fS(s� Restricts 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.

    >>> restrictpatterns({'f1','f2'}, {}, ['f1'], [])
    (set(['f1']), {}, [])
    >>> restrictpatterns({'f1'}, {}, ['f1','f2'], [])
    (set(['f1']), {}, [])
    >>> restrictpatterns({'f1/fc1', 'f3/fc3'}, {}, ['f1','f2'], [])
    (set(['f1/fc1']), {}, [])
    >>> restrictpatterns({'f1_fc1'}, {}, ['f1','f2'], [])
    ([], set(['path:.']), [])
    >>> restrictpatterns({'f1/../f2/fc2'}, {}, ['f1','f2'], [])
    (set(['f2/fc2']), {}, [])
    >>> restrictpatterns({'f1/../f3/fc3'}, {}, ['f1','f2'], [])
    ([], set(['path:.']), [])
    >>> restrictpatterns({'f1/$non_exitent_var'}, {}, ['f1','f2'], [])
    (set(['f1/$non_exitent_var']), {}, [])
    spath:.Ri(
R%tupdateRt
expandpathtnormpathtappendtFalseR'RMR(
treq_includestreq_excludest
repo_includest
repo_excludestres_excludestinvalid_includestres_includestreq_includetvalidtrepo_include((s:/usr/lib64/python2.7/site-packages/mercurial/narrowspec.pytrestrictpatterns�s2




(spath:srootfilesin:(t
__future__RR;ti18nRR1RRRRRRR9R(R
RR
RR"RR0tNoneRDRFRORQRSRc(((s:/usr/lib64/python2.7/site-packages/mercurial/narrowspec.pyt<module>s((