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/lib64/python2.7/site-packages/mercurial/match.pyc
�
1�3\c@@s�ddlmZmZddlZddlZddlZddlZddlmZddl	m
Z
mZmZm
Z
mZddlmZdEZdFZejZd�Zd�Zd�Zd�Zdedd�Zddddeddedded�Zdd�Zd�Zd�Zd�Zd�Z de!fd��YZ"d e"fd!��YZ#d"e"fd#��YZ$d$e"fd%��YZ%d&e"fd'��YZ&d(e!fd)��YZ'd*e"fd+��YZ(d,e"fd-��YZ)d.e"fd/��YZ*d0�Z+d1e"fd2��YZ,d3e"fd4��YZ-d5e"fd6��YZ.d7e"fd8��YZ/dd9�Z0d:�Z1d;�Z2d<�Z3d=�Z4d>�Z5d?�Z6d@�Z7dA�Z8dB�Z9dC�Z:da;edD�Z<dS(Gi(tabsolute_importtprint_functionNi(t_(tencodingterrortpathutiltpycompattutil(t
stringutiltretglobtpathtrelglobtrelpathtrelretlistfilet	listfile0tsettincludet
subincludetrootfilesincC@s9tjj|�}y|jSWntk
r4|jSXdS(sZcompile the regexp with the best available regexp engine and return a
    matcher functionN(RR	tcompilet
test_matchtAttributeErrortmatch(tregextm((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyt
_rematcher"s

c	C@s�g}g}x�|D]�\}}	}
|dkr�|dkrLtjd��n|j|j|	d|��|rxZ|jD]L}|j|�j|	d|�}t||||d|�}
|j|
�qxWqqn|j||	|
f�qW||fS(sFReturns the kindpats list with the 'set' patterns expanded to matchersRs"fileset expression with no contexttbadfnN(tNoneRtProgrammingErrortappendtmatchfilesettsubstatetsubtprefixdirmatcher(troottcwdtkindpatstctxtlistsubreposRtmatcherstothertkindtpattsourcetsubpathtsmtpm((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyt_expandsets,scC@s�g}g}x�|D]�\}}}|dkr�tjtj|��}tj|�}tj||�}tj|�}	|	dgd|gf}
tj|||	�}|r�|d7}n|j||
f�q|j|||f�qW||fS(s_Returns the list of subinclude matcher args and the kindpats without the
    subincludes in it.Rts
include:%st/(RtdirnameRtnormpathtpconverttjoint	canonpathR(R&R$trelmatchersR*R+R,R-t
sourcerootRtnewroottmatcherargstprefix((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyt_expandsubincludeBs
cC@s:x3|D]+\}}}|dks.|dkrtSqWtS(sR"Checks whether the kindspats match everything, as e.g.
    'relpath:.' does.
    R2R
R
(R
R
(tFalsetTrue(R&R+R,R-((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyt_kindpatsalwaysmatchZsc

C@s�g}t|||d|d|d|�\}}|rd||||d|d|�}	|j|	�n|rz|j|�n|s�t||d|�St|�dkr�|dSt|�S(NR'R(Rii(R1Rtextendtnevermatchertlentunionmatcher(
t
matcherclsR$R%R&R'R(RR)tfmsR((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyt_buildkindpatsmatchercs	c
@s�t}
|rQ|r$tjd��n|j�j��j���fd�}
n|rot||||�}n�|r�|
||||||
�}t|�r�t|||dt	�}q�t
t|||d|d|	d|�}nt|||�}|rM|
|d||||
�}t
t|||d|d|	dd�}t||�}n|r�|
|d||||
�}t
t|||d|d|	dd�}t||�}n|S(	sHbuild an object to match a set of file patterns

    arguments:
    root - the canonical root of the tree you're matching against
    cwd - the current working directory, if relevant
    patterns - patterns to find
    include - patterns to include (unless they are excluded)
    exclude - patterns to exclude (even if they are included)
    default - if a pattern in patterns has no explicit type, assume this one
    exact - patterns are actually filenames (include/exclude still apply)
    warn - optional function used for printing warnings
    badfn - optional bad() callback for this matcher instead of the default
    icasefs - make a matcher for wdir on case insensitive filesystems, which
        normalizes the given patterns to the case in the filesystem

    a pattern is one of:
    'glob:<glob>' - a glob relative to cwd
    're:<regexp>' - a regular expression
    'path:<path>' - a path relative to repository root, which is matched
                    recursively
    'rootfilesin:<path>' - a path relative to repository root, which is
                    matched non-recursively (will not match subdirectories)
    'relglob:<glob>' - an unrooted glob (*.c matches C files in all dirs)
    'relpath:<path>' - a path relative to cwd
    'relre:<regexp>' - a regexp that needn't match the start of a name
    'set:<fileset>' - a fileset expression
    'include:<path>' - a file of patterns to read and include
    'subinclude:<path>' - a file of patterns to match against files under
                          the same directory
    '<something>' - a pattern of the specified default type
    s3a case-insensitive exact matcher doesn't make sensec@s�t||||||�}g}x|D]w\}}	}
|dkr�|	}�|	�}	||	kr�|�kr�|j|||
f�q�n|j||	|
f�q(W|S(NR	R(R	R(t_donormalizeR(tpatternstdefaultR$R%tauditortwarntkpR&R+tpatsR-tp(tdirstatetdsnormalize(s5/usr/lib64/python2.7/site-packages/mercurial/match.pyt	normalize�strelativeuipathR'R(RR
N(RIRRtrepoRQRStexactmatcherRAt
alwaysmatcherR@RHtpatternmatchertincludematcherRtintersectmatcherstdifferencematcher(R$R%RJRtexcludeRKtexactRLR'R(RMRticasefsRSRR&timtem((RQRRs5/usr/lib64/python2.7/site-packages/mercurial/match.pyRts8"	cC@st|||d|�S(NR(RV(R$R%tfilesR((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR]�scC@s
t||�S(N(RW(R$R%((s5/usr/lib64/python2.7/site-packages/mercurial/match.pytalways�scC@s
t||�S(N(RC(R$R%((s5/usr/lib64/python2.7/site-packages/mercurial/match.pytnever�scC@stj|�}||_|S(sWMake a copy of the given matcher, replacing its bad method with the given
    one.
    (tcopytbad(RRR((s5/usr/lib64/python2.7/site-packages/mercurial/match.pytbadmatch�s	cC@s}g}xpg|D]}t||�^qD]L\}}	|tkr\tj|||	|�}	n|d
krztj|	�}	n�|dkrZy\tj|	�}
|dkr�|
jd�}
n|
j�}
g|
D]}|r�|^q�}
Wn*t	k
rt
jtd�|	��nXxBt
|
|||||�D]%\}}}
|j|||	f�q+Wq)n|dkr_y|tjj|tj|	��}t||�}xHt
||||||�D]+\}}}
|j|||
p�|	f�q�WWq)t
jk
r}t
jd	|	|d
f��q)tk
rX}|rY|td�|	tj|j�f�qYq)Xq)n|j||	df�q)W|S(s�Convert 'kind:pat' from the patterns list to tuples with kind and
    normalized and rooted patterns and with listfiles expanded.RRRRRssunable to read file list (%s)Rs%s: %sis*skipping unreadable pattern file '%s': %s
R2(RRR(RR(t	_patsplittcwdrelativepatternkindsRR8RR5treadfiletsplitt
splitlinestEnvironmentErrorRtAbortRRIRtosRR7t	localpathtreadpatternfiletIOErrorRtforcebytestrtstrerror(RJRKR$R%RLRMR&RPR+R,RatftkR-tfullpathtincludepatstinst((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyRI�sF/#
$ !tbasematchercB@s�eZded�Zd�Zd�Zd�ZdZdZ	d�Z
d�Zd�Ze
d��Zd�Ze
d	��Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�ZRS(cC@s7||_||_|dk	r*||_n||_dS(N(t_roott_cwdRRet_relativeuipath(tselfR$R%RRT((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyt__init__s
		cC@s
|j|�S(N(tmatchfn(R}tfn((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyt__call__scc@sx|jD]}|Vq
WdS(N(t_files(R}Rt((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyt__iter__
scC@sdS(soCallback from dirstate.walk for each explicit file that can't be
        found/accessed, with an error message.N((R}Rttmsg((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyReR2cC@s|S(sUConvert a repo path back to path that is relative to the root of the
        matcher.((R}Rt((s5/usr/lib64/python2.7/site-packages/mercurial/match.pytabsscC@stj|j|j|�S(sBConvert repo path back to path that is relative to cwd of matcher.(RtpathtoRzR{(R}Rt((s5/usr/lib64/python2.7/site-packages/mercurial/match.pytrel#scC@s%|jr|j|�p$|j|�S(s�Convert repo path to a display path.  If patterns or -I/-X were used
        to create this matcher, the display path will be relative to cwd.
        Otherwise it is relative to the root of the repo.(R|R�R�(R}Rt((s5/usr/lib64/python2.7/site-packages/mercurial/match.pytuipath'scC@sgS(N((R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�-scC@s|jS(s�Explicitly listed files or patterns or roots:
        if no patterns or .always(): empty list,
        if exact: list exact files,
        if not .anypats(): list all files and dirs,
        else: optimal roots(R�(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyRa1scC@s
t|j�S(N(RR�(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyt_fileset9scC@s
||jkS(s!Returns True if f is in .files().(R�(R}Rt((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR]=scC@stS(N(R?(R}Rt((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyRAscC@stS(s�Decides whether a directory should be visited based on whether it
        has potential matches in it or one of its subdirectories. This is
        based on the match's primary, included, and excluded patterns.

        Returns the string 'all' if the given directory and all subdirectories
        should be visited. Otherwise returns True or False indicating whether
        the given directory should be visited.
        (R@(R}tdir((s5/usr/lib64/python2.7/site-packages/mercurial/match.pytvisitdirDs	cC@sdS(s^Decides whether a directory should be visited based on whether it
        has potential matches in it or one of its subdirectories, and
        potentially lists which subdirectories of that directory should be
        visited. This is based on the match's primary, included, and excluded
        patterns.

        This function is very similar to 'visitdir', and the following mapping
        can be applied:

             visitdir | visitchildrenlist
            ----------+-------------------
             False    | set()
             'all'    | 'all'
             True     | 'this' OR non-empty set of subdirs -or files- to visit

        Example:
          Assume matchers ['path:foo/bar', 'rootfilesin:qux'], we would return
          the following values (assuming the implementation of visitchildrenset
          is capable of recognizing this; some implementations are not).

          '.' -> {'foo', 'qux'}
          'baz' -> set()
          'foo' -> {'bar'}
          # Ideally this would be 'all', but since the prefix nature of matchers
          # is applied to the entire matcher, we have to downgrade this to
          # 'this' due to the non-prefix 'rootfilesin'-kind matcher being mixed
          # in.
          'foo/bar' -> 'this'
          'qux' -> 'this'

        Important:
          Most matchers do not know if they're representing files or
          directories. They see ['path:dir/f'] and don't know whether 'f' is a
          file or a directory, so visitchildrenset('dir') for most matchers will
          return {'f'}, but if the matcher knows it's a file (like exactmatcher
          does), it may return 'this'. Do not rely on the return being a set
          indicating that there are no files in this dir to investigate (or
          equivalently that if there are files to investigate in 'dir' that it
          will always return 'this').
        tthis((R}R�((s5/usr/lib64/python2.7/site-packages/mercurial/match.pytvisitchildrensetOs)cC@stS(scMatcher will match everything and .files() will be empty --
        optimization might be possible.(R?(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyRbzscC@stS(scMatcher will match exactly the list of files in .files() --
        optimization might be possible.(R?(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pytisexactscC@stS(s_Matcher will match the paths in .files() recursively --
        optimization might be possible.(R?(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR=�scC@s%|j�o$|j�o$|j�S(s`None of .always(), .isexact(), and .prefix() is true --
        optimizations will be difficult.(RbR�R=(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pytanypats�sN(t__name__t
__module__RR@R~R�R�RetexplicitdirttraversedirR�R�R�t
propertycacheR�RaR�R]RR�R�RbR�R=R�(((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyRys(											+			RWcB@sJeZdZded�Zd�Zd�Zd�Zd�Z	d�Z
RS(sMatches everything.cC@s&tt|�j|||d|�dS(NRT(tsuperRWR~(R}R$R%RRT((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR~�scC@stS(N(R@(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyRb�scC@stS(N(R@(R}Rt((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�scC@sdS(Ntall((R}R�((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��scC@sdS(NR�((R}R�((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��scC@sdS(Ns<alwaysmatcher>((R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyt__repr__�sN(R�R�t__doc__RR?R~RbRR�R�R�(((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyRW�s				RCcB@sGeZdZdd�Zd�Zd�Zd�Zd�Zd�Z	RS(sMatches nothing.cC@s tt|�j|||�dS(N(R�RCR~(R}R$R%R((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR~�scC@stS(N(R@(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��scC@stS(N(R@(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR=�scC@stS(N(R?(R}R�((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��scC@st�S(N(R(R}R�((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��scC@sdS(Ns<nevermatcher>((R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��sN(
R�R�R�RR~R�R=R�R�R�(((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyRC�s				tpredicatematchercB@s/eZdZddd�Zejd��ZRS(s/A matcher adapter for a simple boolean functioncC@s2tt|�j|||�||_||_dS(N(R�R�R~Rt	_predrepr(R}R$R%tpredfntpredreprR((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR~�s	cC@s,tj|j�p!tj|j�}d|S(Ns<predicatenmatcher pred=%s>(Rt	buildreprR�RtbytereprR(R}ts((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��sN(R�R�R�RR~Rt	strmethodR�(((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��sRXcB@sSeZedd�Zed��Zd�Zd�Zd�Z	e
jd��ZRS(cC@s_tt|�j|||�t|�|_t|�|_t|d||�\|_|_dS(Nt$(	R�RXR~t_explicitfilesR�t_prefixt_buildmatcht_patsR(R}R$R%R&R(R((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR~�s
cC@sttj|j��dhBS(Nt.(RRtdirsR�(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyt_dirs�sc@sl�jr|�jkrdSd�jkpk|�jkpk|�jkpkt�fd�tj|�D��S(NR�R�c3@s|]}|�jkVqdS(N(R�(t.0t	parentdir(R}(s5/usr/lib64/python2.7/site-packages/mercurial/match.pys	<genexpr>�s(R�R�R�tanyRtfinddirs(R}R�((R}s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��scC@sB|j|�}|tkrdS|s,t�S|dks>t�dS(NR�R�(R�R@RtAssertionError(R}R�tret((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��scC@s|jS(N(R�(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR=�scC@sdtj|j�S(Ns<patternmatcher patterns=%r>(RtbytestrR�(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��sN(
R�R�R?RR~R�R�R�R�R=RR�R�(((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyRX�s					t_dirchildrencB@s5eZdd�Zd�Zed��Zd�ZRS(cC@s@i|_|pg|_|j}x|D]}||�q(WdS(N(R�t_onlyincludetaddpath(R}tpathstonlyincludeR�Rt((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR~�s
		
cC@st|dkrdS|j}tj}xK||�D]=\}}||jkrPq/n|j|t��j|�q/WdS(NR�(R�R�t_findsplitdirsR�t
setdefaultRtadd(R}RR�t
findsplitdirstdtb((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��s		cc@svt|�}|jd�}xE|dkrb|| ||d|!fV|}|jdd|�}qWd|| fVdS(NR3i����iiR�(RDtrfind(Rtoldpostpos((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�scC@s|jj|t��S(N(R�tgetR(R}R((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�sN(R�R�RR~R�tstaticmethodR�R�(((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��s	
RYcB@sJeZedd�Zd�Zed��Zd�Ze	j
d��ZRS(c	C@s�tt|�j|||�t|d||�\|_|_t|�|_t|�\}}}t|�|_	t|�|_
t|�|_dS(Ns(?:/|$)(R�RYR~R�R�RR�t_rootsdirsandparentsRt_rootsR�t_parents(	R}R$R%R&R(RtrootsR�tparents((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR~s	c@s{�jr|�jkrdSd�jkpz|�jkpz|�jkpz|�jkpzt�fd�tj|�D��S(NR�R�c3@s|]}|�jkVqdS(N(R�(R�R�(R}(s5/usr/lib64/python2.7/site-packages/mercurial/match.pys	<genexpr>3s(R�R�R�R�R�RR�(R}R�((R}s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�,scC@s+ttj|j|j|j�d|j�S(NR�(R�t	itertoolstchainR�R�R�(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyt_allparentschildren6sc@s��jr|�jkrdSd�jksn|�jksn|�jksnt�fd�tj|�D��rrdS|�jkr��jj|�p�t	�St	�S(NR�R�c3@s|]}|�jkVqdS(N(R�(R�R�(R}(s5/usr/lib64/python2.7/site-packages/mercurial/match.pys	<genexpr>JsR�(
R�R�R�R�RR�R�R�R�R(R}R�((R}s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�BscC@sdtj|j�S(Ns<includematcher includes=%r>(RR�R�(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�RsN(R�R�R?RR~R�R�R�R�RR�R�(((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyRYs
	
	RVcB@s_eZdZdd�ZejZed��Z	d�Z
d�Zd�Ze
jd��ZRS(slMatches the input files exactly. They are interpreted as paths, not
    patterns (so no kind-prefixes).
    cC@sJtt|�j|||�t|t�r7||_nt|�|_dS(N(R�RVR~t
isinstancetlistR�(R}R$R%RaR((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR~[scC@sttj|j��dhBS(NR�(RRR�R�(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�escC@s
||jkS(N(R�(R}R�((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�isc@s�|js||jkr t�S|j|jdhB}|dkrl|d�t�fd�|D��}nd�|D�}|s�t�|S(NR�R3c3@s.|]$}|j��r|t��VqdS(N(t
startswithRD(R�tc(R�(s5/usr/lib64/python2.7/site-packages/mercurial/match.pys	<genexpr>sscS@s"h|]}d|kr|�qS(R3((R�R�((s5/usr/lib64/python2.7/site-packages/mercurial/match.pys	<setcomp>zs	(R�R�RR�(R}R�t
candidatesR�((R�s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�ls
cC@stS(N(R@(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��scC@sd|jS(Ns<exactmatcher files=%r>(R�(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��sN(R�R�R�RR~RyR]RR�R�R�R�R�RR�R�(((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyRVVs				R[cB@s\eZdZd�Zd�Zed��Zd�Zd�Zd�Z	e
jd��ZRS(s�Composes two matchers by matching if the first matches and the second
    does not.

    The second matcher's non-matching-attributes (root, cwd, bad, explicitdir,
    traversedir) are ignored.
    cC@sYtt|�j|j|j�||_||_|j|_|j|_|j	|_	dS(N(
R�R[R~RzR{t_m1t_m2ReR�R�(R}tm1tm2((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR~�s		cC@s|j|�o|j|�S(N(R�R�(R}Rt((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�scC@sE|j�r8g|jj�D]}||�r|^qS|jj�S(N(R�R�Ra(R}Rt((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��s,cC@s2|jj|�dkrtSt|jj|��S(NR�(R�R�R?tboolR�(R}R�((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��scC@sU|jj|�}|dkr%t�S|jj|�}|sA|S|dkrQdS|S(NR�R�(R�R�(R�R�RR�(R}R�tm2_settm1_set((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��scC@s
|jj�S(N(R�R�(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��scC@sd|j|jfS(Ns <differencematcher m1=%r, m2=%r>(R�R�(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��s(
R�R�R�R~RR�R�R�R�R�RR�R�(((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR[�s					cC@s�|dks|dkr"|p!|S|j�r�tj|�}|j|_|j|_|j|_|j|_|j|_|j|jO_|S|j�r�tj|�}|j|jO_|St	||�S(s�Composes two matchers by matching if both of them match.

    The second matcher's non-matching-attributes (root, cwd, bad, explicitdir,
    traversedir) are ignored.
    N(
RRbRdReR�R�R�R�R|tintersectionmatcher(R�R�R((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyRZ�s 
R�cB@s_eZd�Zed��Zd�Zd�Zd�Zd�Zd�Z	e
jd��ZRS(cC@sYtt|�j|j|j�||_||_|j|_|j|_|j	|_	dS(N(
R�R�R~RzR{R�R�ReR�R�(R}R�R�((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR~�s		cC@s~|j�rd|j|j}}|j�s;||}}ng|j�D]}||�rH|^qHS|jj�|jj�S(N(R�R�R�Ra(R}R�R�Rt((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��s)cC@s|j|�o|j|�S(N(R�R�(R}Rt((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�scC@sJ|jj|�}|dkr.|jj|�St|oF|jj|��S(NR�(R�R�R�R�(R}R�tvisit1((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��scC@s�|jj|�}|st�S|jj|�}|s>t�S|dkrN|S|dkr^|S|dksv|dkrzdSt|t�r�t|t�s�t�|j|�S(NR�R�(R�R�RR�R�R�tintersection(R}R�R�R�((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�s$cC@s|jj�o|jj�S(N(R�RbR�(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyRbscC@s|jj�p|jj�S(N(R�R�R�(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�scC@sd|j|jfS(Ns"<intersectionmatcher m1=%r, m2=%r>(R�R�(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�s(
R�R�R~R�R�RR�R�RbR�RR�R�(((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��s	
					t
subdirmatchercB@szeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Ze
jd��ZRS(s�Adapt a matcher to work on a subdirectory only.

    The paths are remapped to remove/insert the path as needed:

    >>> from . import pycompat
    >>> m1 = match(b'root', b'', [b'a.txt', b'sub/b.txt'])
    >>> m2 = subdirmatcher(b'sub', m1)
    >>> bool(m2(b'a.txt'))
    False
    >>> bool(m2(b'b.txt'))
    True
    >>> bool(m2.matchfn(b'a.txt'))
    False
    >>> bool(m2.matchfn(b'b.txt'))
    True
    >>> m2.files()
    ['b.txt']
    >>> m2.exact(b'b.txt')
    True
    >>> util.pconvert(m2.rel(b'b.txt'))
    'sub/b.txt'
    >>> def bad(f, msg):
    ...     print(pycompat.sysstr(b"%s: %s" % (f, msg)))
    >>> m1.bad = bad
    >>> m2.bad(b'x.txt', b'No such file')
    sub/x.txt: No such file
    >>> m2.abs(b'c.txt')
    'sub/c.txt'
    c@s�tt|�j|j|j��|_||_|j�|_g|j	D]-}|j
�d�rJ|t��d^qJ|_	|j�r�t
�fd�|j	D��|_ndS(NR3ic3@s|]}|�kVqdS(N((R�Rt(R(s5/usr/lib64/python2.7/site-packages/mercurial/match.pys	<genexpr>Js(R�R�R~RzR{t_patht_matcherRbt_alwaysR�R�RDR=R�(R}RtmatcherRt((Rs5/usr/lib64/python2.7/site-packages/mercurial/match.pyR~>s		0cC@s"|jj|jd||�dS(NR3(R�ReR�(R}RtR�((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyReLscC@s|jj|jd|�S(NR3(R�R�R�(R}Rt((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�OscC@s|jj|jd|�S(NR3(R�R�R�(R}Rt((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�RscC@s|jj|jd|�S(NR3(R�R�R�(R}Rt((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�UscC@s|jj|jd|�S(NR3(R�RR�(R}Rt((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyRXscC@s9|dkr|j}n|jd|}|jj|�S(NR�R3(R�R�R�(R}R�((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�_scC@s9|dkr|j}n|jd|}|jj|�S(NR�R3(R�R�R�(R}R�((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�fscC@s|jS(N(R�(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyRbmscC@s|jj�o|jS(N(R�R=R�(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR=pscC@sd|j|jfS(Ns#<subdirmatcher path=%r, matcher=%r>(R�R�(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�ss(R�R�R�R~ReR�R�R�RR�R�RbR=RR�R�(((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�s										R#cB@sweZdZd
d�Zed��Zd�Zed��Zd�Z	d�Z
d�Zd�Ze
jd	��ZRS(s7Adapt a matcher to work on a parent directory.

    The matcher's non-matching-attributes (root, cwd, bad, explicitdir,
    traversedir) are ignored.

    The prefix path should usually be the relative path from the root of
    this matcher to the root of the wrapped matcher.

    >>> m1 = match(util.localpath(b'root/d/e'), b'f', [b'../a.txt', b'b.txt'])
    >>> m2 = prefixdirmatcher(b'root', b'd/e/f', b'd/e', m1)
    >>> bool(m2(b'a.txt'),)
    False
    >>> bool(m2(b'd/e/a.txt'))
    True
    >>> bool(m2(b'd/e/b.txt'))
    False
    >>> m2.files()
    ['d/e/a.txt', 'd/e/f/b.txt']
    >>> m2.exact(b'd/e/a.txt')
    True
    >>> m2.visitdir(b'd')
    True
    >>> m2.visitdir(b'd/e')
    True
    >>> m2.visitdir(b'd/e/f')
    True
    >>> m2.visitdir(b'd/e/g')
    False
    >>> m2.visitdir(b'd/ef')
    False
    cC@sWtt|�j|||�|s4tjd��n||_|d|_||_dS(Nsprefix path must not be emptyR3(R�R#R~RRR�t_pathprefixR�(R}R$R%RR�R((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR~�s	
cC@s$g|jjD]}|j|^q
S(N(R�R�R�(R}Rt((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��scC@s3|j|j�stS|jj|t|j��S(N(R�R�R?R�RRD(R}Rt((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�scC@sttj|j��dhBS(NR�(RRR�R�(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyt	_pathdirs�scC@s[||jkr|jjd�S|j|j�rN|jj|t|j��S||jkS(NR�(R�R�R�R�R�RDR�(R}R�((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��s
cC@sh||jkr|jjd�S|j|j�rN|jj|t|j��S||jkradSt�S(NR�R�(R�R�R�R�R�RDR�R(R}R�((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��scC@s
|jj�S(N(R�R�(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��scC@s
|jj�S(N(R�R=(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR=�scC@sdtj|j�|jfS(Ns&<prefixdirmatcher path=%r, matcher=%r>(RR�R�R�(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��sN(R�R�R�RR~R�R�RR�R�R�R�R=RR�R�(((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR#xs						REcB@sDeZdZd�Zd�Zd�Zd�Zejd��Z	RS(s�A matcher that is the union of several matchers.

    The non-matching-attributes (root, cwd, bad, explicitdir, traversedir) are
    taken from the first matcher.
    cC@sN|d}tt|�j|j|j�|j|_|j|_||_dS(Ni(R�RER~RzR{R�R�t	_matchers(R}R)R�((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR~�s

cC@s(x!|jD]}||�r
tSq
WtS(N(R�R@R?(R}RtR((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�scC@sGt}x:|jD]/}|j|�}|dkr5|S||O}qW|S(NR�(R?R�R�(R}R�trRtv((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��scC@s�t�}t}x~|jD]s}|j|�}|s:qn|dkrJ|S|s\|dkrht}qnt|t�s}t�|j|�}qW|r�dS|S(NR�R�(RR?R�R�R@R�R�tunion(R}R�R�R�RR�((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��s 	cC@sd|jS(Ns<unionmatcher matchers=%r>(R�(R}((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��s(
R�R�R�R~RR�R�RR�R�(((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyRE�s					cC@st||�dS(s8If pattern is 'kind:pat' with a known kind, return kind.i(Rg(tpatternRK((s5/usr/lib64/python2.7/site-packages/mercurial/match.pytpatkind�scC@sGd|kr=|jdd�\}}|tkr=||fSn||fS(sPSplit a string into the optional pattern kind prefix and the actual
    pattern.t:i(Rjtallpatternkinds(R�RKR+R,((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyRgs

c	@s�dt����d}d}tjj}���fd�}x���kr����d!}�d7�|dkr�|||�7}qC|dkr�|�dkr��d7�|�dkr��d7�|d7}q�|d	7}q�|d
7}qC|dkr|d7}qC|d
kr�}|�krI�||d!dkrI|d7}nx1|�kr|�||d!dkr||d7}qLW|�kr�|d7}q���|!jdd�}|d�|dd!dkr�d|d}n |dd!dkr�d|}nd||f}qC|dkr3|d7}|d7}qC|dkr\|r\|d7}|d8}qC|dkr{|r{|d7}qC|dkr�|�}|r��d7�|||�7}q�|||�7}qC|||�7}qCW|S(s
Convert an extended glob string to a regexp string.

    >>> from . import pycompat
    >>> def bprint(s):
    ...     print(pycompat.sysstr(s))
    >>> bprint(_globre(br'?'))
    .
    >>> bprint(_globre(br'*'))
    [^/]*
    >>> bprint(_globre(br'**'))
    .*
    >>> bprint(_globre(br'**/a'))
    (?:.*/)?a
    >>> bprint(_globre(br'a/**/b'))
    a/(?:.*/)?b
    >>> bprint(_globre(br'[a*?!^][^b][!c]'))
    [a*?!^][\^b][^c]
    >>> bprint(_globre(br'{a,b}'))
    (?:a|b)
    >>> bprint(_globre(br'.\*\?'))
    \.\*\?
    iR2c@s��ko���d!S(Ni(((titnR,(s5/usr/lib64/python2.7/site-packages/mercurial/match.pytpeek%sis*?[{},\t*R3s(?:.*/)?s.*s[^/]*t?R�t[s!]t]s\[s\s\\t!t^s%s[%s]t{s(?:t}t)t,t|(RDRRtreescapetreplace(	R,trestgrouptescapeR�R�tjtstuffRP((R�R�R,s5/usr/lib64/python2.7/site-packages/mercurial/match.pyt_globre
sf






#
&







	
cC@s|s
dS|dkr|S|dkrJ|dkr6dStjj|�dS|dkr�|dkrkd}ntjj|�d}|d	S|d
kr�dt|�|S|dkr�|jd
�r�|Sd|S|dkr�t|�|Stjd||f��dS(sxConvert a (normalized) pattern of any kind into a regular expression.
    globsuffix is appended to the regexp of globs.R2R	RR
R�s(?:/|$)RR3s[^/]+$Rs(?:|.*/)RR�s.*R
snot a regex pattern: %s:%sN(RR
(RRR�R�R�RR(R+R,t
globsuffixtescaped((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyt_regex[s,	c@sg�t||�\�}�rIi���fd�}�j|�nd}|r�td�|D��r�d�|D���fd�}dtjtt����}�j|�q�t||�\}}�j|�nt��dkr�|�dfS|�fd	�fSd
S(slReturn regexp string and a matcher function for kindpats.
    globsuffix is appended to the regexp of globs.c@s{xt�D]l\}}|j|�r�j|�}|dkrVt|�}|�|<n||t|��rstSqqWtS(N(R�R�RRRDR@R?(RtR=R<tmf(tsubincludestsubmatchers(s5/usr/lib64/python2.7/site-packages/mercurial/match.pytmatchsubinclude�s
R2cs@s$|]\}}}|dkVqdS(RN((R�RuRPR�((s5/usr/lib64/python2.7/site-packages/mercurial/match.pys	<genexpr>�scS@sh|]\}}}|�qS(((R�RuRPR�((s5/usr/lib64/python2.7/site-packages/mercurial/match.pys	<setcomp>�s	c@s8|jd�}|dkr(|| }nd}|�kS(NR3iR�(R�(RtR�R�(R�(s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��s

srootfilesin: %siic@st�fd��D��S(Nc3@s|]}|��VqdS(N((R�R�(Rt(s5/usr/lib64/python2.7/site-packages/mercurial/match.pys	<genexpr>�s(R�(Rt(t
matchfuncs(Rts5/usr/lib64/python2.7/site-packages/mercurial/match.pyt<lambda>�R2N(	R>RR�RtpprintR�tsortedt_buildregexmatchRD(R&R�R(R$RRR�((R�RRRs5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�xs$c	@s�yjddjg|D]!\}}}t|||�^q�}t|�dkrYt�n|t|�fSWn=tk
r�t|�}|dkr��nt||d |�\}�t||d|�\}�|��fd�fStjk
r�x�|D]�\}}}ytdt|||��Wq�tjk
r�|rjtjt	d�|||f��q�tjt	d�||f��q�Xq�Wtjt	d���nXd	S(
sjBuild a match function from a list of kinds and kindpats,
    return regexp string and a matcher function.s(?:%s)R�i Nic@s�|�p�|�S(N((R�(taR�(s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�R2s%s: invalid pattern (%s): %ssinvalid pattern (%s): %ssinvalid patternN(
R7R�RDt
OverflowErrorRRR	RRmR(	R&R�RuRPR�Rtltregexatregexb((RR�s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�s./	
'cC@s
g}g}x�|D]�\}}}|dkr�g}xX|jd�D]G}d|kszd|kszd|kszd|kr~Pn|j|�qDW|jdj|�p�d�q|dkr�|j|p�d�q|dkr�|j|p�d�q|jd�qW||fS(
s1Returns roots and directories corresponding to each pattern.

    This calculates the roots and directories exactly matching the patterns and
    returns a tuple of (roots, dirs) for each. It does not return other
    directories which may also need to be considered, like the parent
    directories.
    R
R3R�R�R�R�R�R
RR(R
R(R(RjRR7(R&R�R�R+R,R-R$RP((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyt_patternrootsanddirs�s 0cC@st|�\}}|S(sFReturns root directories to match recursively from the given patterns.(R
(R&R�R�((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��scC@s^t|�\}}g}|jtj|��|jtj|��|jd�|||fS(s�Returns roots and exact directories from patterns.

    `roots` are directories to match recursively, `dirs` should
    be matched non-recursively, and `parents` are the implicitly required
    directories to walk to items in either roots or dirs.

    Returns a tuple of (roots, dirs, parents).

    >>> _rootsdirsandparents(
    ...     [(b'glob', b'g/h/*', b''), (b'glob', b'g/h', b''),
    ...      (b'glob', b'g*', b'')])
    (['g/h', 'g/h', '.'], [], ['g', '.'])
    >>> _rootsdirsandparents(
    ...     [(b'rootfilesin', b'g/h', b''), (b'rootfilesin', b'', b'')])
    ([], ['g/h', '.'], ['g', '.'])
    >>> _rootsdirsandparents(
    ...     [(b'relpath', b'r', b''), (b'path', b'p/p', b''),
    ...      (b'path', b'', b'')])
    (['r', 'p/p', '.'], [], ['p', '.'])
    >>> _rootsdirsandparents(
    ...     [(b'relglob', b'rg*', b''), (b're', b're/', b''),
    ...      (b'relre', b'rr', b'')])
    (['.', '.', '.'], [], ['.'])
    R�(R
RBRR�R(R&R�R�RP((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR��s
cC@s3g|D]}|ddkr|^q}t|�S(s�Returns the potential explicit filenames from the patterns.

    >>> _explicitfiles([(b'path', b'foo/bar', b'')])
    ['foo/bar']
    >>> _explicitfiles([(b'rootfilesin', b'foo/bar', b'')])
    []
    iR(R(R�(R&RNtfilable((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�
s
)cC@s.x'|D]\}}}|dkrtSqWtS(s:Whether all the patterns match a prefix (i.e. recursively)RR
(RR
(R?R@(R&R+R,R-((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyR�sc
C@sidd6dd6dd6dd6dd6}d}g}t|d�}x�ttj|�d	d
�D]�\}}d|kr�ts�tjjd�antj|�}	|	r�||	jd
� }n|j	d
d�}n|j
�}|s�q`n|jd�rU|dj�}
y||
}Wq`t
k
rN|rO|td�||
f�qOq`Xq`n|}xt|j�D]f\}
}|j|�r�|}|t|�}Pqh|j|
d�rh|}|t|
�d
}PqhqhW|r�|j||||f�q`|j||�q`W|j�|S(s�parse a pattern file, returning a list of
    patterns. These patterns should be given to compile()
    to be validated and converted into a match function.

    trailing white space is dropped.
    the escape character is backslash.
    comments start with #.
    empty lines are skipped.

    lines can be of the following formats:

    syntax: regexp # defaults following lines to non-rooted regexps
    syntax: glob   # defaults following lines to non-rooted globs
    re:pattern     # non-rooted regular expression
    glob:pattern   # non-rooted glob
    pattern        # pattern of the current default type

    if sourceinfo is set, returns a list of tuples:
    (pattern, lineno, originalline). This is useful to debug ignore patterns.
    srelre:R	tregexpsrelglob:R
RRtrbtstartit#s((?:^|[^\\])(?:\\\\)*)#.*s\#ssyntax:is!%s: ignoring invalid syntax '%s'
R�(topent	enumerateRtiterfilet
_commentreR	RtsearchtendR�trstripR�tstriptKeyErrorRt	iteritemsRDRtclose(
tfilepathRMt
sourceinfotsyntaxestsyntaxRJtfptlinenotlineRR�t
linesyntaxtrels((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyRp sP(

(R	R
RRR
RRRRRRR(R
R
(=t
__future__RRRdR�RnR	ti18nRR2RRRRRtutilsRR�RhR�RR1R>RARR?RHRR]RbRcRfRItobjectRyRWRCR�RXR�RYRVR[RZR�R�R#RER�RgR�R�R�RR
R�R�R�R�RRp(((s5/usr/lib64/python2.7/site-packages/mercurial/match.pyt<module>sj(		
				R				)�*%;1B	=YQ4			Q		+				)