Ë Îðxûê³Wãó–—dZddlZddlZddlZddlZddlmZddlmZm Z ddl m Z ddl m Z mZmZmZmZmZmZddlmZmZmZd „ZGd „d «ZGd „d «Zd„ZGd„de«Zd„ZGd„d«ZGd„de«ZGd„de«Z Gd„de«Z!Gd„de«Z"Gd„de«Z#Gd„d«Z$Gd „d!e«Z%e jLd"¬#«Gd$„d%««Z'd&„Z(d5d'„Z)d(„Z*d5d)„Z+d*„Z,d+„Z-d6d,„Z.d6d-„Z/e0«Z1Gd.„d/ejd«Z3 d7d0„Z4d1„Z5ejld2„«Z7ejld3„«Z8d4„Z9y)8a~ Generic output formatting for Mercurial The formatter provides API to show data in various ways. The following functions should be used in place of ui.write(): - fm.write() for unconditional output - fm.condwrite() to show some extra data conditionally in plain output - fm.context() to provide changectx to template output - fm.data() to provide extra data to JSON or template output - fm.plain() to show raw text that isn't provided to JSON or template output To show structured data (e.g. date tuples, dicts, lists), apply fm.format*() beforehand so the data is converted to the appropriate data type. Use fm.isplain() if you need to convert or format data conditionally which isn't supported by the formatter API. To build nested structure (i.e. a list of dicts), use fm.nested(). See also https://www.mercurial-scm.org/wiki/GenericTemplatingPlan fm.condwrite() vs 'if cond:': In most cases, use fm.condwrite() so users can selectively show the data in template output. If it's costly to build data, use plain 'if cond:' with fm.write(). fm.nested() vs fm.formatdict() (or fm.formatlist()): fm.nested() should be used to form a tree structure (a list of dicts of lists of dicts...) which can be accessed through template keywords, e.g. "{foo % "{bar % {...}} {baz % {...}}"}". On the other hand, fm.formatdict() exports a dict-type object to template, which can be accessed by e.g. "{get(foo, key)}" function. Doctest helper: >>> def show(fn, verbose=False, **opts): ... import sys ... from . import ui as uimod ... ui = uimod.ui() ... ui.verbose = verbose ... ui.pushbuffer() ... try: ... return fn(ui, ui.formatter(pycompat.sysbytes(fn.__name__), ... pycompat.byteskwargs(opts))) ... finally: ... print(pycompat.sysstr(ui.popbuffer()), end='') Basic example: >>> def files(ui, fm): ... files = [(b'foo', 123, (0, 0)), (b'bar', 456, (1, 0))] ... for f in files: ... fm.startitem() ... fm.write(b'path', b'%s', f[0]) ... fm.condwrite(ui.verbose, b'date', b' %s', ... fm.formatdate(f[2], b'%Y-%m-%d %H:%M:%S')) ... fm.data(size=f[1]) ... fm.plain(b'\n') ... fm.end() >>> show(files) foo bar >>> show(files, verbose=True) foo 1970-01-01 00:00:00 bar 1970-01-01 00:00:01 >>> show(files, template=b'json') [ { "date": [0, 0], "path": "foo", "size": 123 }, { "date": [1, 0], "path": "bar", "size": 456 } ] >>> show(files, template=b'path: {path}\ndate: {date|rfc3339date}\n') path: foo date: 1970-01-01T00:00:00+00:00 path: bar date: 1970-01-01T00:00:01+00:00 Nested example: >>> def subrepos(ui, fm): ... fm.startitem() ... fm.write(b'reponame', b'[%s]\n', b'baz') ... files(ui, fm.nested(b'files', tmpl=b'{reponame}')) ... fm.end() >>> show(subrepos) [baz] foo bar >>> show(subrepos, template=b'{reponame}: {join(files % "{path}", ", ")}\n') baz: foo, bar éNé)Ú_)ÚhexÚshort)Úattr)ÚerrorÚpycompatÚtemplatefiltersÚ templatekwÚ templaterÚ templateutilÚutil)ÚcborutilÚdateutilÚ stringutilc ó`—t|td«ttttt f«S)zåCheck if the given object can be directly passed in to formatter's write() and data() functions Returns False if the object is unsupported or must be pre-processed by formatdate(), formatdict(), or formatlist(). N)Ú isinstanceÚtypeÚboolÚintÚfloatÚbytes)Úobjs ú7usr/lib/python3.12/site-packages/mercurial/formatter.pyÚ isprintabler‰s"€ô �cœD ›J¬¬c´3¼¼uÐEÓ FÐFócóT—eZdZdZdZed„«Zed„«Zed„«Zed„«Z y)Ú_nullconverterz=convert non-primitive data types to be processed by formatterFcó—|S)z$wrap nested data by appropriate type©©ÚdataÚtmplÚseps rÚ wrapnestedz_nullconverter.wrapnested™s €ðˆ rcó&—|\}}t|«|fS©z(convert date tuple to appropriate format)r)ÚdateÚfmtÚtsÚtzs rÚ formatdatez_nullconverter.formatdatežs€ð‰ˆˆBÜ�B“˜ˆ}Ðrcó—t|«S©z:convert dict or key-value pairs to appropriate dict format)Údict)r"ÚkeyÚvaluer)r$s rÚ formatdictz_nullconverter.formatdict¥s€ô �D‹zÐrcó—t|«S©z+convert iterable to appropriate list format)Úlist)r"Únamer)r$s rÚ formatlistz_nullconverter.formatlist¬s€ô�D‹zÐrN© Ú__name__Ú __module__Ú __qualname__Ú__doc__Ú storecontextÚ staticmethodr%r,r2r7r rrrr“sZ„ÙGð€Làñóððñóðð ñóðð ñóñrrcó~—eZdZdZd„Zd„Zd„Zd„Zd„Zdd„Z dd „Z dd „Z d „Z d „Z d „Zd„Zd„Zd„Zd„Zdd„Zd„Zy)Ú baseformatterFcó`—||_||_||_||_d|_t |_y©N)Ú_uiÚ_topicÚ_optsÚ _converterÚ_itemrÚhexfunc)ÚselfÚuiÚtopicÚoptsÚ converters rÚ__init__zbaseformatter.__init__¸s,€ØˆŒØˆŒ ؈Œ Ø#ˆŒØˆŒ äˆ� rcó—|SrBr ©rIs rÚ __enter__zbaseformatter.__enter__Ás€Øˆ rcó*—|€|j«yyrB)Úend)rIÚexctypeÚexcvalueÚ tracebacks rÚ__exit__zbaseformatter.__exit__Äs€Ø ˆ?Ø �H‰H�Jð rcó—y)z0show a formatted item once all data is collectedNr rPs rÚ _showitemzbaseformatter._showitemÈó�rcóJ—|j�|j«i|_y)z begin an item in the format listN©rGrYrPs rÚ startitemzbaseformatter.startitemËs€à �:‰:Ð !Ø �N‰NÔ Øˆ� rcó:—|jj||«Sr')rFr,)rIr(r)s rr,zbaseformatter.formatdateÑs€à�‰×)Ñ)¨$°Ó4Ð4rNcó@—|jj|||||«Sr.)rFr2)rIr"r0r1r)r$s rr2zbaseformatter.formatdictÕs€à�‰×)Ñ)¨$°°U¸CÀÓEÐErcó>—|jj||||«Sr4)rFr7)rIr"r6r)r$s rr7zbaseformatter.formatlistÙs€ð�‰×)Ñ)¨$°°c¸3Ó?Ð?rc ó2—tj|«}td„|D««sJ‚|jjrXd|vrd|vr|dj «|d<d|vrd|vr|dj «|d<|jj|«yy)z=insert context objects to be used to render template keywordsc3ó$K—|]}|dv–—Œ y­w)>óctxófctxórepoNr )Ú.0Úks rÚ z(baseformatter.context..âsèø€ÐA¹D°q�1Ð2Ô2¹Dùs‚rdrcreN) r Ú byteskwargsÚallrFr=Ú changectxÚreporGÚupdate)rIÚctxss rÚcontextzbaseformatter.contextßs’€ä×#Ñ# DÓ)ˆÜÑA¹DÓAÔAÐAÐAØ �?‰?× 'Ò 'à˜$‰ 6°Ñ#5Ø# G™}×6Ñ6Ó8��V‘ ؘ‰~ '°Ñ"5Ø $ V¡ × 1Ñ 1Ó 3��W‘ Ø �J‰J× Ñ ˜dÕ #ð (rcó—t«S)z#set of field names to be referenced)ÚsetrPs rÚdatahintzbaseformatter.datahintës €ä‹uˆ rc ód—tj|«}|jj|«y)z8insert data into item that's not shown in default outputN)r rirGrm©rIr"s rr"zbaseformatter.dataïs$€ä×#Ñ# DÓ)ˆØ � ‰ ×ј$Õrcó®—|j«}t|«t|«k(s J||f«‚|jjt ||««y)z3do default text output while assigning data to itemN©ÚsplitÚlenrGrmÚzip)rIÚfieldsÚdeftextÚ fielddatarLÚ fieldkeyss rÚwritezbaseformatter.writeôsF€à—L‘L“Nˆ Ü�9‹~¤ Y£Ò/ÐG°)¸YÐ1GÓGÐ/Ø � ‰ ×Ñœ#˜i¨Ó3Õ4rcó —|j«}t|«t|«k(sJ‚|jjt ||««y)z4do conditional write (primarily for plain formatter)Nrv)rIÚcondrzr{r|rLr}s rÚ condwritezbaseformatter.condwriteús<€à—L‘L“Nˆ Ü�9‹~¤ Y£Ò/Ð/Ð/Ø � ‰ ×Ñœ#˜i¨Ó3Õ4rc ó—y)z$show raw text for non-templated modeNr ©rIÚtextrLs rÚplainzbaseformatter.plainrZrcó—y)zcheck for plain formatter usageFr rPs rÚisplainzbaseformatter.isplains€àrcóœ—g}|jj|||«|j|<t|j|j|«S)z9sub formatter to store nested data in the specified field)rFr%rGÚ_nestedformatterrC)rIÚfieldr#r$r"s rÚnestedzbaseformatter.nesteds?€àˆØ ŸO™O×6Ñ6°t¸TÀ3ÓGˆ� ‰ �5ÑÜ §¡¨$¯/©/¸4Ó@Ð@rcó>—|j�|j«yy)zend output for the formatterNr\rPs rrSzbaseformatter.end s€à �:‰:Ð !Ø �N‰NÕ ð "r)s%a %b %d %H:%M:%S %Y %1%2)skeysvalueNó )Nr�©Nr)r9r:r;Ú strict_formatrNrQrWrYr]r,r2r7rorrr"r~r�r…r‡r‹rSr rrr@r@²sa„ð€Mòòòò?òó 5óFó@ò $òò ò 5ò 5ò 3òóAó rr@có(—t|||t¬«S)zformatter that prints nothing)rM)r@r)rJrKrLs rÚ nullformatterr‘s€ä ˜˜U D´NÔ CÐCrcó—eZdZdZd„Zd„Zy)r‰z6build sub items and store them in the parent formattercóF—tj||di|¬«||_y)Nr)rKrLrM)r@rNÚ_data)rIrJrMr"s rrNz_nestedformatter.__init__s)€Ü×ÑØ �"˜C b°Ið ô ðˆ� rcóN—|jj|j«yrB©r”ÚappendrGrPs rrYz_nestedformatter._showitem!ó€Ø � ‰ ×ј$Ÿ*™*Õ%rN)r9r:r;r<rNrYr rrr‰r‰s„Ù@òó &rr‰cóX—t|t«rt|j««S|S)z'iterate key-value pairs in stable order)rr/ÚsortedÚitems)r"s rÚ _iteritemsrœ%s"€ä�$œÔÜ�d—j‘j“lÓ#Ð#Ø €KrcóT—eZdZdZdZed„«Zed„«Zed„«Zed„«Z y)Ú_plainconverterz(convert non-primitive data types to textFcó,—tjd«‚)Ns%plainformatter should never be nested)rÚProgrammingErrorr!s rr%z_plainconverter.wrapnested1s€ä×$Ñ$Ð%MÓNÐNrcó.—tj||«S)z(stringify date tuple in the given format)rÚdatestr©r(r)s rr,z_plainconverter.formatdate5s€ô×Ñ  cÓ*Ð*rc󖇇—tjЉ€dŠtjŠ|jˆˆfd„t |«D««S)z*stringify key-value pairs separated by seps%s=%sc3óJ•K—|]\}}‰‰|«‰|«fz–—Œy­wrBr )rfrgÚvr)Úprefmts €€rrhz-_plainconverter.formatdict..As,øèø€ð Ù5E©T¨Q°ˆC‘6˜!“9™f Q›iÐ(Õ (Ñ5Eùsƒ #)r ÚidentityÚbytestrÚjoinrœ)r"r0r1r)r$r§s ` @rr2z_plainconverter.formatdict:sHù€ô×"Ñ"ˆØ ˆ;؈CÜ×%Ñ%ˆFØ�x‰xô Ü5?ÀÔ5Eó ó ð rc󄇇—tjЉ€dŠtjŠ|jˆˆfd„|D««S)z#stringify iterable separated by seps%sc3ó4•K—|]}‰‰|«z–—Œy­wrBr )rfÚer)r§s €€rrhz-_plainconverter.formatlist..Lsøèø€Ð6±¨A˜™f Q›i�±ùsƒ)r r¨r©rª)r"r6r)r$r§s ` @rr7z_plainconverter.formatlistEs:ù€ô×"Ñ"ˆØ ˆ;؈CÜ×%Ñ%ˆFØ�x‰xÔ6±Ó6Ó6Ð6rNr8r rrržrž,sZ„Ù2à€LàñOóðOðñ+óð+ðñ óð ðñ7óñ7rržcóH—eZdZdZd„Zd„Zd„Zd„Zd„Zd„Z d„Z d d „Z d „Z y ) Úplainformatterzthe default text output schemecóƇ—tj||||t«|jr t|_n t |_|‰ur|j|_yˆfd„|_y)Ncó&•—‰j|«SrB)r~)ÚsrLÚouts €rÚz)plainformatter.__init__..[s ø€¨C¯I©I°a¬Lr) r@rNržÚ debugflagrrHrr~Ú_write©rIrJr³rKrLs ` rrNzplainformatter.__init__RsGø€Ü×јt R¨°´oÔFØ �<Š<܈D�Lä ˆDŒLØ �‰9ØŸ(™(ˆD�Kã8ˆD�Krcó—yrBr rPs rr]zplainformatter.startitem]ó€Ø rc ó—yrBr rts rr"zplainformatter.data`r¹rcó0—|j||zfi|¤ŽyrB©r¶)rIrzr{r|rLs rr~zplainformatter.writecs€Øˆ� ‰ �G˜iÑ'Ñ0¨4Ó0rcó6—|r|j||zfi|¤Žyy)zdo conditional writeNr¼)rIr€rzr{r|rLs rr�zplainformatter.condwritefs"€á Ø ˆD�K‰K˜ )Ñ+Ñ 4¨tÓ 4ð rc ó*—|j|fi|¤ŽyrBr¼rƒs rr…zplainformatter.plainks€Øˆ� ‰ �DÑ!˜DÓ!rcó—y)NTr rPs rr‡zplainformatter.isplainns€ØrNcó—|SrBr )rIrŠr#r$s rr‹zplainformatter.nestedqs€àˆ rcó—yrBr rPs rrSzplainformatter.endur¹rrŽ) r9r:r;r<rNr]r"r~r�r…r‡r‹rSr rrr¯r¯Os2„Ù(ò 9ò ò ò1ò5ò "òóó rr¯có—eZdZd„Zd„Zd„Zy)Údebugformattercóœ—tj||||t«||_|jj d|j z«y)Ns%s = [ )r@rNrÚ_outr~rDr·s rrNzdebugformatter.__init__zs8€Ü×јt R¨°´nÔE؈Œ Ø � ‰ �‰˜  d§k¡kÑ1Õ2rcó€—|jjdtj|jdd¬«z«y)Ns %s, ér)ÚindentÚlevel)rÅr~rÚpprintrGrPs rrYzdebugformatter._showitems-€Ø � ‰ �‰Ø œ:×,Ñ,¨T¯Z©ZÀÈÔKÑ Kõ rcód—tj|«|jjd«y)Ns] ©r@rSrÅr~rPs rrSzdebugformatter.end„s €Ü×ј$ÔØ � ‰ �‰˜ÕrN©r9r:r;rNrYrSr rrrÃrÃys„ò3ò  ó  rrÃcó—eZdZd„Zd„Zd„Zy)ÚpickleformattercóZ—tj||||t«||_g|_yrB)r@rNrrÅr”r·s rrNzpickleformatter.__init__Šs&€Ü×јt R¨°´nÔE؈Œ ؈� rcóN—|jj|j«yrBr–rPs rrYzpickleformatter._showitem�r˜rcóž—tj|«|jjt j |j ««yrB)r@rSrÅr~ÚpickleÚdumpsr”rPs rrSzpickleformatter.end’s-€Ü×ј$ÔØ � ‰ �‰œŸ ™  T§Z¡ZÓ0Õ1rNrÍr rrrÏrωs„òò &ó2rrÏcó"—eZdZdZd„Zd„Zd„Zy)Ú cborformatterz2serialize items as an indefinite-length CBOR arraycóž—tj||||t«||_|jj t j «yrB)r@rNrrÅr~rÚBEGIN_INDEFINITE_ARRAYr·s rrNzcborformatter.__init__šs5€Ü×јt R¨°´nÔE؈Œ Ø � ‰ �‰œ×7Ñ7Õ8rcó’—|jjdjtj|j «««yrŽ)rÅr~rªrÚ streamencoderGrPs rrYzcborformatter._showitemŸs*€Ø � ‰ �‰˜Ÿ™¤×!6Ñ!6°t·z±zÓ!BÓCÕDrcó€—tj|«|jjtj «yrB)r@rSrÅr~rÚBREAKrPs rrSzcborformatter.end¢s$€Ü×ј$ÔØ � ‰ �‰œŸ™Õ'rN)r9r:r;r<rNrYrSr rrrÖrÖ—s„Ù<ò9ò Eó(rrÖcó"—eZdZdZd„Zd„Zd„Zy)Ú jsonformatterTcó�—tj||||t«||_|jj d«d|_y)Nó[T)r@rNrrÅr~Ú_firstr·s rrNzjsonformatter.__init__«s6€Ü×јt R¨°´nÔE؈Œ Ø � ‰ �‰˜Ô؈� rcóÖ—|jrd|_n|jjd«|jjd«d}t|jj ««D]\\}}|rd}n|jjd«t j|d¬«}|jjd||fz«Œ^|jjd«y) NFó,s { Ts, )Úparanoids "%s": %ss })rárÅr~ršrGr›r Újson)rIÚfirstrgr¦Úus rrYzjsonformatter._showitem±sª€Ø �;Š;؈D�Kà �I‰I�O‰O˜DÔ !à � ‰ �‰˜ Ô"؈ܘ4Ÿ:™:×+Ñ+Ó-Ö.‰DˆAˆqÙØ‘à— ‘ —‘ Ô'Ü×$Ñ$ Q°Ô7ˆAØ �I‰I�O‰O˜M¨Q°¨FÑ2Õ 3ð /ð � ‰ �‰˜Õ rcód—tj|«|jjd«y)Nó ] rÌrPs rrSzjsonformatter.endÂs €Ü×ј$ÔØ � ‰ �‰˜Õ!rN)r9r:r;r�rNrYrSr rrrÞrÞ§s„à€Mòò !ó""rrÞcóT—eZdZdZdZed„«Zed„«Zed„«Zed„«Z y)Ú_templateconverterz=convert non-primitive data types to be processed by templaterTcó2—tj|||¬«S)z$wrap nested data by templatable type)r#r$)r Ú mappinglistr!s rr%z_templateconverter.wrapnestedÌs€ô×'Ñ'¨°4¸SÔAÐArcó,—tj|«S)zreturn date tuple)r r(r£s rr,z_templateconverter.formatdateÑs€ô× Ñ  Ó&Ð&rc󎇇‡‡‡—tjt‰««Šˆˆˆˆˆfd„}tj‰‰‰‰|¬«S)zAbuild object that can be evaluated as either plain string or dictc3óD•K—tj‰‰‰‰‰«–—y­wrB)ržr2)r"r)r0r$r1s€€€€€rÚfz(_templateconverter.formatdict..fÛs øèø€Ü!×,Ñ,¨T°3¸¸sÀCÓHÓ Hùsƒ )r0r1r)Úgen)rÚsortdictrœr Ú hybriddict)r"r0r1r)r$rñs````` rr2z_templateconverter.formatdictÖsDü€ô�}‰}œZ¨Ó-Ó.ˆ÷ Ið Iô×&Ñ&Ø �c ¨C°Qô ð rcób‡‡‡‡—t‰«Šˆˆˆˆfd„}tj‰‰‰|¬«S)zAbuild object that can be evaluated as either plain string or listc3óB•K—tj‰‰‰‰«–—y­wrB)ržr7)r"r)r6r$s€€€€rrñz(_templateconverter.formatlist..fçsøèø€Ü!×,Ñ,¨T°4¸¸cÓBÓ Bùsƒ)r6r)rò)r5r Ú hybridlist)r"r6r)r$rñs```` rr7z_templateconverter.formatlistâs-û€ô�D‹zˆ÷ Cô×&Ñ& t°$¸CÀQÔGÐGrNr8r rrrërëÇs\„ÙGà€LàñBóðBðñ'óð'ðñ  óð  ðñHóñHrrëcóP—eZdZdd„Zd„Zd„Zejd„«Zd„Z d„Z y) ÚtemplateformatterNcó—tj||||t«||_|j|_t ||tjt|«tj¬«|_ |r%|jjj|«t||jgd¢«|_t!j"«|_|j'di«y)N©ÚdefaultsÚ resourcesÚcache)ó docheaderó docfooteró separatorrÿ)r@rNrërÅÚrefÚ_trefÚ loadtemplaterr ÚkeywordsÚtemplateresourcesÚ defaulttemplÚ_trþrmÚtemplatepartsmapÚ_partsÚ itertoolsÚcountÚ_counterÚ _renderitem)rIrJr³rKrLÚspecÚoverridetemplatess rrNztemplateformatter.__init__îs«€Ü×јt R¨°Ô6HÔI؈Œ Ø—X‘XˆŒ ÜØ Ø Ü×(Ñ(Ü'¨Ó+Ü×)Ñ)ô  ˆŒñ Ø �G‰G�M‰M× Ñ Ð!2Ô 3Ü&Ø �$—'‘'ÒEó ˆŒ ô"Ÿ™Ó)ˆŒ Ø ×ј rÕ*rcóÒ—|jj«}t|j«x|d<}|dkDr|j di«|j |j |«y)Nsindexrr)rGÚcopyÚnextr rr)rIÚitemÚindexs rrYztemplateformatter._showitemsT€Ø�z‰z�‰Ó ˆÜ!% d§m¡mÓ!4Ð4ˆˆX‰˜Ø �1Š9Ø × Ñ ˜\¨2Ô .Ø ×јŸ™ TÕ*rcó—||jvry|j|}|j«D] \}}|�Œ tj|«||<Œ"|jj |j j||««yrB)r r›r Ú wrappedvaluerÅr~rÚrender)rIÚpartrrrgr¦s rrztemplateformatter._renderitemsm€Ø �t—{‘{Ñ "Ø Ø�k‰k˜$шà—J‘J–L‰DˆAˆq؉yÜ&×3Ñ3°AÓ6��Q’ð!ð � ‰ �‰˜Ÿ™Ÿ™ s¨DÓ1Õ2rcóL—|jj|j«SrB)rÚ symbolsusedrrPs rÚ _symbolsusedztemplateformatter._symbolsuseds€à�w‰w×"Ñ" 4§:¡:Ó.Ð.rcó —|jdS)z5set of field names to be referenced from the templater)rrPs rrrztemplateformatter.datahints€à× Ñ  Ñ#Ð#rcóR—tj|«|jdi«y)Nr)r@rSrrPs rrSztemplateformatter.ends €Ü×ј$ÔØ ×ј rÕ*rrB) r9r:r;rNrYrrÚ propertycacherrrrSr rrrùrùís5„ó+ò&+ò3ð ×Ññ/óð/ò$ó+rrùT)Úfrozencó¾—eZdZej«Zej«Zej«Zejd¬«Zejd¬«Z y)Ú templatespecN)Údefault) r9r:r;rÚibrr#ÚmapfileÚrefargsÚfpr rrr"r"sI„à ˆ$�'‰'‹)€CØ ˆ4�7‰7‹9€D؈d�g‰g‹i€G؈d�g‰g˜dÔ#€GØ ˆ�‰˜Ô �Brr"có—tddd«SrB©r"r rrÚempty_templatespecr*(s€Ü ˜˜d DÓ )Ð)rcó—t|dd|«SrBr))rr&s rÚreference_templatespecr,,s€Ü ˜˜T 4¨Ó 1Ð1rcóJ—t|t«rJd«‚td|d«S)Nstmpl must not be a strr)rÚstrr")r#s rÚliteral_templatespecr/0s'€Ü˜$¤Ô$Ð?Ð&?Ó?Ð $Ü ˜˜T 4Ó (Ð(rcó —t|d||¬«S)N)r'r))rKr%r's rÚmapfile_templatespecr15s€Ü ˜˜t W°Ô 4Ð4rcóN—|s t«Sd|vr t|«S|dvr t|«S|jd«\}}}|dvr8|r6|j d«r%t j |«t||dd¬«Stjj|«d sAt jd |z«xst j|«\}}|r t|||«S|jd |«r t|«S|d k(rM|jtd «t j«z«t!j"td««‚d|vsd|vr°tjj%|«r‘tjj'|«j)d«r)t|tjj+|««St-j.|d«5}|j1«}ddd«t|«St|«S#1swYt|«SxYw)aäFind the template matching the given -T/--template spec 'tmpl' 'tmpl' can be any of the following: - a literal template (e.g. '{rev}') - a reference to built-in template (i.e. formatter) - a map-file name or path (e.g. 'changelog') - a reference to [templates] in config file - a path to raw template file A map file defines a stand-alone template environment. If a map file selected, all templates defined in the file will be loaded, and the template matching the given topic will be rendered. Aliases won't be loaded from user config, but from the map file. If no map file selected, all templates in [templates] section will be available as well as aliases in [templatealias]. ó{>ócborójsonódebugópickleó(>r4r5ó)Néÿÿÿÿ)r&rs map-cmdline.ó templatesslistsavailable styles: %s sspecify a templateó/ó\smap-srb)r*r/r,Ú partitionÚendswithr Ú parseexprÚosÚpathrwÚtry_open_templater1Úconfigr~rÚ stylelistrÚAbortÚisfileÚbasenameÚ startswithÚrealpathrÚ posixfileÚread) rJrKr#ÚfuncÚfsepÚftailÚmapnamer'rñs rÚlookuptemplaterQ9sÜ€ñ( Ü!Ó#Ð#ð ˆt�|Ü# DÓ)Ð)ð Ð6Ñ6Ü% dÓ+Ð+🙠tÓ,Ñ€Dˆ$�Ø Ð!Ñ!¡d¨u¯~©~¸dÔ/CÜ×јDÔ!Ü% d°E¸#¸2°JÔ?Ð?ô �7‰7�=‰=˜Ó ˜qÒ !Ü!×3Ñ3Ø ˜dÑ "ó ò/ä × (Ñ (¨Ó .ñ ˆ�"ñ Ü'¨¨w¸Ó;Ð ;ð ‡y�y�˜tÔ$Ü% dÓ+Ð+à ˆw‚Ø �‰”Ð,Ó-´ ×0CÑ0CÓ0EÑEÔFÜ�k‰kœ!Ð1Ó2Ó3Ð3ð �‰ ˜ ™ ¬2¯7©7¯>©>¸$Ô+?ä �7‰7× Ñ ˜DÓ !× ,Ñ ,¨WÔ 5Ü'¨¬r¯w©w×/?Ñ/?ÀÓ/EÓFÐ FÜ �^‰^˜D %Ô (¨AØ—6‘6“8ˆD÷)ä# DÓ)Ð)ô  Ó %Ð%÷ )ä# DÓ)Ð)ús Ç"HÈH$có䇗|j|ji}|jr|jˆfd„|D««|S|jr"|D]}d|j|fz}|‰vsŒ|||<Œ|S)zCreate a mapping of {part: ref}c3ó0•K—|] }|‰vsŒ||f–—Œy­wrBr )rfÚpÚts €rrhz#templatepartsmap..søèø€Ð<©  1°Q¸!²V˜˜Aœ© ùsƒ � s%s:%s)rr%rm)rrUÚ partnamesÚpartsmaprrs ` rr r {srø€à—‘˜$Ÿ(™(Ð#€HØ ‡|‚|Ø�‰Ó<© Ó<Ô<ð €Oð �ŠÛˆDؘdŸh™h¨Ð-Ñ-ˆCØ�aŠxØ!$�˜’ðð €Orcóò—|jr|jrJ‚|jr8tjj|j|j|||¬«St ||j|||¬«S)zPCreate a templater from either a literal template or loading from a map filerû)r#r%r Ú frommapfiler'Ú maketemplater)rJrrürýrþs rrrˆsq€ð— ’ ˜dŸlšlÐ+Ð +Ø ‡|‚|Ü×"Ñ"×.Ñ.Ø �L‰LØ �G‰GØØØð /ó ð ô Ø ˆD�I‰I °IÀUô ðrcóÞ—|jd«}tj||||¬«}|jjd„|jd«D««|r||jd<|S)z0Create a templater from a string template 'tmpl's templatealias)rürýrþÚaliasesc3óPK—|]\}}|tj|«f–—Œ y­wrB)r Ú unquotestring)rfrgr¦s rrhz maketemplater..Ÿs)èø€ðÙ4P©D¨A¨qˆŒI× #Ñ # AÓ &Ô'Ñ4Pùs‚$&r;r)Ú configitemsr rþrm)rJr#rürýrþr\rUs rrZrZ™si€à�n‰nÐ-Ó.€GÜ×ÑØ Y°eÀWô €Að‡G�G‡N�NñØ46·N±NÀ<Ô4Póôñ ؈�‰�‰ Ø €Hrcó^—eZdZdZdd„Zd„Zd„Zd„Zd„Zd„Z d „Z d „Z d „Z d „Z d „Ze edœZy)rz@Resource mapper designed for the default templatekw and functionNcó—i||dœ|_y)N)ócachereóui)Ú_resmap)rIrJrls rrNztemplateresources.__init__¯s€àØØñ ˆ� rcón—|j«D�chc]}|j||«€Œ|’Œc}Scc}wrB)Ú knownkeysÚ_getsome)rIÚmappingrgs rÚ availablekeysztemplateresources.availablekeys¶s;€à—~‘~Ô'ó Ù'�!¨4¯=©=¸À!Ó+DÑ+PŠAÐ'ñ ð ùò s“2«2có —hd£S)N>rcrcrdrerbórevcacher rPs rrfztemplateresources.knownkeys»s€ÚGÐGrcó–—||j«vry|j||«}|tur|j|||«x}||<|SrB)rfrgÚ _placeholderÚ _loadermap©rIrhr0r¦s rÚlookupztemplateresources.lookup¾sQ€Ø �d—n‘nÓ&Ñ &ØØ �M‰M˜' 3Ó 'ˆØ ” Ñ Ø3˜tŸ™¨sÑ3°D¸'ÓBÐ BˆA�˜‘ ؈rcó.—i}|j|«ri|d<|j|«r-|j|«rtj||d«}||d<d|vr|j|d«r t|d<d|vr|j|d«r t|d<|S)Nrkónodes originalnodercrdópath)Ú _hasnodespecr Ú runsymbolÚ _hasliteralrm)rIroÚ origmappingÚ newmappingrhÚorignodes rÚ populatemapztemplateresources.populatemapÆs €ØˆØ × Ñ ˜ZÔ (Ø#%ˆG�KÑ Ø × Ñ ˜[Ô )¨d×.?Ñ.?À Ô.KÜ#×-Ñ-¨g°{ÀGÓLˆHØ'/ˆG�OÑ $ð ˜Ñ #¨×(8Ñ(8¸ÀWÔ(MÜ*ˆG�F‰OØ ˜*Ñ $¨×)9Ñ)9¸*ÀgÔ)NÜ+ˆG�GÑ Øˆrcób—|j|«}|�|S|jj|«SrB)Úgetrdros rrgztemplateresources._getsomeÕs/€Ø �K‰K˜Ó ˆØ ˆ=؈HØ�|‰|×Ñ Ó$Ð$rcó,—||vxrt||« S)z­A µ A¾A ÁA Á AÁAc#óK—|–—y­wrBr )r–s rÚ _neverendingr™Ws èø€à ƒHùs‚cót—|r,t|j||j|j«St |«S)zÌCreate a formatter backed by file if filename specified, else return the given formatter Must be invoked using the 'with' statement. This will never call fm.end() of the given formatter. )r—rCrDrEr™)r–r•s rÚ maybereopenr›\s/€ñܘRŸV™V X¨r¯y©y¸"¿(¹(ÓCÐCä˜BÓÐrrB)NNN)rrr):r<Ú contextlibr rArÓÚi18nrr„rrÚ thirdpartyrÚrr r r r r rÚutilsrrrrrr@r‘r‰rœržr¯rÃrÏrÖrÞrërùr²r"r*r,r/r1rQr rrZÚobjectrmÚresourcemapperrr�r“Úcontextmanagerr—r™r›r rrÚr¤s‘ðñbóJÛÛ Û å÷õ÷÷ñ÷ñòG÷ñ÷>^ñ^òBDô &�}ô &ò÷ 7ñ 7ôF' �]ô' ôT  �]ô  ô 2�mô 2ô (�Mô (ô "�Mô"÷@#Hñ#HôL/+˜ ô/+ðd€‡�ˆtÔ÷ðóðò*ó2ò)ó 5ò?&òD óó"  ñ ‹x€ ôU˜ ×0Ñ0ôUð~ØØóò2,0ð^ ×Ññóðð ×Ññ óð ó  r