##// END OF EJS Templates
templater: port formatnode filter from changeset_templater...
Yuya Nishihara -
r31169:48a8b2e5 default
parent child Browse files
Show More
@@ -1442,8 +1442,6 b' class changeset_templater(changeset_prin'
1442 1442
1443 1443 def __init__(self, ui, repo, matchfn, diffopts, tmpl, mapfile, buffered):
1444 1444 changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered)
1445 formatnode = ui.debugflag and (lambda x: x) or (lambda x: x[:12])
1446 filters = {'formatnode': formatnode}
1447 1445 defaulttempl = {
1448 1446 'parent': '{rev}:{node|formatnode} ',
1449 1447 'manifest': '{rev}:{node|formatnode}',
@@ -1455,11 +1453,10 b' class changeset_templater(changeset_prin'
1455 1453 defaulttempl['filecopy'] = defaulttempl['file_copy']
1456 1454 assert not (tmpl and mapfile)
1457 1455 if mapfile:
1458 self.t = templater.templater.frommapfile(mapfile, filters=filters,
1456 self.t = templater.templater.frommapfile(mapfile,
1459 1457 cache=defaulttempl)
1460 1458 else:
1461 1459 self.t = formatter.maketemplater(ui, 'changeset', tmpl,
1462 filters=filters,
1463 1460 cache=defaulttempl)
1464 1461
1465 1462 self.cache = {}
@@ -544,6 +544,19 b' def fill(context, mapping, args):'
544 544
545 545 return templatefilters.fill(text, width, initindent, hangindent)
546 546
547 @templatefunc('formatnode(node)')
548 def formatnode(context, mapping, args):
549 """Obtain the preferred form of a changeset hash. (DEPRECATED)"""
550 if len(args) != 1:
551 # i18n: "formatnode" is a keyword
552 raise error.ParseError(_("formatnode expects one argument"))
553
554 ui = mapping['ui']
555 node = evalstring(context, mapping, args[0])
556 if ui.debugflag:
557 return node
558 return templatefilters.short(node)
559
547 560 @templatefunc('pad(text, width[, fillchar=\' \'[, left=False]])')
548 561 def pad(context, mapping, args):
549 562 """Pad text with a
General Comments 0
You need to be logged in to leave comments. Login now