Show More
@@ -155,14 +155,9 b' def age(date):' | |||||
155 |
|
155 | |||
156 | def stringify(thing): |
|
156 | def stringify(thing): | |
157 | '''turn nested template iterator into string.''' |
|
157 | '''turn nested template iterator into string.''' | |
158 | def flatten(thing): |
|
|||
159 |
|
|
158 | if hasattr(thing, '__iter__'): | |
160 |
|
|
159 | return "".join([stringify(t) for t in thing]) | |
161 | for i in flatten(t): |
|
160 | return str(thing) | |
162 | yield i |
|
|||
163 | else: |
|
|||
164 | yield str(thing) |
|
|||
165 | return "".join(flatten(thing)) |
|
|||
166 |
|
161 | |||
167 | para_re = None |
|
162 | para_re = None | |
168 | space_re = None |
|
163 | space_re = None | |
@@ -310,21 +305,6 b' class changeset_templater(object):' | |||||
310 | '''set template string to use''' |
|
305 | '''set template string to use''' | |
311 | self.t.cache['changeset'] = t |
|
306 | self.t.cache['changeset'] = t | |
312 |
|
307 | |||
313 | def write(self, thing, header=False): |
|
|||
314 | '''write expanded template. |
|
|||
315 | uses in-order recursive traverse of iterators.''' |
|
|||
316 | dest = self.dest or self.ui |
|
|||
317 | for t in thing: |
|
|||
318 | if hasattr(t, '__iter__'): |
|
|||
319 | self.write(t, header=header) |
|
|||
320 | elif header: |
|
|||
321 | dest.write_header(t) |
|
|||
322 | else: |
|
|||
323 | dest.write(t) |
|
|||
324 |
|
||||
325 | def write_header(self, thing): |
|
|||
326 | self.write(thing, header=True) |
|
|||
327 |
|
||||
328 | def show(self, rev=0, changenode=None, brinfo=None, copies=[], **props): |
|
308 | def show(self, rev=0, changenode=None, brinfo=None, copies=[], **props): | |
329 | '''show a single changeset or file revision''' |
|
309 | '''show a single changeset or file revision''' | |
330 | log = self.repo.changelog |
|
310 | log = self.repo.changelog | |
@@ -478,6 +458,7 b' class changeset_templater(object):' | |||||
478 | props.update(defprops) |
|
458 | props.update(defprops) | |
479 |
|
459 | |||
480 | try: |
|
460 | try: | |
|
461 | dest = self.dest or self.ui | |||
481 | if self.ui.debugflag and 'header_debug' in self.t: |
|
462 | if self.ui.debugflag and 'header_debug' in self.t: | |
482 | key = 'header_debug' |
|
463 | key = 'header_debug' | |
483 | elif self.ui.quiet and 'header_quiet' in self.t: |
|
464 | elif self.ui.quiet and 'header_quiet' in self.t: | |
@@ -489,7 +470,7 b' class changeset_templater(object):' | |||||
489 | else: |
|
470 | else: | |
490 | key = '' |
|
471 | key = '' | |
491 | if key: |
|
472 | if key: | |
492 |
|
|
473 | dest.write_header(stringify(self.t(key, **props))) | |
493 | if self.ui.debugflag and 'changeset_debug' in self.t: |
|
474 | if self.ui.debugflag and 'changeset_debug' in self.t: | |
494 | key = 'changeset_debug' |
|
475 | key = 'changeset_debug' | |
495 | elif self.ui.quiet and 'changeset_quiet' in self.t: |
|
476 | elif self.ui.quiet and 'changeset_quiet' in self.t: | |
@@ -498,7 +479,7 b' class changeset_templater(object):' | |||||
498 | key = 'changeset_verbose' |
|
479 | key = 'changeset_verbose' | |
499 | else: |
|
480 | else: | |
500 | key = 'changeset' |
|
481 | key = 'changeset' | |
501 |
|
|
482 | dest.write(stringify(self.t(key, **props))) | |
502 | except KeyError, inst: |
|
483 | except KeyError, inst: | |
503 | raise util.Abort(_("%s: no key named '%s'") % (self.t.mapfile, |
|
484 | raise util.Abort(_("%s: no key named '%s'") % (self.t.mapfile, | |
504 | inst.args[0])) |
|
485 | inst.args[0])) |
General Comments 0
You need to be logged in to leave comments.
Login now