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: //lib64/python2.7/site-packages/mercurial/templater.pyc
�
1�3\c@@s�dZddlmZmZddlZddlZddlmZddlm	Z	m
Z
mZm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 d0�Z!d1�Z"d2�Z#d3�Z$d4�Z%d5�Z&d6�Z'd7�Z(d8�Z)d9�Z*d:�Z+d;�Z,id<�d 6d=�d"6d>�d!6e$d#6d?�d	6e'd6e%d6e&d6e*d6e,d6d@�d6dA�d6e(d6dB�d6dC�d6Z-e-j.�Z/e-d!e/d <dDej0fdE��YZ1dF�Z2dG�Z3dHe4fdI��YZ5dJe5fdK��YZ6dLe4fdM��YZ7dN�Z8dO�Z9dPe4fdQ��YZ:dRe4fdS��YZ;dT�Z<dU�Z=ddV�Z>dS(is�Slightly 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||}|j�r=n�|dkrZ|d|fVn�|dkr�|d}t||||�\}}d||fV|d8}nO|dkrh|||d!dkrh||d}|d}}x
||krL||}|d	kr|d7}q�n||kr?d
|||!|fVPn|d7}q�Wtjtd�|��n�|j�r�|}x4||kr�||}|j�s�Pn|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|||!�}|	dkr�t|dt|��d}n|	||fV|d7}Pn|d7}q`Wtjtd�|��n�|j
�sD|dkr�|}|d7}x@||kr�||}|j
�p�|dks�Pn|d7}qWW|||!}d||fV|d8}n6||kr�dd|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
startswithRtunescapestrtlentisalnum(tprogramtstartR!ttermtpostctstdatatdttokentquotetsym((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyttokenizeds�


#



##
	





tcC@s�g}x�t||||�D]v\}}}|dkrM|j||f�q|dkri|j|�q|dkr||fStjd|��qWtjd��dS(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%Wtjd��dS(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scantemplate�s.c#@s�d|}tjtjg|}|�tjt�}y�x���kr�t���fd�tj|�D�dd��}|dkr�d|���!��fV��Pn�||d!}	d}
|s�|�t��|!jd��}
n|
d	dkr3d|��|d!�|	�fV|d�q;n|�kr]d|��|!��fVn|	|krd
d|dfVdS|j
t�|d�d��\}��jd��s�t
jtd
����nd||fV�d7�q;W|rt
jtd�|��nWn�t
jk
r�}t|j�dkr�|jd}
�|
 jd�}�jdd���dd|
d|dtd�|_n�nXd
d�fVdS(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	<genexpr>stkeycS@s|dk|fS(Ni((tn((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt<lambda>R9iRis\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@s�t|t�s|S|d}|dkrH|ftd�|dD��St|�dks`t�td�|dD��}|s�d
St|�dkr�|dddkr�|dS|f|Sd	S(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	<genexpr>Fsiics@s|]}t|�VqdS(N(R_(RGR`((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pys	<genexpr>IsRR9N(RR9(t
isinstancettupleR+tAssertionError(ttreetoptxs((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR_/s
&cC@sLt|dt|��\}}|t|�ks<td��td|f�S(sParse template string into treeis$unquoted template should be consumedR (R&R+RcR_(R=R?R0((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRRQscC@smtjt�}|jt|dt|���\}}|t|�krctjtd�|��nt|�S(s�Parse 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_(texprRYRdR0((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt
_parseexprWs
'cC@stj|d�S(NRRR(RRR(Rtprettyformat(Rd((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRimscC@sb|stjtd���n|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�|d��dS(NiRisexpected a symbol, got '%s'(RR'R(Rj((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.pyRp�s
cC@sZ|ddkr t||t�S|ddkrA|j|d�Stjtd���dS(	s_Compile given template tree or load named template from map file;
    returns (func, data) pairiR RRisexpected template specifierN(R R(Rntmethodst_loadRR'R(RjRk((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytgettemplate�s
cC@stjtd�|��dS(Ns$recursive reference '%s' in template(RtAbortR(RktmappingRH((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt_runrecursivesymbol�scC@s6g|dD]}t||t�^q}tj|fS(Ni(RnRqR
truntemplate(RjRktetctmpl((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt
buildtemplate�s)cC@s�t|d�}||jkrU|j|}t|d|t�}tj||ffS||jkr�|j|}t|d|t||j�}||fSt	j
td�|��dS(Niisunknown function '%s'(Rot_filtersRnRqR
t	runfiltert_funcst_buildfuncargst_argspecRR'R(RjRkRItfilttargtfRS((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytbuildfilter�s


cC@s<t|d|t�}t|d|�}tj||ffS(Nii(RnRqRsR
trunmap(RjRktdargttarg((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytbuildmap�scC@s9t|d|t�}t|d�}tj||ffS(Nii(RnRqRoR
t	runmember(RjRkR�tmemb((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytbuildmember�scC@s#t|d|t�}tj|fS(Ni(RntexprmethodsR
t	runnegate(RjRkR�((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytbuildnegate�scC@sBt|d|t�}t|d|t�}tj|||ffS(Nii(RnR�R
t
runarithmetic(RjRkRtlefttright((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytbuildarithmetic�scC@s�t|d�}||jkrU|j|}t|d|t||j�}||fS||jkr�t|d|t|dd�}t|�dkr�tj	t
d�|��n|j|}tj|d|ffStj	t
d�|��dS(Niitargspecsfilter %s expects one argumentisunknown function '%s'(
RoR}R~R�RR{R%R+RR'RR
R|(RjRkRIR�RS((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt	buildfunc�s


c
@s���fd�}��fd�}|s:|t|��Stj|�\}}}	}
}tjt|�||dddd�}tj�}|r�||j|��||<n|
r�||j|
��||
<n|j||��|S(sCompile parsed tree of function arguments into list or dict of
    (func, data) pairs

    >>> 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&tj��fd�|j�D��S(Nc3@s-|]#\}}|t|���fVqdS(N(Rn(RGtkR`(RkRl(s9/usr/lib64/python2.7/site-packages/mercurial/templater.pys	<genexpr>�s(Rtsortdictt	iteritems(Rf(RkRl(s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytcompiledict�sc@s#g|D]}t|���^qS(N(Rn(RfR`(RkRl(s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytcompilelist�stkeyvaluenodeRtkeynodeR(RpRtsplitargspect
buildargsdictRR�tpoptupdate(
RjRkRltfuncnameR�R�R�t_poskeystvarkeyt_keystoptkeyttreeargstcompargs((RkRls9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR~�scC@stjtd���dS(Ns*can't use a key-value pair in this context(RR'R(Rjtcontent((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytbuildkeyvaluepair�scC@stj|dfS(Ni(R
t
runinteger(RxR1((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRJ�R9cC@stj|dfS(Ni(R
t	runstring(RxR1((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRJ�R9cC@stj|dfS(Ni(R
t	runsymbol(RxR1((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRJ�R9cC@st|d|t�S(Ni(RnR�(RxR1((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRJ�R9cC@st||d��S(NcS@s||S(N((tatb((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRJ�R9(R�(RxR1((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRJ�R9cC@st||d��S(NcS@s||S(N((R�R�((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRJ�R9(R�(RxR1((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRJ�R9cC@st||d��S(NcS@s||S(N((R�R�((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRJ�R9(R�(RxR1((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRJ�R9cC@st||d��S(NcS@s||S(N((R�R�((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRJ�R9(R�(RxR1((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRJ�R9t_aliasrulescB@s5eZdZed�Zee�Zed��ZRS(s2Parsing and expansion rule set of template aliasesstemplate aliascC@s�|ddkr@|dddkr@|ddt|d�fS|ddkr}|dddkr}|dd|dgfSdS(sNReturn (name, args) if tree is func(...) or ...|filter; otherwise
        NoneiRiRiRN(Rp(Rd((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt_trygetfuncs$$(	t__name__t
__module__t__doc__Rt_sectiontstaticmethodRht_parseR�(((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR�scC@stj|�}tj||�S(s'Return new tree of aliases are expanded(R�R�texpand(Rdtaliasestaliasmap((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'"i����i(R+(R2((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt
unquotestrings6tresourcemappercB@s_eZdZejZejd��Zejd��Zejd��Z	ejd��Z
RS(s%Mapper of internal template resourcescC@sdS(sBReturn a set of available resource keys based on the given mappingN((tselfRu((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt
availablekeys&R9cC@sdS(s'Return a set of supported resource keysN((R�((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt	knownkeys*R9cC@sdS(s:Return a resource for the key if available; otherwise NoneN((R�RuRH((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytlookup.R9cC@sdS(scReturn a dict of additional mapping items which should be paired
        with the given new mappingN((R�Rktorigmappingt
newmapping((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytpopulatemap2R9(R�R�R�tabctABCMetat
__metaclass__tabstractmethodR�R�R�R�(((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR�!s	tnullresourcemappercB@s,eZd�Zd�Zd�Zd�ZRS(cC@st�S(N(tset(R�Ru((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR�8scC@st�S(N(R�(R�((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR�;scC@sdS(N(R%(R�RuRH((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR�>scC@siS(N((R�RkR�R�((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR�As(R�R�R�R�R�R�(((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR�7s			tenginecB@s�eZdZdddd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�ZRS(s�template 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%R{R	tfuncsR}R�t	_defaultst
_resourcest_cachet
_tmplcache(R�tloadertfilterstdefaultst	resources((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt__init__Xs							c@ss�jj���jj|�����fd�|j�D�}|j|�|j�jj�||��|S(sfCreate combined mapping from the original mapping and partial
        mapping to override the originalc@sCi|]9\}}|�ks6�j�j|��r||�qS((t
isdisjointt_defaultrequires(RGR�tv(tknownrestnewresR�(s9/usr/lib64/python2.7/site-packages/mercurial/templater.pys
<dictcomp>ns		(R�R�R�R�R�R�(R�R�R�Ru((R�R�R�s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt
overlaymapgs"
cC@s?|jj|�}|dks+t|�r/dSt|dd�S(s?Resource keys required by the specified default symbol functiont	_requiresN(((R�tgetR%tcallabletgetattr(R�RHR�((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR�vscC@sRd}||jj�kr-|j|�}n|dkrN|jj|�}n|S(s:Resolve symbol to value or function; None if nothing foundN(R%R�R�R�R�(R�RuRHR�((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(R�R�(R�Ru((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytavailableresourcekeys�scC@s
|jj�S(s'Return a set of supported resource keys(R�R�(R�((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytknownresourcekeys�scC@sA|jj||�}|dkr=tjtd�|��n|S(sNReturn internal data (e.g. cache) used for keyword/function
        evaluations#template resource not available: %sN(R�R�R%R
tResourceUnavailableR(R�RuRHR�((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytresource�s
cC@ss||jkrh|j|�}t|f|j|<yt||t�|j|<Wqh|j|=�qhXn|j|S(s!load, parse, and cache a template(R�R�RvRnRq(R�RmR`((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRr�s

cC@sB||jkr7t|�}t||t�|j|<n|j|S(s"Parse and cache a literal template(R�RRRnRq(R�R=R`((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR��scC@s1y|j|�tSWntjk
r,tSXdS(s:Load, parse, and cache the specified template if availableN(RrtTrueR
tTemplateNotFoundtFalse(R�Rm((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytpreload�s

cC@s(|j|�\}}|j|||�S(s�Perform expansion. t is name of map element to expand.
        mapping contains added elements for use during expansion. Is a
        generator.(Rrt_expand(R�RmRuRR3((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytprocess�scC@s(|j|�\}}|j|||�S(s�Perform expansion over a literal template

        No user aliases will be expanded since this is supposed to be called
        with an internal template string.
        (R�R�(R�R=RuRR3((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR��scC@sS|jj|i|�}|r4|j|�|}ntj||||||��S(N(R�R�R�R
tflatten(R�RR3Rutextramapping((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR��s

	N(R�R�R�R%R�R�R�RR�R�R�RrR�R�R�R�R�(((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR�Ds									
					cC@s�t�}|std�Stj|d�}g}xW|D]O}|jd�}|dd
krdq9n|ddkr9|j|d�q9q9Wd	jt|��S(Ns7no templates found, try `hg debuginstall` for more infoiRi����torigtrejsmap-cmdlineis, (R�R�(t
templatepathsRtostlistdirtsplitR;tjointsorted(tpathstdirlistt	stylelisttfileR�((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR��s	

cC@s�tjj|�sAtjtd�|dtd�t���ntjj|�}tjdt	��}|j
|didd6�i}i}g}|jdd�}|r�|d	d
kr�tj
tjj||��}tjj|�swx�t	�D]z}tj
tjj||��}	tjj|	�r6|	}Pntj
tjj|	d��}
tjj|
�r�|
}Pq�q�Wnt|�\}}}nx�|dj�D]�\}}|s�tjtd�|jd|���n|d	d
kr7|d	|d
kr$tjtd�|jd|���nt|�||<q�|dkr�tjj||�||<q�q�W|j|dj��|||fS(s.Load template elements from the given map filesstyle '%s' not foundRVsavailable styles: %stincludepathstremapt	templatesR9t__base__is'"tmaps
missing valuei����sunmatched quotest
templatealias(R�tpathtexistsRRtRR�tdirnameRR�treadR�RtnormpathR�tisfilet_readmapfiletitemsR'tsourceR�textend(tmapfiletbasetconftcachettmapR�RAR�RYtp2tp3RH((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR�sH R�cB@sDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(s2Load template fragments optionally from a map filecC@sC|dkri}n|j�|_i|_tj|�|_dS(N(R%tcopyR	t_mapR�R�t	_aliasmap(R�R	R�((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR�
s
		cC@s||jkp||jkS(N(R	R(R�RH((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt__contains__scC@s�||jkr�y!tj|j|�|j|<Wq�tk
re}tjtd�|jd��q�t	k
r�}td�|j|t
j|jd�f}t	|jdtj
|���q�Xn|j|j|�S(s?Get parsed tree for the given template name. Use a local cache.s"%s" not in template mapistemplate file %s: %si(R	RtreadfileRtKeyErrorR
R�RRStIOErrorRtforcebytestrRtstrfromlocalR�(R�RmR\treason((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytloads!	
&cC@s1t|�}|jr-tj|j|�}n|S(N(RRRR�R�(R�R=R`((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR�&s	cC@sJ|s
dS|d}|dkr�|d}||dkr>dS|dj|�||jksm||jkr�|j|j|�|�ndS|ddhkr�dS|dkr�|djt|d��|j|d|�dS|dkr!|djt|d��|j|d|�dSx"|dD]}|j||�q,WdS(	NiRiRRRiR(taddR	Rt_findsymbolsusedRRo(R�RdtsymsReR2R`((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR,s.

cC@s/t�t�f}|j|j|�|�|S(s�Look up (keywords, filters/functions) referenced from the name
        template 't'

        This may load additional templates from the map file.
        (R�RR(R�RmR((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytsymbolsusedGs(	R�R�R�R�RRR�RR(((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR�
s					t	templatercB@s�eZdddddddd�Zeddddddd��Zd�Zed��Zed��Z	ed��Z
d�Zd	�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(RR�R
R�R�R�R�Rt_proct	_minchunkt	_maxchunk(	R�R�R�R�R	R�tminchunktmaxchunkt
allfilters((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR�SscC@sk|||||g||�}t|�\}}	}
|jjj|�|	|j_tj|
�|j_|S(s,Create templater from the specified map file(RR�R	R�RR�R�R(tclsRR�R�R�R	R R!RmR
R�((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytfrommapfileiscC@s
||jkS(N(R�(R�RH((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyRtscC@s
|jjS(N(R�R	(R�((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR	wscC@s
|jjS(N(RR{(R�((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR{|scC@s
|jjS(N(RR�(R�((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR��scC@s|jj|�S(s?Get parsed tree for the given template name. Use a local cache.(R�R(R�Rm((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR�scC@s
|jd�S(s�Look 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.pytsymbolsuseddefault�scC@s|jj|�S(s�Look up (keywords, filters/functions) referenced from the name
        template 't'

        This may load additional templates from the map file.
        (R�R(R�Rm((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR�scC@s|jd|�S(s?Render the default unnamed template and return result as stringR9(trender(R�Ru((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt
renderdefault�scC@sdj|j||��S(s?Render the specified named template and return result as stringR9(R�tgenerate(R�RmRu((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(RR�RRtincreasingchunksR(R�RmRutstream((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR(�s
	N((R�R�R%R�tclassmethodR$RtpropertyR	R{R�RR%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�(R�R�RR�Rtdatapathtisdir(tpathsrelR�R�RY((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyR��s	4cC@sCx<t�D]1}tjj||�}tjj|�r
|Sq
WdS(s<return location of template file. returns None if not found.N(R�R�R�R�R�R%(tnameRYR�((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyttemplatepath�s
cC@s>|dkrt�}nt|t�r3|g}nt|t�rN|g}nx�|D]�}|sU|tjtjfksUtj|ksUtjr�tj|kr�qUnt	j
j|d�d|g}|jd�xP|D]H}x?|D]7}t	j
j||�}t	j
j
|�r�||fSq�Wq�WqUWtd|��dS(s�Return path to mapfile for a given style.

    Searches mapfile in the following locations:
    1. templatepath/style/map
    2. templatepath/map-style
    3. templatepath/map
    R�smap-sNo hgweb templates found in %rN(R%R�RatbytesRtoscurdirtospardirtosseptosaltsepR�R�R�R;RtRuntimeError(tstylesR�tstylet	locationsR�tlocationR((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pytstylemap�s(	



(R
iR(RiR(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(iNNNN(iRNNN(iRNNN(iRNNN(iR NNN(iNNNN(?R�t
__future__RRR�R�ti18nRR9RRRRRRR	R
RtutilsRR%ROR8R&R�RDR:R_RRRhRiRnRoRpRsRvRzR�R�R�R�R�R�R~R�R�R
RqtbasealiasrulesR�R�R�tobjectR�R�R�R�RR�RR�R2R=(((s9/usr/lib64/python2.7/site-packages/mercurial/templater.pyt<module>7s�@
_7	"																%	







		
�		/GX