Show More
@@ -237,24 +237,28 class _plainconverter(object): | |||
|
237 | 237 | |
|
238 | 238 | class plainformatter(baseformatter): |
|
239 | 239 | '''the default text output scheme''' |
|
240 | def __init__(self, ui, topic, opts): | |
|
240 | def __init__(self, ui, out, topic, opts): | |
|
241 | 241 | baseformatter.__init__(self, ui, topic, opts, _plainconverter) |
|
242 | 242 | if ui.debugflag: |
|
243 | 243 | self.hexfunc = hex |
|
244 | 244 | else: |
|
245 | 245 | self.hexfunc = short |
|
246 | if ui is out: | |
|
247 | self._write = ui.write | |
|
248 | else: | |
|
249 | self._write = lambda s, **opts: out.write(s) | |
|
246 | 250 | def startitem(self): |
|
247 | 251 | pass |
|
248 | 252 | def data(self, **data): |
|
249 | 253 | pass |
|
250 | 254 | def write(self, fields, deftext, *fielddata, **opts): |
|
251 |
self._ |
|
|
255 | self._write(deftext % fielddata, **opts) | |
|
252 | 256 | def condwrite(self, cond, fields, deftext, *fielddata, **opts): |
|
253 | 257 | '''do conditional write''' |
|
254 | 258 | if cond: |
|
255 |
self._ |
|
|
259 | self._write(deftext % fielddata, **opts) | |
|
256 | 260 | def plain(self, text, **opts): |
|
257 |
self._ |
|
|
261 | self._write(text, **opts) | |
|
258 | 262 | def isplain(self): |
|
259 | 263 | return True |
|
260 | 264 | def nested(self, field): |
@@ -411,20 +415,20 def maketemplater(ui, topic, tmpl, cache | |||
|
411 | 415 | t.cache[topic] = tmpl |
|
412 | 416 | return t |
|
413 | 417 | |
|
414 | def formatter(ui, topic, opts): | |
|
418 | def formatter(ui, out, topic, opts): | |
|
415 | 419 | template = opts.get("template", "") |
|
416 | 420 | if template == "json": |
|
417 |
return jsonformatter(ui, |
|
|
421 | return jsonformatter(ui, out, topic, opts) | |
|
418 | 422 | elif template == "pickle": |
|
419 |
return pickleformatter(ui, |
|
|
423 | return pickleformatter(ui, out, topic, opts) | |
|
420 | 424 | elif template == "debug": |
|
421 |
return debugformatter(ui, |
|
|
425 | return debugformatter(ui, out, topic, opts) | |
|
422 | 426 | elif template != "": |
|
423 |
return templateformatter(ui, |
|
|
427 | return templateformatter(ui, out, topic, opts) | |
|
424 | 428 | # developer config: ui.formatdebug |
|
425 | 429 | elif ui.configbool('ui', 'formatdebug'): |
|
426 |
return debugformatter(ui, |
|
|
430 | return debugformatter(ui, out, topic, opts) | |
|
427 | 431 | # deprecated config: ui.formatjson |
|
428 | 432 | elif ui.configbool('ui', 'formatjson'): |
|
429 |
return jsonformatter(ui, |
|
|
430 | return plainformatter(ui, topic, opts) | |
|
433 | return jsonformatter(ui, out, topic, opts) | |
|
434 | return plainformatter(ui, out, topic, opts) |
@@ -263,7 +263,7 class ui(object): | |||
|
263 | 263 | (util.timer() - starttime) * 1000 |
|
264 | 264 | |
|
265 | 265 | def formatter(self, topic, opts): |
|
266 | return formatter.formatter(self, topic, opts) | |
|
266 | return formatter.formatter(self, self, topic, opts) | |
|
267 | 267 | |
|
268 | 268 | def _trusted(self, fp, f): |
|
269 | 269 | st = util.fstat(fp) |
General Comments 0
You need to be logged in to leave comments.
Login now