Commit Graph

13 Commits

Author SHA1 Message Date
Yuya Nishihara
f7d73883e0 formatter: add general way to switch hex/short functions
This seems a bit awkward, but it can avoid duplicates in annotate, tags,
branches and bookmarks.

I guess fm.hexfunc can eventually be removed (or redesigned) when it gets
template backend.
2014-10-03 22:20:02 +09:00
Yuya Nishihara
f8be8539d4 formatter: convert booleans to json
It will be used in branches output.
2014-10-02 23:20:59 +09:00
Yuya Nishihara
9678578b10 formatter: convert float value to json
It will be used to encode ctx.date().
2014-09-17 22:21:01 +09:00
Yuya Nishihara
a0e25a7bf4 formatter: have jsonformatter accept tuple as value
This is necessary for "annotate" to encode ctx.date() in the same manner
as jsonchangeset printer.

It doesn't support list object because keeping mutable object in _item could
be a source of hidden bugs.  Also, I can't think of the use case.
2014-09-17 21:30:22 +09:00
Yuya Nishihara
c8c3f2cd83 formatter: extract function that encode values to json string
This is the stub for tuple support, which will be used to encode ctx.date()
in the same manner as jsonchangeset printer.
2014-09-17 21:15:43 +09:00
Yuya Nishihara
e91eea1470 formatter: correct bool testing which should be __nonzero__ in Python 2 2014-09-17 00:31:03 +09:00
Matt Mackall
8a32bb8140 formatter: add pickle format
This gives convenient Python2 output. Python 3 users will need encoding=bytes.
2014-09-12 18:36:38 -05:00
Matt Mackall
949498b27d formatter: add json formatter 2014-09-12 18:29:29 -05:00
Matt Mackall
be3bc4f866 formatter: make debug style match Python syntax 2014-09-12 19:06:11 -05:00
Matt Mackall
8d7146d630 formatter: add condwrite method
This makes handling conditional output tidier
2012-11-03 14:37:50 -05:00
David M. Carr
9e830e5477 formatter: improve implementation of data method
This alternate syntax was proposed by Bryan O'Sullivan in a review of
441ebe37ceb5.  I haven't been able to measure any particular performance
difference, but the new syntax is more concise and easier to read.
2012-09-20 23:30:59 -04:00
David M. Carr
9b004d69e6 formatter: add base implementation of data method
Previously, nothing was done with the passed in values, which clearly wasn't
the intention.
2012-09-15 22:50:34 -04:00
Matt Mackall
0acc5a5ce3 formatter: add basic formatters 2012-02-20 16:42:47 -06:00