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