comparison mercurial/cmdutil.py @ 4351:051fb8c2567c

command line templates: add formatnode filter This will print a full hash node with --debug and a short one otherwise. Use it with some default templates and in map-cmdline.default to print the parents. This should fix issue538.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Mon, 16 Apr 2007 13:00:23 -0300
parents 3380eb6d7c32
children 1ccd3b9a7b1f
comparison
equal deleted inserted replaced
4350:3380eb6d7c32 4351:051fb8c2567c
323 class changeset_templater(changeset_printer): 323 class changeset_templater(changeset_printer):
324 '''format changeset information.''' 324 '''format changeset information.'''
325 325
326 def __init__(self, ui, repo, patch, brinfo, mapfile, buffered): 326 def __init__(self, ui, repo, patch, brinfo, mapfile, buffered):
327 changeset_printer.__init__(self, ui, repo, patch, brinfo, buffered) 327 changeset_printer.__init__(self, ui, repo, patch, brinfo, buffered)
328 self.t = templater.templater(mapfile, templater.common_filters, 328 filters = templater.common_filters.copy()
329 cache={'parent': '{rev}:{node|short} ', 329 filters['formatnode'] = (ui.debugflag and (lambda x: x)
330 'manifest': '{rev}:{node|short}', 330 or (lambda x: x[:12]))
331 'filecopy': '{name} ({source})'}) 331 self.t = templater.templater(mapfile, filters,
332 cache={
333 'parent': '{rev}:{node|formatnode} ',
334 'manifest': '{rev}:{node|formatnode}',
335 'filecopy': '{name} ({source})'})
332 336
333 def use_template(self, t): 337 def use_template(self, t):
334 '''set template string to use''' 338 '''set template string to use'''
335 self.t.cache['changeset'] = t 339 self.t.cache['changeset'] = t
336 340