\x89\x50\x4E\x47\x0D\x0A\x1A\x0A PNG  \x89\x50\x4E\x47\x0D\x0A\x1A\x0A  13\c@@sddlmZddlZddlmZddlmZmZm Z m Z m Z dZ dZ d Zd Zd Zd d ZdZdZdZdddZdZdZdZdZdZdZdS(i(tabsolute_importNi(t_(terrortmatcht repositorytsparsetutilt narrowspecspath:s rootfilesin:cC@s#|jd}t|||fS(sReturns 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|djS(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*tjtdn|jd}d|ksQd|kritjtdndS(sValidates 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 (tpatternt defaultkindR R ((s:/usr/lib64/python2.7/site-packages/mercurial/narrowspec.pytnormalizepatternBscC@sd|D}t||S(sParses 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 Us (tvalidatepatterns(tpatstres((s:/usr/lib64/python2.7/site-packages/mercurial/narrowspec.pyt parsepatternsJs  cC@s~t|ts%tjd|nxR|D]J}|jts,tjtd|dtddjtq,q,WdS(sValidate 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|dStj|dgd|p1gd|p=gS(Nttincludetexclude(RtneverR(trootR2R3((s:/usr/lib64/python2.7/site-packages/mercurial/narrowspec.pyRyscC@sy|jjt}Wn8tk rP}|jtjkrJttfSnXtj|j |d\}}}|rt j t dnt |t |||fS(NtnarrowsJincluding other spec files using '%include' is not supported in narrowspec(tsvfstreadtFILENAMEtIOErrorterrnotENOENTR%Rt parseconfigtuiRRRR(trepotspecR/t includepatst excludepatstprofiles((s:/usr/lib64/python2.7/site-packages/mercurial/narrowspec.pytloads  cC@s:t|t|t||}|jjt|dS(N(RR0R7twriteR9(R?RARBR@((s:/usr/lib64/python2.7/site-packages/mercurial/narrowspec.pytsaves  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 savebackups   cC@sBtj|jkrdStj|jj||jjtdS(N( RRHRIRtrenameRJR)R7R9(R?RN((s:/usr/lib64/python2.7/site-packages/mercurial/narrowspec.pyt restorebackupscC@s*tj|jkrdS|jj|dS(N(RRHRIRJtunlink(R?RN((s:/usr/lib64/python2.7/site-packages/mercurial/narrowspec.pyt clearbackupsc C@s+t|}|j|g}|s4t|}nd|krg}x|D]}tjtj|}||kr|j|qMnt}x8|D]0} |j| drt}|j|PqqW|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_includest req_includetvalidt repo_include((s:/usr/lib64/python2.7/site-packages/mercurial/narrowspec.pytrestrictpatternss2          (spath:s rootfilesin:(t __future__RR;ti18nRR1RRRRRRR9R(R RR RR"RR0tNoneRDRFRORQRSRc(((s:/usr/lib64/python2.7/site-packages/mercurial/narrowspec.pyts( (