^cRddlZddlZddlmZddlmZddlmZmZmZm Z ddl m Z m Z Gddej ZGd d ej ZGd d ZGd dZGddeZGddeZGddeeZGddeZGddeeZGddeZGddeZGddeZGdd eZGd!d"eeZGd#d$eZGd%d&eZdRd)ZdSd*Z dTd,Z dUd-Z!d.Z"d/Z# dVd0Z$d1Z%d2Z&d3Z'd4Z(d5Z)d6Z*d7Z+d8Z,d9Z-d:Z.d;Z/dWd<Z0dWd=Z1dWd>Z2dWd?Z3d@Z4dAZ5de.e6e&ee1e7e3iZ8dBZ9dCZ:dDZ;dEZdIZ?dJZ@dKZAdLZBdMZCdNZDdOZEdPZFdQZGdS)YN)_)getattr)errorpycompatsmartsetutil)dateutil stringutilceZdZdS)ResourceUnavailableN__name__ __module__ __qualname__8/usr/lib/python3/dist-packages/mercurial/templateutil.pyr r Drr ceZdZdS)TemplateNotFoundNrrrrrrrrrc`eZdZdZejZejdZejdZ ejdZ ejdZ ejdZ ejdZ ejdZejd Zejd Zejd Zd S) wrappedzObject requiring extra conversion prior to displaying or processing as value Use unwrapvalue() or unwrapastype() to obtain the inner object. cdS)zbTest if the specified item is in self The item argument may be a wrapped object. Nrselfcontextmappingitems rcontainszwrapped.contains+rcdS)zReturn a member item for the specified key The key argument may be a wrapped object. A returned object may be either a wrapped object or a pure value depending on the self type. Nrrrrkeys r getmemberzwrapped.getmember2r!rcdS)zjReturn the smallest item, which may be either a wrapped or a pure value depending on the self typeNrrrrs rgetminzwrapped.getmin;r!rcdS)ziReturn the largest item, which may be either a wrapped or a pure value depending on the self typeNrr's rgetmaxzwrapped.getmax@r!rcdS)zReturn new container of the same type which includes only the selected elements select() takes each item as a wrapped object and returns True/False. Nrrrrselects rfilterzwrapped.filterEr!rcdS)zYield each template mappingNrrrs ritermapszwrapped.itermapsMr!rcdS)zJoin items with the separator; Returns a bytes or (possibly nested) generator of bytes A pre-configured template may be rendered per item if this container holds unprintable items. Nrrrrseps rjoinz wrapped.joinQr!rcdS)zReturn a bytes or (possibly nested) generator of bytes representing the underlying object A pre-configured template may be rendered if the underlying object is not printable. Nrr's rshowz wrapped.showZr!rcdS)z2Return a boolean representation of the inner valueNrr's rtoboolzwrapped.toboolcr!rcdS)zMove the inner value object out or create a value representation A returned value must be serializable by templaterfilters.json(). Nrr's rtovaluezwrapped.tovaluegr!rN)rrr__doc__abcABCMeta __metaclass__abstractmethodr r%r(r*r.r1r5r7r9r;rrrrr"s^ KM        ,,, ,,,     ***         AAA      rrcFeZdZdZejZdZejdZ dS)mappablez:Object which can be converted to a single template mappingc#8K||VdSN)tomapr0s rr1zmappable.itermapsts$jj!!!!!!!rcdS)z2Create a single template mapping representing thisNrr0s rrEzmappable.tomapwr!rN) rrrr<r=r>r?r1r@rErrrrBrBosTDDKM""" AAAAArrBcZeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdS) wrappedbyteszWrapper for byte stringc||_dSrD_valuervalues r__init__zwrappedbytes.__init__  rc6t|||}||jvSrD) stringifyrKrs rr zwrappedbytes.containss '400t{""rcxtjtdtj|jzNs%r is not a dictionaryr ParseErrorrrbytestrrKr#s rr%zwrappedbytes.getmembers5 ' ( (8+;DK+H+H H   rc:|||tSrD_getbyminr's rr(zwrappedbytes.getmin{{7GS111rc:|||tSrDrYmaxr's rr*zwrappedbytes.getmaxr[rc|js!tjtd|t j|jS)Ns empty string)rKrrUrr iterbytestr)rrrfuncs rrYzwrappedbytes._getbysB{ 7"1_#5#566 6tH(55666rcxtjtdtj|jz)Ns%r is not filterablerTr,s rr.zwrappedbytes.filters5 % & &)9$+)F)F F   rcxtjtdtj|jzNs%r is not iterable of mappingsrTr0s rr1zwrappedbytes.itermapss5 / 0 083CDK3P3P P   rcPttj|j|SrD) joinitemsrr`rKr3s rr5zwrappedbytes.joins-dk::C@@@rc|jSrDrJr's rr7zwrappedbytes.show {rc*t|jSrD)boolrKr's rr9zwrappedbytes.toboolsDK   rc|jSrDrJr's rr;zwrappedbytes.tovaluerhrN)rrrr<rNr r%r(r*rYr.r1r5r7r9r;rrrrHrH|s!!###   222222777       AAA!!!rrHcTeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd S) wrappedvaluez2Generic wrapper for pure non-list/dict/bytes valuec||_dSrDrJrLs rrNzwrappedvalue.__init__rOrcTtjtd|jzNs%r is not iterablerrUrrKrs rr zwrappedvalue.contains#q!677$+EFFFrcTtjtd|jzrSrqr#s rr%zwrappedvalue.getmembers#q!:;;dkIJJJrcTtjtd|jzrprqr's rr(zwrappedvalue.getminrrrcTtjtd|jzrprqr's rr*zwrappedvalue.getmaxrrrcTtjtd|jzrprqr,s rr.zwrappedvalue.filterrrrcTtjtd|jzrdrqr0s rr1zwrappedvalue.itermapss* / 0 04; >   rcTtjtd|jzrprqr3s rr5zwrappedvalue.joinrrrcF|jdStj|jSNr)rKrrVr's rr7zwrappedvalue.shows" ; 3 ,,,rc|jdSt|jtr|jSttj|jS)NF)rK isinstancerjrrVr's rr9zwrappedvalue.toboolsF ; 5 dk4 ( ( ; H$T[11222rc|jSrDrJr's rr;zwrappedvalue.tovaluerhrN)rrrr<rNr r%r(r*r.r1r5r7r9r;rrrrmrms<<GGGKKKGGGGGGGGG   GGG--- 333rrmcVeZdZdZddZdZdZdZdZdZ d Z d Z d Z d Z d ZdS)datezWrapper for date tuple%d %dcXtt|\|_|_||_dSrD)mapint _unixtime _tzoffset_showfmt)rrMshowfmts rrNz date.__init__s%*-S%& rcDtjtdNsdate is not iterablerrUrrs rr z date.containsq!899:::rcDtjtd)Nsdate is not a dictionaryrr#s rr%zdate.getmembersq!<==>>>rcDtjtdrrr's rr(z date.getminrrcDtjtdrrr's rr*z date.getmaxrrcDtjtdrrr,s rr.z date.filterrrcDtjtdrrr3s rr5z date.joinrrc.|j|j|jfzSrD)rrrr's rr7z date.shows}???rc |j|jdS)N)sunixtimestzoffsetrrr0s rrEz date.tomaps!^$.IIIrcdSNTrr's rr9z date.toboolstrc|j|jfSrDrr's rr;z date.tovalues//rN)r)rrrr<rNr r%r(r*r.r5r7rEr9r;rrrrrs      ;;;???;;;;;;;;;;;;@@@JJJ00000rrcbeZdZdZddZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdS)hybridaWrapper for list or dict to support legacy template This class allows us to handle both: - "{files}" (legacy command-line-specific list hack) and - "{files % '{file} '}" (hgweb-style with inlining and function support) and to access raw values: - "{ifcontains(file, files, ...)}", "{ifcontains(key, extras, ...)}" - "{get(extras, key)}" - "{files|json}" NcL||_||_||_||_||_dSrD)_gen_values_makemap_joinfmt_keytype)rgenvaluesmakemapjoinfmtkeytypes rrNzhybrid.__init__s)     rcBt||||j}||jvSrD) unwrapastyperrrs rr zhybrid.containss$GWdDMBBt|##rctj|jds!tjt dt ||||j}|||j |S)Ngetnot a dictionary) r safehasattrrrrUrrr _wrapvaluegetr#s rr%zhybrid.getmembersl f55 ;"1%8#9#9:: :7GS$-@@sDL$4$4S$9$9:::rc:|||tSrDrXr's rr(z hybrid.getmin!r[rc:|||tSrDr]r's rr*z hybrid.getmax$r[rc|js!tjtd||j}|||SNsempty sequence)rrrUrr)rrrravals rrYz hybrid._getby'sK| 9"1%6#7#788 8d4<  sC(((rcf|dStj|dr|Std|||jS)Ns_makemap)r r hybriditemr)rr$rs rrzhybrid._wrapvalue-s< ; F  C - - J$S$-888rctjjdr'fdjD}nfdjD}t d|jjjS)NrcZi|]'\}}||$||(Srr).0kvr-rs r z!hybrid.filter..7sMAq6$//!Q//001rcRg|]#}||!|$Srr)rrr-rs r z!hybrid.filter..=s6OOOA18M8M1N1NOaOOOr)r rritemsrrrr)rrrr-rs` ` rr.z hybrid.filter5s  DL& 1 1 P L..00FF POOOOOOOFdFDM4=$-PPPrc#FK|j}|jD]}||VdSrD)rr)rrrxs rr1zhybrid.itermaps@s?-  A'!**      rcFtfdjD|S)Nc3BK|]}|VdSrD)r)rrrs r zhybrid.join..Gs/AAq$--**AAAAAAr)rfrr3s` rr5z hybrid.joinEs*AAAADLAAA3GGGrcx|j}||||dSt|r |S|SN )rr5callablerrrrs rr7z hybrid.showIsBi ;99Wgt44 4 C== 355L rc*t|jSrD)rjrr's rr9z hybrid.toboolRsDL!!!rc|j}tj|dr!fd|DSfd|DS)Nrc:i|]\}}|t|Sr unwrapvalue)rrrrrs rrz"hybrid.tovalue..Ys+OOODAqA{7GQ77OOOrc2g|]}t|Srrrrrrs rrz"hybrid.tovalue..Zs%===Q GWa00===r)rr rr)rrrxss `` rr;zhybrid.tovalueUsc \  B ' ' POOOOOBHHJJOOO O====="====rrD)rrrr<rNr r%r(r*rYrr.r1r5r7r9r;rrrrrs      $$$;;;222222))) 999 Q Q Q HHH""">>>>>rrcTeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd S)rzWrapper for non-list/dict object to support map operation This class allows us to handle both: - "{manifest}" - "{manifest % '{rev}:{node}'}" - "{manifest.rev}" c>||_||_||_||_dSrD)r_keyrKr)rrr$rMrs rrNzhybriditem.__init__fs"    rc6||jSrD)rrr0s rrEzhybriditem.tomapls}}TY'''rc\t|||j}||||SrD) makewrappedrKr )rrrrws rr zhybriditem.containsos+ $+ 6 6zz'7D111rc\t|||j}||||SrD)rrKr%)rrrr$rs rr%zhybriditem.getmemberss+ $+ 6 6{{7GS111rcZt|||j}|||SrD)rrKr(rrrrs rr(zhybriditem.getminw) $+ 6 6xx)))rcZt|||j}|||SrD)rrKr*rs rr*zhybriditem.getmax{rrc\t|||j}||||SrD)rrKr.)rrrr-rs rr.zhybriditem.filters+ $+ 6 6xx&111rc\t|||j}||||SrD)rrKr5)rrrr4rs rr5zhybriditem.joins+ $+ 6 6vvgw,,,rc||j}|tj|jSt |r |S|SrD)rrrVrKrrs rr7zhybriditem.shows?i ;#DK00 0 C== 355L rcZt|||j}|||SrD)rrKr9rs rr9zhybriditem.toboolrrc.t|||jSrD)_unthunkrKr's rr;zhybriditem.tovalues$+666rN)rrrr<rNrEr r%r(r*r.r5r7r9r;rrrrr]s   (((222222******222---***77777rrcbeZdZdZddZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdS)revslistaZWrapper for a smartset (a list/set of revision numbers) If name specified, the revs will be rendered with the old-style list template of the given name by default. The cachekey provides a hint to cache further computation on this smartset. If the underlying smartset is dynamically created, the cachekey should be None. Ncvt|tjsJ||_||_||_||_dSrD)r|rabstractsmartset_repo_revs_namecachekey)rreporevsnamers rrNzrevslist.__init__s;$ 9:::::     rc6t|||}||jvSrD) unwrapintegerr)rrrrrevs rr zrevslist.containss GWd33dj  rcDtjtdNrrr#s rr%zrevslist.getmemberq!455666rcn|}||jSrD)_makehybriditemfuncrrZrrrmakehybriditems rr(zrevslist.getmin/1133~djnn..///rcn|}||jSrD)rrr^rs rr*zrevslist.getmaxrrc||jfd}t|j|dS)Nc,|SrDr)rrr-s rz!revslist.filter..sFF>>!3D3D,E,Er)r)rrr.rr)rrrr-frevsrs ` @rr.zrevslist.filtersN1133 !!"E"E"E"E"EFF E5555rc#`K|}|jD]}||VdSrD) _makemapfuncr)rrrrs rr1zrevslist.itermapssI##%%  A'!**      rc6|fdS)Nc(td||SrD)r)rrs rrz.revslist._makehybriditemfunc..sD!Q88r)r)rrs @rrzrevslist._makehybriditemfuncs###%%88888rc<|j|jrfdSfdS)Nc|d|iSNsctxr)rrrs rrz'revslist._makemapfunc..sdAvtAw7rcd|iSrr)rrs rrz'revslist._makemapfunc..sfd1g.r)rr)rrrs @@rrzrevslist._makemapfuncs;zz  /77777 7.... .rc,t|j|SrD)rfrr3s rr5z revslist.joinsS)))rc|jr(d|jD}t|||j|S|||dS)Ncg|]}d|zS)s%dr)rrs rrz!revslist.show..s3331UQY333rr)rr_showcompatlistr5)rrrsrevss rr7z revslist.showsM : 533 333E"7GTZGG G99Wgt44 4rc*t|jSrD)rjrr's rr9zrevslist.toboolsDJrc|jSrD)rr's rr;zrevslist.tovalues zrNN)rrrr<rNr r%r(r*r.r1rrr5r7r9r;rrrrrs!!!!!!!777000000666  999///***555   rrcJeZdZdZd dZdZdZdZdZd Z d Z d Z d Z dS)_mappingsequencezWrapper for sequence of template mappings This represents an inner template structure (i.e. a list of dicts), which can also be rendered by the specified named/literal template. Template mappings may be nested. Nrc`||tjd||_||_||_dS)Ns$name and tmpl are mutually exclusive)rProgrammingErrorr_tmpl _defaultsep)rrtmplr4s rrNz_mappingsequence.__init__sC   0(7   rcDtjtdNsnot comparablerrs rr z_mappingsequence.containsq!233444rcDtjtdrrr#s rr%z_mappingsequence.getmemberrrcDtjtdrrr's rr(z_mappingsequence.getminrrcDtjtdrrr's rr*z_mappingsequence.getmaxrrcDtjtd)Nsnot filterable without templaterr,s rr.z_mappingsequence.filtersq!CDDEEErc t|}jrfd|D}n8jrfd|D}n!t jt dt||S)Nc3NK|]}j|V dSrD)processrrmrrs rrz(_mappingsequence.join..s3II1 A66IIIIIIrc3NK|]}j|V dSrD)expandrrs rrz(_mappingsequence.join..s3HH!tz155HHHHHHrs not displayable without template)_iteroverlaymapsr1rrrrUrrf)rrrr4mapsiteritemiters`` rr5z_mappingsequence.joins#GWdmmG6L6LMM : KIIIIIIIIHH Z KHHHHHxHHHHH"1%H#I#IJJ J3'''rc:||||jSrD)r5rr's rr7z_mappingsequence.show syy'4+;<<.s@1(({7B22(((r)knownresourcekeysr1 overlaymapappendr)rrrrnmr(r)s ` @@rr;z_mappingsequence.tovalues,,..--((  B##GR00B LL "      rNNr) rrrr<rNr r%r(r*r.r5r7r;rrrrrs555777555555FFF(((===     rrc0eZdZdZdfd ZdZdZxZS) mappinggeneratorzWrapper for generator of template mappings The function ``make(context, *args)`` should return a generator of mapping dicts. rNrcxtt||||||_||_dSrD)superr0rN_make_args)rmakeargsrrr4 __class__s rrNzmappinggenerator.__init__'s8 %%..tT3???  rc(|j|g|jRSrDr3r4r0s rr1zmappinggenerator.itermaps,tz'/DJ////rcFt||SrD) _nonemptyr1r's rr9zmappinggenerator.tobool/sw//000r)rNNrrrrr<rNr1r9 __classcell__r7s@rr0r0 se  0001111111rr0c0eZdZdZdfd ZdZdZxZS) mappinglistz%Wrapper for list of template mappingsNrcjtt||||||_dSrD)r2rArN _mappings)rmappingsrrr4r7s rrNzmappinglist.__init__6s0 k4  ))$c:::!rc*t|jSrD)iterrCr0s rr1zmappinglist.itermaps:DN###rc*t|jSrD)rjrCr's rr9zmappinglist.tobool=rGrr.r=r?s@rrArA3sa//""""""$$$$$$$$$$rrAc:eZdZdZdfd ZdZdZfdZxZS) mappingdictzWrapper for a single template mapping This isn't a sequence in a way that the underlying dict won't be iterated as a dict, but shares most of the _mappingsequence functions. Nchtt|||||_dSrD)r2rJrN_mapping)rrrrr7s rrNzmappingdict.__init__Hs. k4  ))$555 rc|jSrD)rLr0s rrEzmappingdict.tomapLs }rcdSrrr's rr9zmappingdict.toboolOs trcbtt|||dS)Nr)r2rJr;)rrrr7s rr;zmappingdict.tovalueUs([$''//AA!DDrr ) rrrr<rNrEr9r;r>r?s@rrJrJAs        EEEEEEEEErrJc(eZdZdZfdZdZxZS) mappingnonezWrapper for None, but supports map operation This represents None of Optional[mappable]. It's similar to mapplinglist([]), but the underlying value is not [], but None. cXtt|ddSrD)r2rQrN)rr7s rrNzmappingnone.__init__`s' k4  ))$/////rc tgSrD)rFr0s rr1zmappingnone.itermapscs Bxxr)rrrr<rNr1r>r?s@rrQrQYsQ 00000rrQcxeZdZdZddZdZdZdZdZdZ d Z e d Z d Z d Zd ZdZdZdZdS)mappedgeneratoraWrapper for generator of strings which acts as a list The function ``make(context, *args)`` should return a generator of byte strings, or a generator of (possibly nested) generators of byte strings (i.e. a generator for a list of byte strings.) rc"||_||_dSrDr9)rr5r6s rrNzmappedgenerator.__init__os  rcTt|||}||||vSrD)rQr;rs rr zmappedgenerator.containsss,'400t||GW5555rc(|j|g|jRSrDr9r0s rrzmappedgenerator._genwr:rcDtjtdrrr#s rr%zmappedgenerator.getmemberzrrc:|||tSrDrXr's rr(zmappedgenerator.getmin}r[rc:|||tSrDr]r's rr*zmappedgenerator.getmaxr[rc|||}|s!tjtd||Sr)r;rrUr)rrrrars rrYzmappedgenerator._getbysD \\'7 + + 9"1%6#7#788 8tBxxrc#|K||g|RD]/}t|||}|t|r|V0dSrD)rQrH)rrr5r6r-rss r _filteredgenzmappedgenerator._filteredgensdg%%%%  A'7A..Avl1oo&&   rcL||j|j|f}t|j|SrD)r3r4rUr_)rrrr-r6s rr.zmappedgenerator.filters'TZ8t0$777rcDtjtd)Nslist of strings is not mappablerr0s rr1zmappedgenerator.itermapssq!CDDEEErcHt|||SrD)rfrr3s rr5zmappedgenerator.joins7++S111rc0|||dSrz)r5r's rr7zmappedgenerator.showsyy'3///rcFt||SrD)r<rr's rr9zmappedgenerator.tobools7++,,,rcJfd|DS)Nc2g|]}t|Sr)rQrs rrz+mappedgenerator.tovalue..s%KKK1 '7A..KKKr)rr's ``rr;zmappedgenerator.tovalues-KKKKK '8J8JKKKKrN)r)rrrr<rNr rr%r(r*rY staticmethodr_r.r1r5r7r9r;rrrrUrUgs 666000777222222 \ 888FFF222000---LLLLLrrUkeyvaluec|tjdtjt|fdfdS)z>Wrap data to support both dict-like and string-like operationsNs%s=%sc||iSrDr)rdatar$rMs rrzhybriddict..s35$q'*rcB||fzSrDr)rrlfmtprefmts rrzhybriddict..s%#FF47OO44rridentityrVr)rlr$rMrnrros```` @r hybriddictrrs]  F {!   ******444444   rcrtjdtjt||fdfdS)z>Wrap data to support both list-like and string-like operationsNs%sc |iSrDr)rrs rrzhybridlist..s ayrc |zSrDr)rrnros rrzhybridlist..sC&&))Orrp)rlrrnrros `` @r hybridlistrvsJ  F {! #t00002K2K2K2K2K L LLrrc fd|D} t|||| ||} t||| S)zWrap data like hybriddict(), but also supports old-style list template This exists for backward compatibility with the old-style template. Use hybriddict() for new template keywords. c"g|] \}}||i Srr)rrrr$rMs rrzcompatdict..s&5551#q% 555r)r$rMrnr)rrrr) rrrrlr$rMrnplural separatorcfs `` r compatdictr}sZ 65555 555A$69EEA d5cq A A AArcTt||||||}t||p|||S)zWrap data like hybridlist(), but also supports old-style list template This exists for backward compatibility with the old-style template. Use hybridlist() for new template keywords. )rrnr)rrv) rrrrlelementrnryrzr|s r compatlistrs6 $fiHHA dDcq A A AArcdD}t||||d}tjt|fdfdS)zWrap list of (dest, source) file names to support old-style list template and field names This exists for backward compatibility. Use hybriddict for new template keywords. cg|] \}}||d S))namesourcer)rrrs rrz(compatfilecopiesdict..s$77711 # #777rs file_copies)ryc|||dS)N)rpathrrrcopiess rrz&compatfilecopiesdict..sAfQi@@rcd||fzS)Ns%s (%s)rrs rrz&compatfilecopiesdict..s*6!9~-r)rr sortdictr)rrrrr{r|s ` rcompatfilecopiesdictrso 87777A$.IIIA ]6 " "F  @@@@----   rc`t||||}t||dtjS)zWrap list of file names to support old-style list template and field names This exists for backward compatibility. Use hybridlist for new template keywords. c ||dS)N)sfilerr)rs rrz!compatfileslist..sa!44r)rrrrq)rrrfilesr|s rcompatfileslistrs9 $66A  544h6G  rc#K|sdz}|s4d|z}|r|VdSsbt|dtr||Vn-|D]*}t |}||V+dSd|z} | r| Vffd } dz} | r|} nd} |D]}| |V| | | | Vd |z} | r| VdSdS) aNReturn a generator that renders old-style list template name is name of key in template map. values is list of strings or dicts. plural is plural of name, if not simply name + 's'. separator is used to join values as a string expansion works like this, given name 'foo'. if values is empty, expand 'no_foos'. if 'foo' not in template map, return values as a string, joined by 'separator'. expand 'start_foos'. for each value, expand 'foo'. if 'last_foo' in template map, expand it instead of 'foo' for last key. expand 'end_foos'. ssno_Nrsstart_ci} ||nH#tttf$r. |D] \}}|||< n#ttf$r||<YnwxYwYnwxYw|}||SrD)updateAttributeError TypeError ValueErrorr+r)rtagvmappingabrrrs ronez_showcompatlist..one/s # OOA     :6 # # # #$$DAq"#HQKK$z* # # #!" #  #%%gx88sH---s2A  AA AA AA A slast_)rsend_)preloadrr|bytesr5dictrpop)rrrrryrznonamerr startnamerlastnamelastendnames``` rrrs0  & ??6 " " 3//&'22 2 2 2 ??4  fQi ' ' ..(( ( ( ( (  GG!!!F"Iy!!2ooi11111........"$Hx  zz|| c!ff  c$H%%%%%%Gw0oogw///////00rc#rKt|tr|||}t|tr|VdSt|trt jd|z|dStj|dstj |VdS|D]}t|tr|||}t|tr|VG|Jtj|dstj |Vvt|||D]}|VdS)z=Yield a single stream from a possibly nested set of iteratorssHMercurial IO including templates is done with bytes, not strings, got %rNs__iter__) r|rr7rstrrrr rrrVflatten)rrthingijs rrrNs{%!!- 7G,,% E3  $ 027 8       e[ 1 1u%%%%%%%  A!W%% -FF7G,,!U## %a55 &q)))))) '155AGGGG  rcxt|tr|Sdt|||S)zETurn values into bytes by converting into text and concatenating themr)r|rr5rrrrs rrQrQns7% 88GGWe44 5 55rcN |\}}|tur|S|tur |d}ndS%)z`Find symbolic name for the given compiled expression; returns None if nothing found reliablyTrN) runsymbol runfilter)argrarls rfindsymbolicnamerus@ d 9  K Y  q'CC4rcH t|dS#t$rYdSwxYw)NTF)next StopIteration)xiters rr<r<s9 U t uus  !!c\t|tjs|St|||S)z&Evaluate a lazy byte string into value)r|types GeneratorTyperQrs rrrs. eU0 1 1 Wgu - --rc&|\}}||||S)zEvaluate given argument as a bare template object which may require further processing (such as folding generator of strings)r)rrrrarls r evalrawexprs!JD$ 4$ ' ''rcFt|||}t|||S)z)Evaluate given argument to wrapped object)rr)rrrrs r evalwrappedrs% w - -E w / //rct|tr|St|||}t|trt |St |S)zLift object to a wrapped type)r|rrrrHrmrs rrrsX%!! Wgu - -E%#E"""   rc Bt||t|||S)z%Evaluate given argument as value type)rrrrrs r evalfuncargrs wGWc)J)J K KKrczt|tr|||St|||S)z.Move the inner value object out of the wrapper)r|rr;rrs rrrs<%!!/}}Wg... GWe , ,,rc|\}}|tur&||||d}|tj|}n ||||}t|||||S)zCEvaluate given argument as boolean, but also takes boolean literalsNdefault)rr parseboolrr9rrrrarlrs r evalbooleanrsyJD$ yWgtT::: =(..EWgt,, w / / 6 6w H HHrcHt|||}t||||S)z`Evaluate given argument as a date tuple or a date string; returns a (unixtime, offset) tuple)r unwrapdaterrrerrrs revaldaters) w - -E gws 3 33rcPt|tr|||St|||} t j|S#t $r$tj|ptdtj$r|stj|wxYw)Nsnot a date tuple nor a string) r|rr;rr parsedaterrrUrrrrrs rrrs%/}}Wg... % 0 0E$!%((( KKKsIa(H&I&IJJJ  $$$  s###$s AAB%cHt|||}t||||SrD)rrrs r evalintegerrs' w - -E '5# 6 66rct|||} t|S#ttf$r$t j|pt dwxYw)Nsnot an integer)rrrrrrUrrs rrrsc % 0 0E<5zz z "<<<s:a(9&:&:;;;.showrecursions!k!CDDsJKKKrr)r$rs` r_recursivesymbolblockerrs)LLLLL rrc0|||}|P|}t|||< |||}n#t$r|}YnwxYwt |r |||S#t $rYdSwxYw|SrD)symbolcopyrrrrr )rrr$rr safemappings rrrsw$$Ayllnn 2377 C [11AA   AAA {{ 1Wg&& &"   44  Hs$A A&%A&9 B BBc#:K|D]}t|||VdSrD)r)rrtemplaters r runtemplater*s:00'3//////00rc|\}}t|||}t|dd} t||||}||S#tj$r6}tjt |t ||d}~wwxYw)N_intypehint)rrrrrUr_formatfiltererror)rrrlrfiltrintypees rrr/sIC w - -E T9d + +FMWguf==tE{{  MMMuQxx.@d.K.KLLLLMsAB 1BB ctj|j}t|}|st d|zSt d||fzS)Ns(incompatible use of template filter '%s's8template filter '%s' is not compatible with keyword '%s')rsysbytesrrr)rrfnsyms rrr:s`  4= ) )B 3  C C<==BB H I I  M rc#rKt|D]$\}}|||}||d<|V%dS)zuGenerate combined mappings from the original mapping and an iterable of partial mappings to override the originalsindexN) enumerater+)r origmapping newmappingsrr-r)s rr"r"EsV;''2    R 0 08 rc#BK ||}n^#tj$rL}t|}|st d|z}tjt ||d}~wwxYwt |||D]} t|| |VdS)Ns+keyword '%s' does not support map operationr)r1rrUrrrr"r) rrddargtargditerrrrr)s r _applymaprNs6 7##  666t$$  ?@@3FuSzz5555 6 w77,,"d++++++,,sA5AA00A5cb|\}}t|||}tt||||fS)N)r6)rrUr)rrrlrrrs rrunmapr[s8JD$GWd++A 9GQd+C D D DDrc|\}}t|||}t|tr:||||}t |||S ||||S#tj$rL}t|}|std|z} tjt|| d}~wwxYw)Ns.keyword '%s' does not support member operationr) rr|rBr+rErr%rrUrrr) rrrlrmembrr)rrrs r runmemberrasJD$GWd++A!X,   )9)9 : :"d+++6{{7GT222  666t$$  BCCcIuSzz5555 6s'A>>C ACCcFt|||td}| S)Ns"negation needs an integer argument)rrrs r runnegaterqs, $"G H H  D 5Lrc|\}}}t|||td}t|||td} |||S#t$r"tjtdwxYw)Ns#arithmetic only defined on integerssdivision by zero is not defined)rrZeroDivisionErrorrr)rrrlraleftrights r runarithmeticr xsD$ $"H I I  D %#I!J!J  EAtD%   AAAk!>??@@@As  A,A>c#6Kd}|D]}|rd}n|r|V|VdS)z9Join items with the separator; Returns generator of bytesTFNr)r$r4firstrs rrfrfsO E   EE  III r)rhriNNr )rhriNNr)NNNrrrD)r)Hr=ri18nrrrrrr utilsr r rr rrrBrHrmrrrrrr0rArJrQrUrrrvr}rrrrrrQrr<rrrrrrrrrrrrrrrrrrrrrrrrr"rrrrr rfrrrrso        %+        u{   J J J J J J J J Z A A A A A A A A.....7...b+++++7+++\%0%0%0%0%08W%0%0%0PW>W>W>W>W>WW>W>W>t87878787877878787vFFFFFwFFFR<<<<<w<<<~11111'111& $ $ $ $ $" $ $ $EEEEE(,EEE0     ,   :L:L:L:L:Lg:L:L:Lz    MMMM   BBBB4  BBBB&&   <@H0H0H0H0V@666   ...(((000 LLL --- I I I4444 $ $ $ $7777 <<<<JJJ... + 9* &&&    *000 MMM , , ,EEE 6 6 6  A A Ar