\x89\x50\x4E\x47\x0D\x0A\x1A\x0A PNG  \x89\x50\x4E\x47\x0D\x0A\x1A\x0A  13\c@@sdZddlmZmZddlZddlZddlmZddlm Z m Z m Z m Z m Z mZmZmZmZddlmZidddWdXdfd 6d dddYdfd6ddddZdfd6dddd[dfd6dddd\dfd6dddd]dfd6dddd^dfd6ddd_d`dfd6ddddadfd6ddddbdfd6dcd 6ddd 6ded!6dfd"6dgd#6dhd$6Zdd%Zd&d'Zed(Zd&ed)Zd*Zd+Zd,Zd-Zd.Zd/Z d0Z!d1Z"d2Z#d3Z$d4Z%d5Z&d6Z'd7Z(d8Z)d9Z*d:Z+d;Z,id<d 6d=d"6d>d!6e$d#6d?d 6e'd6e%d6e&d6e*d 6e,d6d@d6dAd6e(d6dBd6dCd6Z-e-j.Z/e-d!e/d dS(isSlightly complicated template engine for commands and hgweb This module provides low-level interface to the template engine. See the formatter and cmdutil modules if you are looking for high-level functions such as ``cmdutil.rendertemplate(ctx, tmpl)``. Internal Data Types ------------------- Template keywords and functions take a dictionary of current symbols and resources (a "mapping") and return result. Inputs and outputs must be one of the following data types: bytes a byte string, which is generally a human-readable text in local encoding. generator a lazily-evaluated byte string, which is a possibly nested generator of values of any printable types, and will be folded by ``stringify()`` or ``flatten()``. None sometimes represents an empty value, which can be stringified to ''. True, False, int, float can be stringified as such. wrappedbytes, wrappedvalue a wrapper for the above printable types. date represents a (unixtime, offset) tuple. hybrid represents a list/dict of printable values, which can also be converted to mappings by % operator. hybriditem represents a scalar printable value, also supports % operator. mappinggenerator, mappinglist represents mappings (i.e. a list of dicts), which may have default output format. mappedgenerator a lazily-evaluated list of byte strings, which is e.g. a result of % operation. i(tabsolute_importtprint_functionNi(t_( tconfigtencodingterrortparsertpycompatttemplatefilterst templatefuncst templateutiltutil(t stringutilitgroupt)tfunct(it.it%t|it*t/it+tnegateit-itkeyvaluet=itlistt,tintegertsymboltstringttemplatetendc c@s6|}tj|}x||kr||}|jr=n|dkrZ|d|fVn|dkr|d}t||||\}}d||fV|d8}nO|dkrh|||d!dkrh||d}|d}}x ||krL||}|d kr|d7}qn||kr?d |||!|fVPn|d7}qWtjtd |n|jr|}x4||kr||}|jsPn|d7}q}Wd |||!|fV|d8}n"|d kr|||d!dks|dkr,|||d!dkr,|dkr8|d7}d } nd} |||d!} |d}}x||kr|j d||r|d7}q`n|j | ||rt j |||!}| dkrt|dt |d}n| ||fV|d7}Pn|d7}q`Wtjtd |n|j sD|dkr|}|d7}x@||kr||}|j p|dksPn|d7}qWW|||!} d| |fV|d8}n6||krdd|fVdStjtd||d7}qW|r$tjtd|ndd|fVdS(s^Parse a template expression into a stream of tokens, which must end with term if specifieds (=,).%|+-*/s"'iR trisr'sr"s\Rsunterminated stringRs\'s\"isr\'sr\"s\\\iiRRR!Ns syntax errorsunterminated template expansion(sr'sr"(s\'s\"(sr\'sr\"(RtbytestrtisspacetNonet_parsetemplateRt ParseErrorRtisdigitt startswithRt unescapestrtlentisalnum( tprogramtstartR!ttermtpostctstdatatdttokentquotetsym((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyttokenizeds      #        ##           tcC@sg}xt||||D]v\}}}|dkrM|j||fq|dkri|j|q|dkr||fStjd|qWtjddS(s >>> _parsetemplate(b'foo{bar}"baz', 0, 12) ([('string', 'foo'), ('symbol', 'bar'), ('string', '"baz')], 12) >>> _parsetemplate(b'foo{bar}"baz', 0, 12, quote=b'"') ([('string', 'foo'), ('symbol', 'bar')], 9) >>> _parsetemplate(b'foo"{bar}', 0, 9, quote=b'"') ([('string', 'foo')], 4) >>> _parsetemplate(br'foo\"bar"baz', 0, 12, quote=b'"') ([('string', 'foo"'), ('string', 'bar')], 9) >>> _parsetemplate(br'foo\\"bar', 0, 10, quote=b'"') ([('string', 'foo\\')], 6) RR R!sunexpected type: %ss!unterminated scanning of templateN(t _scantemplatetappendRtProgrammingError(ttmplR.tstopR6tparsedttyptvalR0((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR&s %    cc@s|d}x`t|dt|d|D]@\}}}|rI||fVn|dkrYdS||f}q%WtjddS(sScan (type, start, end) positions of outermost elements in template If raw=True, a backslash is not taken as an escape character just like r'' string in Python. Note that this is different from r'' literal in template in that no template fragment can appear in r'', e.g. r'{foo}' is a literal '{foo}', but ('{foo}', raw=True) is a template expression 'foo'. >>> list(scantemplate(b'foo{bar}"baz')) [('string', 0, 3), ('template', 3, 8), ('string', 8, 12)] >>> list(scantemplate(b'outer{"inner"}outer')) [('string', 0, 5), ('template', 5, 14), ('string', 14, 19)] >>> list(scantemplate(b'foo\\{escaped}')) [('string', 0, 5), ('string', 5, 13)] >>> list(scantemplate(b'foo\\{escaped}', raw=True)) [('string', 0, 4), ('template', 4, 13)] itrawR!Ns!unterminated scanning of template(R%R:R+RR<(R=RBtlastR@RAR0((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt scantemplates. c#@sd|}tjtjg|}|tjt}yxkrtfdtj|Ddd}|dkrd|!fVPn||d!} d} |s|t|!jd} n| d dkr3d||d!| fV|dq;n|kr]d||!fVn| |krd d |dfVd S|j t |dd \} j d st jtd nd| |fVd7q;W|rt jtd|nWnt jk r} t| jdkr| jd} | jd}jdddd| d|dtd| _nnXd d fVd S(sEParse template string into chunks of strings and template expressionst{c3@s$|]}j|VqdS(N(tfind(t.0R1(R0R>R=(s9/usr/lib64/python2.7/site-packages/mercurial/templater.pys stkeycS@s|dk|fS(Ni((tn((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytsiRis\iR!Nt}s invalid tokenR sunterminated strings s\nt s^ there(RR*RtidentitytelementstminR#R+trstripR%tparseR8R)RR'Rtargstcounttreplacethint(R=R.R>R6RBtsepcharstunescapetpRIR1tbstparserestinsttloctoffset((R0R>R=s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR:sR   '#   ( .cC@st|ts|S|d}|dkrH|ftd|dDStd|dD}|sld St|dkr|dddkr|dS|f|SdS( s;Expand list of templates to node tuple >>> def f(tree): ... print(pycompat.sysstr(prettyformat(_unnesttemplatelist(tree)))) >>> f((b'template', [])) (string '') >>> f((b'template', [(b'string', b'foo')])) (string 'foo') >>> f((b'template', [(b'string', b'foo'), (b'symbol', b'rev')])) (template (string 'foo') (symbol 'rev')) >>> f((b'template', [(b'symbol', b'rev')])) # template(rev) -> str (template (symbol 'rev')) >>> f((b'template', [(b'template', [(b'string', b'foo')])])) (string 'foo') iR cs@s|]}t|VqdS(N(t_unnesttemplatelist(RGtx((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pys Fsics@s|]}t|VqdS(N(R_(RGR`((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pys IsRR9N(RR9(t isinstancettupleR+(ttreetoptxs((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR_/s  &cC@s.t|dt|\}}td|fS(sParse template string into treeiR (R&R+R_(R=R?R0((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRRQscC@smtjt}|jt|dt|\}}|t|krctjtd|nt|S(sParse a template expression into tree >>> _parseexpr(b'"foo"') ('string', 'foo') >>> _parseexpr(b'foo(bar)') ('func', ('symbol', 'foo'), ('symbol', 'bar')) >>> _parseexpr(b'foo(') Traceback (most recent call last): ... ParseError: ('not a prefix: end', 4) >>> _parseexpr(b'"foo" "bar"') Traceback (most recent call last): ... ParseError: ('invalid token', 7) is invalid token( RRORRR8R+RR'RR_(texprRYRcR0((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt _parseexprWs 'cC@stj|dS(NRRR(RRR(Rt prettyformat(Rc((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRhmscC@sb|stjtdn|d}||krE||||Stjtd|dS(s1Compile parsed template tree to (func, data) pairsmissing argumentisunknown method '%s'N(RR'R(texptcontextt curmethodstt((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt compileexpps   cC@s9|ddkr|dStjtd|ddS(NiRisexpected a symbol, got '%s'(RR'R(Ri((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt getsymbol{scC@s:|s gS|ddkr3t|d|dgS|gS(NiRii(tgetlist(R`((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRos cC@sZ|ddkr t||tS|ddkrA|j|dStjtddS( s_Compile given template tree or load named template from map file; returns (func, data) pairiR RRisexpected template specifierN(R R(Rmtmethodst_loadRR'R(RiRj((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt gettemplates cC@stjtd|dS(Ns$recursive reference '%s' in template(RtAbortR(RjtmappingRH((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt_runrecursivesymbolscC@s6g|dD]}t||t^q }tj|fS(Ni(RmRpR t runtemplate(RiRjtetctmpl((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt buildtemplates)cC@st|d}||jkrU|j|}t|d|t}tj||ffS||jkr|j|}t|d|t||j}||fSt j t d|dS(Niisunknown function '%s'( Rnt_filtersRmRpR t runfiltert_funcst_buildfuncargst_argspecRR'R(RiRjRItfilttargtfRS((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt buildfilters   cC@s<t|d|t}t|d|}tj||ffS(Nii(RmRpRrR trunmap(RiRjtdargttarg((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytbuildmapscC@s9t|d|t}t|d}tj||ffS(Nii(RmRpRnR t runmember(RiRjRtmemb((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt buildmemberscC@s#t|d|t}tj|fS(Ni(Rmt exprmethodsR t runnegate(RiRjR((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt buildnegatescC@sBt|d|t}t|d|t}tj|||ffS(Nii(RmRR t runarithmetic(RiRjRtlefttright((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytbuildarithmeticscC@st|d}||jkrU|j|}t|d|t||j}||fS||jkrt|d|t|dd}t|dkrtj t d|n|j|}t j |d|ffStj t d|dS(Niitargspecsfilter %s expects one argumentisunknown function '%s'( RnR|R}RR~RzR%R+RR'RR R{(RiRjRIRRS((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt buildfuncs   c @sfd}fd}|s:|t|Stj|\}}} } }tjt|||dddd} tj} |r|| j|| |>> context = engine(lambda t: (templateutil.runsymbol, t)) >>> def fargs(expr, argspec): ... x = _parseexpr(expr) ... n = getsymbol(x[1]) ... return _buildfuncargs(x[2], context, exprmethods, n, argspec) >>> list(fargs(b'a(l=1, k=2)', b'k l m').keys()) ['l', 'k'] >>> args = fargs(b'a(opts=1, k=2)', b'**opts') >>> list(args.keys()), list(args[b'opts'].keys()) (['opts'], ['opts', 'k']) c@s&tjfd|jDS(Nc3@s-|]#\}}|t|fVqdS(N(Rm(RGtkR`(RjRk(s9/usr/lib64/python2.7/site-packages/mercurial/templater.pys s(R tsortdictt iteritems(Re(RjRk(s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt compiledictsc@s#g|D]}t|^qS(N(Rm(ReR`(RjRk(s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt compilelistst keyvaluenodeRtkeynodeR(RoRt splitargspect buildargsdictR Rtpoptupdate( RiRjRktfuncnameRRRt_poskeystvarkeyt_keystoptkeyttreeargstcompargs((RjRks9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR}s cC@stjtddS(Ns*can't use a key-value pair in this context(RR'R(Ritcontent((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytbuildkeyvaluepairscC@stj|dfS(Ni(R t runinteger(RwR1((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRJscC@stj|dfS(Ni(R t runstring(RwR1((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRJscC@stj|dfS(Ni(R t runsymbol(RwR1((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRJscC@st|d|tS(Ni(RmR(RwR1((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRJscC@st||dS(NcS@s||S(N((tatb((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRJs(R(RwR1((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRJscC@st||dS(NcS@s||S(N((RR((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRJs(R(RwR1((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRJscC@st||dS(NcS@s||S(N((RR((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRJs(R(RwR1((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRJscC@st||dS(NcS@s||S(N((RR((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRJs(R(RwR1((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRJst _aliasrulescB@s5eZdZedZeeZedZRS(s2Parsing and expansion rule set of template aliasesstemplate aliascC@s|ddkr@|dddkr@|ddt|dfS|ddkr}|dddkr}|dd|dgfSdS(sNReturn (name, args) if tree is func(...) or ...|filter; otherwise NoneiRiRiRN(Ro(Rc((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt _trygetfunc s$$( t__name__t __module__t__doc__Rt_sectiont staticmethodRgt_parseR(((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRs  cC@stj|}tj||S(s'Return new tree of aliases are expanded(RRtexpand(Rctaliasestaliasmap((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt expandaliasesscC@sEt|dks6|ddks6|d|dkr:|S|dd!S(s9unwrap quotes if any; otherwise returns unmodified stringiis'"ii(R+(R2((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt unquotestrings6tresourcemappercB@s_eZdZejZejdZejdZejdZ ejdZ RS(s%Mapper of internal template resourcescC@sdS(sBReturn a set of available resource keys based on the given mappingN((tselfRt((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt availablekeys&scC@sdS(s'Return a set of supported resource keysN((R((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt knownkeys*scC@sdS(s:Return a resource for the key if available; otherwise NoneN((RRtRH((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytlookup.scC@sdS(scReturn a dict of additional mapping items which should be paired with the given new mappingN((RRjt origmappingt newmapping((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt populatemap2s( RRRtabctABCMetat __metaclass__tabstractmethodRRRR(((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR!s  tnullresourcemappercB@s,eZdZdZdZdZRS(cC@stS(N(tset(RRt((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR8scC@stS(N(R(R((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR;scC@sdS(N(R%(RRtRH((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR>scC@siS(N((RRjRR((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRAs(RRRRRR(((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR7s   tenginecB@seZdZddddZdZdZdZdZdZ dZ dZ d Z d Z d Zd Zd ZRS(stemplate expansion engine. template expansion works like this. a map file contains key=value pairs. if value is quoted, it is treated as string. otherwise, it is treated as name of template file. templater is asked to expand a key in map. it looks up key, and looks for strings like this: {foo}. it expands {foo} by looking up foo in map, and substituting it. expansion is recursive: it stops when there is no more {foo} to replace. expansion also allows formatting and filtering. format uses key to expand each item in list. syntax is {key%format}. filter uses function to transform value. syntax is {key|filter1|filter2|...}.cC@s||_|dkri}n||_tj|_|dkrHi}n|dkr`t}n||_||_i|_ i|_ dS(N( t_loaderR%RzR tfuncsR|Rt _defaultst _resourcest_cachet _tmplcache(Rtloadertfilterstdefaultst resources((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt__init__Xs            c@ssjjjj|fd|jD}|j||jjj|||S(sfCreate combined mapping from the original mapping and partial mapping to override the originalc@sCi|]9\}}|ks6jj|r||qS((t isdisjointt_defaultrequires(RGRtv(tknownrestnewresR(s9/usr/lib64/python2.7/site-packages/mercurial/templater.pys ns  (RRRRRR(RRRRt((RRRs9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt overlaymapgs" cC@s?|jj|}|dks+t| r/dSt|ddS(s?Resource keys required by the specified default symbol functiont _requiresN(((RtgetR%tcallabletgetattr(RRHR((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRvscC@sRd}||jjkr-|j|}n|dkrN|jj|}n|S(s:Resolve symbol to value or function; None if nothing foundN(R%RRRR(RRtRHR((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR}s  cC@s|jj|S(sBReturn a set of available resource keys based on the given mapping(RR(RRt((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytavailableresourcekeysscC@s |jjS(s'Return a set of supported resource keys(RR(R((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytknownresourcekeysscC@sA|jj||}|dkr=tjtd|n|S(sNReturn internal data (e.g. cache) used for keyword/function evaluations#template resource not available: %sN(RRR%R tResourceUnavailableR(RRtRHR((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytresources  cC@ss||jkrh|j|}t|f|j|dS|dj|||jksm||jkr|j|j||ndS|ddhkrdS|dkr|djt|d|j|d|dS|dkr!|djt|d|j|d|dSx"|dD]}|j||q,WdS( NiRiRRRiR(taddRR t_findsymbolsusedRRn(RRctsymsRdR2R`((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR,s.     cC@s/ttf}|j|j|||S(sLook up (keywords, filters/functions) referenced from the name template 't' This may load additional templates from the map file. (RRR(RRlR((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt symbolsusedGs( RRRRRRRRR(((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR s     t templatercB@seZddddddddZedddddddZdZedZedZ edZ dZ d Z d Z d Zd Zd ZRS(iic C@sltjj}|r%|j|nt|||_t|jj||||_|||_ |_ dS(sgCreate template engine optionally with preloaded template fragments - ``filters``: a dict of functions to transform a value into another. - ``defaults``: a dict of symbol values/functions; may be overridden by a ``mapping`` dict. - ``resources``: a resourcemapper object to look up internal data (e.g. cache), inaccessible from user template. - ``cache``: a dict of preloaded template fragments. - ``aliases``: a list of alias (name, replacement) pairs. self.cache may be updated later to register additional template fragments. N( RRR RRRRRt_proct _minchunkt _maxchunk( RRRRRRtminchunktmaxchunkt allfilters((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRSs c C@sk|||||g||}t|\}} } |jjj|| |j_tj| |j_|S(s,Create templater from the specified map file(RRRRR RRR( tclsRRRRRRR RlR R((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt frommapfileis  cC@s ||jkS(N(R(RRH((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRtscC@s |jjS(N(RR(R((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRwscC@s |jjS(N(RRz(R((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRz|scC@s |jjS(N(RR(R((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRscC@s|jj|S(s?Get parsed tree for the given template name. Use a local cache.(RR(RRl((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRscC@s |jdS(sLook up (keywords, filters/functions) referenced from the default unnamed template This may load additional templates from the map file. R9(R(R((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytsymbolsuseddefaultscC@s|jj|S(sLook up (keywords, filters/functions) referenced from the name template 't' This may load additional templates from the map file. (RR(RRl((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRscC@s|jd|S(s?Render the default unnamed template and return result as stringR9(trender(RRt((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt renderdefaultscC@sdj|j||S(s?Render the specified named template and return result as stringR9(Rtgenerate(RRlRt((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR%scC@sF|jj||}|jrBtj|d|jd|j}n|S(sVReturn a generator that renders the specified named template and yields chunksRPtmax(RRRR tincreasingchunksR(RRlRttstream((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR's  N((RRR%Rt classmethodR#RtpropertyRRzRRR$RR&R%R'(((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRQs        cC@sidg}g|D]*}tjjtjjtj|^q}g|D]}tjj|rG|^qGS(s)return locations used for template files.R(RRRRR tdatapathtisdir(tpathsrelRRRY((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRs 4cC@sCx<tD]1}tjj||}tjj|r |Sq WdS(s<return location of template file. returns None if not found.N(RRRRRR%(tnameRYR((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt templatepaths cC@s>|dkrt}nt|tr3|g}nt|trN|g}nx|D]}| sU|tjtjfksUtj|ksUtjrtj|krqUnt j j |dd|g}|j dxP|D]H}x?|D]7}t j j ||}t j j |r||fSqWqWqUWtd|dS(sReturn path to mapfile for a given style. Searches mapfile in the following locations: 1. templatepath/style/map 2. templatepath/map-style 3. templatepath/map Rsmap-sNo hgweb templates found in %rN(R%RRatbytesRtoscurdirtospardirtosseptosaltsepRRRR;Rt RuntimeError(tstylesRtstylet locationsRtlocationR((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytstylemaps(        (R iR(RiR(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(iNNNN(iRNNN(iRNNN(iRNNN(iR NNN(iNNNN(?Rt __future__RRRRti18nRR9RRRRRRR R R tutilsR R%ROR8R&RRDR:R_RRRgRhRmRnRoRrRuRyRRRRRRR}RRR RptbasealiasrulesRRRtobjectRRRRRRRRR1R<(((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt7s  @   _  7 "             %               /GX