o ]Lb$@sLddlmZddlmZddlmZmZmZmZddZ ddZ d d Z d S) )absolute_import)_)errorfileset filesetlangpycompatcCst|td}t|S)Nssize requires an expression)r getstringrr sizematcher)xexprr 7/usr/lib/python3/dist-packages/mercurial/minifileset.py_sizeps rcss ttdd}|dkrtdS|dvrptdhtd}|drK|d dtD]}|d vrDttd |q5fd d S|drc|ddt fdd }|Stjtd|tdd|dvrddddDfdd S|dkrtdtd fdd S|dkrfdd S|dkrdd dd fdd d }t d}||vr||St || |d!krtdtd fd"d S|d#krtjtd$td%dt d&f)'Nsmissing argumentrs withstatusr>stringsymbolkindpatspathsinvalid file patterns**s*{}[]?/\sreserved character: %scs |SN)endswithns)extr r(s z_compile..spath:cs*|ot|kp|ddkS)Nr/) startswithlenr)pplr rr,s sunsupported file pattern: %ss#paths must be prefixed with "path:")hint>orpatternscSsg|]}t|qSr _compile).0r r r r 5z_compile..cstfddDS)Nc3s|]}|VqdSrr )r&frr r 6sz-_compile....)anyr)funcsrrr6ssandcs||o ||Srr rfunc1func2r rr:r(snotcstd|| S)Nrr$rtreer rr<r(sfunccSdS)NTr rr r rr?cSr2)NFr rr r rr@r3cstd|S)Nr)rrr0r rrAs)sallsnonessizesminuscs||o || Srr rr-r rrLsslists can't use a list in this contextssee 'hg help "filesets.x or y"'sillegal tree: %r)r ParseErrorrr%r getpatternrrbytestrr getsymbolUnknownIdentifierkeysProgrammingError)r1opnamecr)symbolsr )rr.r/r,rr r1rr%sj               r%cCs&t|}t|}t|}t|S)agenerate a function (path, size) -> bool from filter specification. "text" could contain the operators defined by the fileset language for common logic operations, and parenthesis for grouping. The supported path tests are '**.extname' for file extension test, and '"path:dir/subdir"' for prefix test. The ``size()`` predicate is borrowed from filesets to test file size. The predicates ``all()`` and ``none()`` are also supported. '(**.php & size(">10MB")) | **.zip | (path:bin & !path:bin/README)' for example, will catch all php files whose size is greater than 10 MB, all files whose name ends with ".zip", and all files under "bin" in the repo root except for "bin/README". )rparseanalyzeoptimizer%)textr1r r rcompileUs   rCN) __future__ri18nrrrrrrr%rCr r r rs   <