Commit Graph

121 Commits

Author SHA1 Message Date
Matt Mackall
d55a703a7d templater: pull in functions defined in templatefilters 2012-09-24 15:28:04 -05:00
Matt Mackall
e32befe1a7 templater: add if/ifeq conditionals 2012-09-24 15:26:56 -05:00
Matt Mackall
0aa788b5f2 templater: add sub() function 2012-09-24 15:26:17 -05:00
Matt Mackall
07ad449236 templater: correctly deal with r"" strings 2012-09-24 15:24:27 -05:00
Matt Mackall
01ed21300f template: add join function
This allows:

{join(files % "{files}", ", ") }\n

to produce a properly comma-separated list
2012-09-22 13:04:36 -05:00
Matt Mackall
bf4fb1e322 templater: factor out runtemplate method
As a side-effect, this makes the output of runmap non-flattened
2012-09-22 13:02:33 -05:00
Matt Mackall
0dd30183db templating: make new-style templating features work with command line lists 2012-09-21 18:54:00 -05:00
Neil Kodner
68912667a4 templater: abort when a template filter raises an exception (issue2987) 2012-08-17 15:12:01 -07:00
Ross Lagerwall
48a670fcaf templater: handle a missing value correctly
Before, using a broken style such as:
changeset =
would result in a traceback.

This fixes a regression introduced in 47618355ffc8.
2012-08-04 14:37:17 +02:00
Brodie Rao
a7ef0a0cc5 cleanup: "not x in y" -> "x not in y" 2012-05-12 16:00:57 +02:00
Augie Fackler
2e41c2e64a globally: use safehasattr(x, '__iter__') instead of hasattr(x, '__iter__') 2011-07-25 15:30:19 -05:00
Augie Fackler
fdd2f9d735 globally: use safehasattr(x, '__call__') instead of hasattr(x, '__call__') 2011-07-25 16:24:37 -05:00
Augie Fackler
c1bfd9e71f windows: check util.mainfrozen() instead of ad-hoc checks everywhere 2011-07-25 16:14:02 -05:00
Matt Mackall
4257ca8615 templater: use a global funcs table 2011-07-23 14:33:35 -05:00
Dan Villiom Podlaski Christiansen
511c941422 prevent transient leaks of file handle by using new helper functions
These leaks may occur in environments that don't employ a reference
counting GC, i.e. PyPy.

This implies:
 - changing opener(...).read() calls to opener.read(...)
 - changing opener(...).write() calls to opener.write(...)
 - changing open(...).read(...) to util.readfile(...)
 - changing open(...).write(...) to util.writefile(...)
2011-05-02 10:11:18 +02:00
Bernhard Leiner
baf797018e revset: report a parse error if a revset is not parsed completely (issue2654) 2011-03-16 23:09:14 +01:00
Matt Mackall
a892ad5a23 templater: clarify engine caching 2010-12-22 13:16:03 -06:00
Matt Mackall
0b9296f805 templater: use the parser.py parser to extend the templater syntax 2010-12-20 12:09:00 -06:00
Matt Mackall
39437f5a68 templater: give slightly nicer error for unknown map entries 2010-12-20 12:09:00 -06:00
Wagner Bruna
40109aa29c templater: fix variable name
'format' was renamed to 'parsed' in ec66346c8238
2010-11-18 19:52:58 -02:00
Dan Villiom Podlaski Christiansen
a1632cd61b templater: add a few comments. 2010-09-21 23:55:32 +02:00
Dirkjan Ochtman
64bb18f0dd cleanups: undefined variables 2010-06-08 09:30:45 +02:00
Matt Mackall
bb539b800d templater: drop \ when handling escaped { 2010-04-05 15:25:08 -05:00
Matt Mackall
d5c8978fe3 templater: strip whitespace inside template methods 2010-04-05 15:25:08 -05:00
Matt Mackall
0c19c19e10 templater: drop raw method 2010-04-05 15:25:08 -05:00
Matt Mackall
484c6d04d0 templater: raise nested functions 2010-04-05 15:25:08 -05:00
Matt Mackall
92fd5b132b templater: use recursive flattening
This avoids slow list operations compared to the iterative version
2010-04-05 15:25:08 -05:00
Matt Mackall
7e256edce5 templater: cache self.defaults.get 2010-04-05 15:25:08 -05:00
Matt Mackall
39b48fa1ce templater: privatize class variables 2010-04-05 15:25:08 -05:00
Matt Mackall
8d0693deb8 templater: map -> mapping 2010-04-05 15:25:08 -05:00
Matt Mackall
7834a75f92 templater: extend preparsing
preparse filters and formats and supply functions to apply
2010-04-05 15:25:08 -05:00
Matt Mackall
cefead81fd templater: preparse templates and cache
This breaks templates down into a list of literal and {} groups, with
group types preidentified.
2010-04-05 15:25:08 -05:00
Matt Mackall
7455c67fcd templater: directly parse templates, no regexes 2010-04-05 14:33:41 -05:00
Benoit Boissinot
4371f512b2 fix spaces/identation issues 2010-02-05 18:50:08 +01:00
Matt Mackall
8d99be19f0 many, many trivial check-code fixups 2010-01-25 00:05:27 -06:00
Matt Mackall
cd3ef170f7 Merge with stable 2010-01-19 22:45:09 -06:00
Matt Mackall
595d66f424 Update license to GPLv2+ 2010-01-19 22:20:08 -06:00
Dirkjan Ochtman
c93b170e46 hgweb: don't choke when an inexistent style is requested (issue1901) 2009-11-12 16:39:11 +01:00
Dirkjan Ochtman
2f2b5e0e4f templater: remove support for ## template variables 2009-08-20 10:41:56 +02:00
Patrick Mezard
f32df1c921 Make {file_copies} usable as a --template key
Before this, to display file copies in templates, you had to write something
like {file_copies%filecopy}. For some reason, the {file_copy} subtemplate was
used by default but not defined by default in changeset_templater, while styles
were already using it. Here we define {file_copy} in changeset_templater, and
change the templater to handle formatting strings like {file_copies%filecopy}
with already expanded keys (in this case {file_copies}), for backward
compatibility.
2009-12-13 18:06:24 +01:00
Martin Geisler
e651951731 templater: lowercase error message
Changing this messages should be safe: automated scripts ought to have
debugged their templates and wont grep for this error message.
2009-05-17 16:25:48 +02:00
Matt Mackall
cfe14089d0 templater: replace eval with closure 2009-05-17 18:17:04 -05:00
Dirkjan Ochtman
140e5350fc templater: keep a cache of Python functions for filter expressions 2009-05-17 16:08:47 +02:00
Dirkjan Ochtman
56f023f70e templater: replace regex complexity by simple str containment checks 2009-05-17 16:06:48 +02:00
Dirkjan Ochtman
f421494a6a templater: clean up the process method, separating code paths 2009-05-17 16:05:50 +02:00
Dirkjan Ochtman
43d9564cff some modernization cleanups, forward compatibility 2009-05-13 14:08:39 +02:00
Dirkjan Ochtman
6f7f8e3dec templater: make the templating engine pluggable to some extent 2009-05-12 12:05:19 +02:00
Dirkjan Ochtman
5c6c43b746 templater: provide the standard template filters by default 2009-05-12 12:04:05 +02:00
Simon Heimberg
09ac1e6c92 separate import lines from mercurial and general python modules 2009-04-28 17:40:46 +02:00
Martin Geisler
750183bdad updated license to be explicit about GPL version 2 2009-04-26 01:08:54 +02:00