Qc@srddlmZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z dZ ddmfddofd dqfd drfdsdtdugZ dZdZdZdZdZdZdadadZdZdZdZdZdZdZdZd Zd!Z d"Z!dvdwdxdydzd{d|gZ"d1Z#d2Z$d3Z%d4Z&d5Z'd6Z(d7Z)d8Z*d9Z+d:Z,d;Z-d<Z.d=Z/d>Z0d?Z1d@Z2dAZ3dBZ4dCZ5dDZ6i#e dE6edF6edG6edH6edI6edJ6edK6edL6edM6edN6edO6edP6edQ6edR6e dS6e#dT6e$dU6e%dV6e&dW6e'dX6e(dY6e)dZ6e*d[6e+d\6e,d]6e-d^6e.d_6e/d`6e0da6e1db6e2dc6e3dd6e4de6e5df6e6dg6Z7dhZ8diZ9djZ:ie9dk6e:dH6Z;e7j<Z=dS(}i(t_NcCs|jddS(sf:addbreaks: Any text. Add an XHTML "
" tag before the end of every line except the last. s s
(treplace(ttext((s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pyt addbreaks styeariiimtmonthitweekitdaythourtminutei<tsecondic s!dfd}tj}|d}t}||kr~t}tdt||}|tdddkrdSn>tdt||}|tdddkrtj|Sx^tD]V\}}||}|dks|dkr|rd|||Sd |||SqWd S( sy:age: Date. Returns a human-readable date/time difference between the given date/time and the current date/time. cSs|dkr|S|dS(Nits((tttc((s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pytplural s csd|||fS(Ns%d %s((R R (R(s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pytfmt$siiisin the distant futureis %s from nows%s agoN(ttimetFalsetTruetmaxtintt agescalestutilt shortdate( tdateRtnowtthentfuturetdeltaR R tn((Rs=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pytages&      cCstjj|S(s:basename: Any text. Treats the text as a path, and returns the last component of the path after splitting by the path separator (ignoring trailing separators). For example, "foo/bar/baz" becomes "baz" and "foo/bar//" becomes "bar". (tostpathtbasename(R ((s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pyR!;scCs tj|S(st:date: Date. Returns a date in a Unix date format, including the timezone: "Mon Sep 04 15:13:13 2006 0700". (Rtdatestr(R((s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pyt datefilterCscCsY|jd}|dkrdS||d}|jd}|dkrU|| }n|S(s:domain: Any text. Finds the first string that looks like an email address, and extracts just the domain component. Example: ``User `` becomes ``example.com``. t@itit>i(tfind(tauthortf((s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pytdomainIs   cCs tj|S(s:email: Any text. Extracts the first string that looks like an email address. Example: ``User `` becomes ``user@example.com``. (Rtemail(R((s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pyR+WscCstj|jddtS(s:escape: Any text. Replaces the special XML/XHTML characters "&", "<" and ">" with XML entities, and filters out NUL characters. tR%(tcgitescapeRR(R((s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pyR.^sc stdkr3tjdtjatjdanfd}djg|D]1\}}tjdtj |d||^qRS(sfill many paragraphs.s( | \s*[-*]\s*)s +c3sd}xtrtj|}|st|tj}t|}x.d|kry||djry|d8}qLW|| jtj||jtjfVPn||jd!|j dfV|j d}q WdS(Nii( Rtpara_retsearchtunicodetencodingtlentisspacetencodetstarttgrouptend(R6tmtuctexttw(R(s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pyt findparasns  #$R%t twidthN( R/tNonetretcompiletMtspace_retjointsubRtwrap(RR>R<tparatrest((Rs=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pytfillgs   cCs t|dS(s7:fill68: Any text. Wraps the text to fit in 68 columns.iD(RI(R((s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pytfill68scCs t|dS(s7:fill76: Any text. Wraps the text to fit in 76 columns.iL(RI(R((s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pytfill76scCs7y|jtdjdSWntk r2dSXdS(s5:firstline: Any text. Returns the first line of text.is R%N(t splitlinesRtrstript IndexError(R((s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pyt firstlines cCs tj|S(sm:hex: Any text. Convert a binary Mercurial node identifier into its long hexadecimal representation. (tnodethex(R((s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pyt hexfilterscCsd|S(st:hgdate: Date. Returns the date as a pair of numbers: "1157407993 25200" (Unix timestamp, timezone offset). s%d %d((R((s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pythgdatescCstj|dS(sW:isodate: Date. Returns the date in ISO 8601 format: "2009-08-18 13:00 +0200". s%Y-%m-%d %H:%M %1%2(RR"(R((s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pytisodatescCstj|dS(s:isodatesec: Date. Returns the date in ISO 8601 format, including seconds: "2009-08-18 13:00:13 +0200". See also the rfc3339date filter. s%Y-%m-%d %H:%M:%S %1%2(RR"(R((s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pyt isodatesecscsP|jt|ddkfd}dj|S(s;indent each non-empty line of text after first with prefix.is c3sbx[tD]M}|}|r7|jr7Vn|V|dksRr dVq q WdS(Nis (txrangetstrip(titl(tendswithnewlinetlinest num_linestprefix(s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pytindenters R%(RLR3RD(RR]R^((RZR[R\R]s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pytindents   cCs|dks$|tks$|tkrAidd6dt6dt6|St|ts_t|trit|St|trt|tjd}dt |St|trdt |St j |dr+g}xC|j D]5\}}dt |t |f}|j|qWdd j|d St j |d r|g}x!|D]}|jt |qJWd d j|d Std|jjdS(NtnulltfalsettrueRs"%s"tkeyss%s: %st{s, t}t__iter__t[t]scannot encode type %s(R?RRt isinstanceRtfloattstrR1R2t jsonescapeRt safehasattrt iteritemstjsontappendRDt TypeErrort __class__t__name__(tobjtutouttktvR RX((s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pyRos*$  cCs(t|dkr|Sdt|SdS(Nis\u%04x(tord(R ((s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pyt_uescapess\s\\t"s\"s s\ts s\ns s\rs s\fss\bcCs@x&tD]\}}|j||}qWdjd|DS(NR%css|]}t|VqdS(N(Rz(t.0R ((s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pys s(t_escapesRRD(R RwRx((s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pyRlscCs!tj|dtjdfS(s0:localdate: Date. Converts a date to local date.ii(Rt parsedatetmakedate(R((s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pyt localdatescCs |p dS(s=:nonempty: Any text. Returns '(none)' if the string is empty.s(none)((Rk((s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pytnonemptyscCs?t|tjd}djg|D]}dt|^q"S(s]:obfuscate: Any text. Returns the input text rendered as a sequence of XML entities. RR%s&#%d;(R1R2RDRy(RR ((s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pyt obfuscatescCs$d|krdSd|kr dSdS(NRYt lrwxrwxrwxtxs -rwxr-xr-xs -rw-r--r--((tflags((s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pyt permissionss   cCskd|kr|S|jd}|dkrH|| jdjddS|jd}|| jddS( s:person: Any text. Returns the name before an email address, interpreting it as per RFC 5322. >>> person('foo@bar') 'foo' >>> person('Foo Bar ') 'Foo Bar' >>> person('"Foo Bar" ') 'Foo Bar' >>> person('"Foo "buz" Bar" ') 'Foo "buz" Bar' >>> # The following are invalid, but do exist in real-life ... >>> person('Foo "buz" Bar ') 'Foo "buz" Bar' >>> person('"Foo Bar ') 'Foo Bar' R$t((s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pytfillfuncs"(2 cCsdt|kodkns:tjtdn|dd|||dd}t|dkrt|dd|||dd}tj||Stj|S(Niis!date expects one or two argumentsi(R3RRRRRR"(RRRRR((s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pytdatefuncs""(RIiQi3iQi'iQi: iQ(Ri(R i<(R i(s\s\\(R{s\"(s s\t(s s\n(s s\r(s s\f(ss\b(>ti18nRR-R@RRRR2RPRRRRRRR!R#R*R+R.R?R/RCRIRJRKRORRRSRTRUR_RoRzR}RlRRRRRRRRRRRRRWRRRRRRtfiltersRRRtfuncstvaluest i18nfunctions(((s=/sys/lib/python2.7/site-packages/mercurial/templatefilters.pyts<0