##// END OF EJS Templates
templater: changeset templater reorganization and optimizations
Matt Mackall -
r3642:b2c47652 default
parent child Browse files
Show More
@@ -157,6 +157,7 b' def stringify(thing):'
157 '''turn nested template iterator into string.'''
157 '''turn nested template iterator into string.'''
158 if hasattr(thing, '__iter__'):
158 if hasattr(thing, '__iter__'):
159 return "".join([stringify(t) for t in thing])
159 return "".join([stringify(t) for t in thing])
160 if thing is None: return ""
160 return str(thing)
161 return str(thing)
161
162
162 para_re = None
163 para_re = None
@@ -382,18 +383,8 b' class changeset_templater(object):'
382 yield showlist('branch', [branch], plural='branches', **args)
383 yield showlist('branch', [branch], plural='branches', **args)
383 # add old style branches if requested
384 # add old style branches if requested
384 if brinfo and changenode in brinfo:
385 if brinfo and changenode in brinfo:
385 for x in showlist('branch', brinfo[changenode],
386 yield showlist('branch', brinfo[changenode],
386 plural='branches', **args):
387 plural='branches', **args)
387 yield x
388
389 if self.ui.debugflag:
390 def showmanifest(**args):
391 args = args.copy()
392 args.update(dict(rev=self.repo.manifest.rev(changes[0]),
393 node=hex(changes[0])))
394 yield self.t('manifest', **args)
395 else:
396 showmanifest = ''
397
388
398 def showparents(**args):
389 def showparents(**args):
399 parents = [[('rev', log.rev(p)), ('node', hex(p))]
390 parents = [[('rev', log.rev(p)), ('node', hex(p))]
@@ -402,12 +393,10 b' class changeset_templater(object):'
402 if (not self.ui.debugflag and len(parents) == 1 and
393 if (not self.ui.debugflag and len(parents) == 1 and
403 parents[0][0][1] == rev - 1):
394 parents[0][0][1] == rev - 1):
404 return
395 return
405 for x in showlist('parent', parents, **args):
396 return showlist('parent', parents, **args)
406 yield x
407
397
408 def showtags(**args):
398 def showtags(**args):
409 for x in showlist('tag', self.repo.nodetags(changenode), **args):
399 return showlist('tag', self.repo.nodetags(changenode), **args)
410 yield x
411
400
412 def showextras(**args):
401 def showextras(**args):
413 extras = changes[5].items()
402 extras = changes[5].items()
@@ -417,26 +406,29 b' class changeset_templater(object):'
417 args.update(dict(key=key, value=value))
406 args.update(dict(key=key, value=value))
418 yield self.t('extra', **args)
407 yield self.t('extra', **args)
419
408
409 def showcopies(**args):
410 c = [{'name': x[0], 'source': x[1]} for x in copies]
411 return showlist('file_copy', c, plural='file_copies', **args)
412
420 if self.ui.debugflag:
413 if self.ui.debugflag:
421 files = self.repo.status(log.parents(changenode)[0], changenode)[:3]
414 files = self.repo.status(log.parents(changenode)[0], changenode)[:3]
422 def showfiles(**args):
415 def showfiles(**args):
423 for x in showlist('file', files[0], **args): yield x
416 return showlist('file', files[0], **args)
424 def showadds(**args):
417 def showadds(**args):
425 for x in showlist('file_add', files[1], **args): yield x
418 return showlist('file_add', files[1], **args)
426 def showdels(**args):
419 def showdels(**args):
427 for x in showlist('file_del', files[2], **args): yield x
420 return showlist('file_del', files[2], **args)
421 def showmanifest(**args):
422 args = args.copy()
423 args.update(dict(rev=self.repo.manifest.rev(changes[0]),
424 node=hex(changes[0])))
425 return self.t('manifest', **args)
428 else:
426 else:
429 def showfiles(**args):
427 def showfiles(**args):
430 for x in showlist('file', changes[3], **args): yield x
428 yield showlist('file', changes[3], **args)
431 showadds = ''
429 showadds = ''
432 showdels = ''
430 showdels = ''
433
431 showmanifest = ''
434 copies = [{'name': x[0], 'source': x[1]}
435 for x in copies]
436 def showcopies(**args):
437 for x in showlist('file_copy', copies, plural='file_copies',
438 **args):
439 yield x
440
432
441 defprops = {
433 defprops = {
442 'author': changes[1],
434 'author': changes[1],
General Comments 0
You need to be logged in to leave comments. Login now