³ò ø$•Jc@s¦ddkZddkZdefd„ƒYZdefd„ƒYZdefd„ƒYZd„Zd „Zd „Zd „Z d „Z d „Z d„Z d„Z dS(iÿÿÿÿNtmatchcBsneZggded„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z RS( tglobc sÙ||_||_g|_t|p|ƒ|_|o"tt|d||ƒdƒ‰n|o"tt|d||ƒdƒ‰n|o||_|i‰nX|oPt||||ƒ}t|ƒ|_|ip t|ƒ|_t|dƒ‰n|p|od|o6|o‡‡‡fd†} qe‡‡fd†} qº|o‡‡fd†} qºˆ} nR|o'|o‡‡fd†} qºˆ} n$|o‡fd†} n d „} | |_ t |iƒ|_ d S( srbuild 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 exclude - patterns to exclude default - if a pattern in names has no explicit type, assume this one exact - patterns are actually literals a pattern is one of: 'glob:' - a glob relative to cwd 're:' - a regular expression 'path:' - a path relative to canonroot 'relglob:' - an unrooted glob (*.c matches C files in all dirs) 'relpath:' - a path relative to cwd 'relre:' - a regexp that needn't match the start of a name '' - a pattern of the specified default type Rs(?:/|$)t$cs%ˆ|ƒoˆ|ƒ o ˆ|ƒS(((tf(temtpmtim(s"/sys/lib/python/mercurial/match.pyt8scsˆ|ƒo ˆ|ƒS(((R(RR(s"/sys/lib/python/mercurial/match.pyR:scsˆ|ƒ o ˆ|ƒS(((R(RR(s"/sys/lib/python/mercurial/match.pyR=scsˆ|ƒo ˆ|ƒ S(((R(RR(s"/sys/lib/python/mercurial/match.pyRCscs ˆ|ƒ S(((R(R(s"/sys/lib/python/mercurial/match.pyRHscSstS((tTrue(R((s"/sys/lib/python/mercurial/match.pyRJsN( t_roott_cwdt_filestboolt_anypatst _buildmatcht _normalizetexactt_rootstmatchfntsett_fmap( tselftroottcwdtpatternstincludetexcludetdefaultRtpatstm((RRRs"/sys/lib/python/mercurial/match.pyt__init__ sB   ""      cCs |i|ƒS(N(R(Rtfn((s"/sys/lib/python/mercurial/match.pyt__call__Osccsx|iD] }|Vq WdS(N(R (RR((s"/sys/lib/python/mercurial/match.pyt__iter__Qs cCsdS(sdcallback for each explicit file that can't be found/accessed, with an error message N((RRtmsg((s"/sys/lib/python/mercurial/match.pytbadTscCsdS(N((RR((s"/sys/lib/python/mercurial/match.pytdirYscCsdS(N((RR((s"/sys/lib/python/mercurial/match.pytmissing[scCs ||ijS(N(R(RR((s"/sys/lib/python/mercurial/match.pyR]scCsti|i|i|ƒS(N(tutiltpathtoR R (RR((s"/sys/lib/python/mercurial/match.pytrel_scCs|iS(N(R (R((s"/sys/lib/python/mercurial/match.pytfilesascCs|iS(N(R (R((s"/sys/lib/python/mercurial/match.pytanypatscs( t__name__t __module__tFalseRR R!R#R$R%RR(R)R*(((s"/sys/lib/python/mercurial/match.pyR sB        RcBseZd„ZRS(cCs ti||||dtƒdS(NR(RRR(RRRR)((s"/sys/lib/python/mercurial/match.pyRgs(R+R,R(((s"/sys/lib/python/mercurial/match.pyRfstalwayscBseZd„ZRS(cCsti|||gƒdS(N(RR(RRR((s"/sys/lib/python/mercurial/match.pyRks(R+R,R(((s"/sys/lib/python/mercurial/match.pyR.jscCst|dƒdS(Ni(t _patsplittNone(tpat((s"/sys/lib/python/mercurial/match.pytpatkindnscCsNd|jo7|iddƒ\}}|d jo||fSqDn||fS( sOSplit a string into an optional pattern kind prefix and the actual pattern.t:itreRtpathtrelglobtrelpathtrelre(sresglobspathsrelglobsrelpathR8(tsplit(R1Rtkindtval((s"/sys/lib/python/mercurial/match.pyR/qs   c s¾dtˆƒ‰‰d}d}ti}‡‡‡fd†}xzˆˆjolˆˆ}ˆd‰|djo|||ƒ7}q@|djo6|ƒdjoˆd7‰|d7}qµ|d7}q@|d jo|d 7}q@|d joöˆ}|ˆjoˆ|d jo|d7}nx-|ˆjoˆ|d jo|d7}q"W|ˆjo|d7}qµˆˆ|!iddƒ}|d‰|ddjod|d}n |ddjod|}nd||f}q@|djo|d7}|d7}q@|djo|o|d7}|d8}q@|djo|o|d7}q@|djoB|ƒ}|oˆd7‰|||ƒ7}qµ|||ƒ7}q@|||ƒ7}q@W|S(s$convert a glob pattern into a regexpitcsˆˆjoˆˆS(N(((tiR1tn(s"/sys/lib/python/mercurial/match.pytpeek€sis*?[{},\t*s.*s[^/]*t?t.t[s!]t]s\[s\s\\t!t^s%s[%s]t{s(?:t}t)t,t|(tlenR4tescapetreplace( R1trestgroupRMR?tctjtstufftp((R=R>R1s"/sys/lib/python/mercurial/match.pyt_globrezs`        !        cCsÎ|pdSn|djo|Sn|djodti|ƒdSnw|djodt|ƒ|SnT|djoti|ƒdSn2|d jo$|idƒo|Snd |Snt|ƒ|S( s+convert a pattern into a regular expressionR<R4R5RFs(?:/|$)R6s(?:|.*/)R7R8s.*(R4RMRUt startswith(R:tnamettail((s"/sys/lib/python/mercurial/match.pyt_regex±s      c s{ytddig}|D]\}}|t|||ƒq~ƒ}t|ƒdjo tƒ‚nti|ƒiSWntj oft|ƒ}|djo‚nt||d |ƒt||d|ƒ‰‰‡‡fd†Sntij o€xg|D]_\}}y!tidt|||ƒƒWqtij o t i d||fƒ‚qXqWt i dƒ‚nXdS( s0build a matching function from a set of patternss(?:%s)RKi Nicsˆ|ƒp ˆ|ƒS(((ts(tatb(s"/sys/lib/python/mercurial/match.pyRÒssinvalid pattern (%s): %ssinvalid patternN( tjoinRYRLt OverflowErrorR4tcompileRRterrorR&tAbort(RRXt_[1]tkRTR1tl((R[R\s"/sys/lib/python/mercurial/match.pyRÃs&@   / !"c Csžg}x‘g}|D]}|t||ƒq~D]e\}}|djoti|||ƒ}n!|djoti|ƒ}n|i||fƒq1W|S(NRR7R6R5(sglobsrelpath(srelglobspath(R/R&t canonpathtnormpathtappend( tnamesRRRRRbRTR:RW((s"/sys/lib/python/mercurial/match.pyRÛs+   cCsøg}xë|D]ã\}}|djo‡g}x]|idƒD]L}d|jp'd|jpd|jp d|joPn|i|ƒq<W|idi|ƒpdƒq |d jo|i|pdƒq |d jo|idƒq q W|S( NRt/RCRGR@RARBR7R5R6(srelpathspath(R9RgR](RtrR:RWRRT((s"/sys/lib/python/mercurial/match.pyRæs   4!  cCs0x)|D]!\}}|djotSqqWdS(NRR4R6R8(sglobsresrelglobsrelre(R(RR:RW((s"/sys/lib/python/mercurial/match.pyR ös  (R4R&tobjectRRR.R2R/RURYRRRR (((s"/sys/lib/python/mercurial/match.pyss  [  7