Mercurial > public > mercurial-scm > hg-stable
diff mercurial/cmdutil.py @ 4352: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 | 10edaed7f909 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Mon Apr 16 13:00:23 2007 -0300 +++ b/mercurial/cmdutil.py Mon Apr 16 13:00:23 2007 -0300 @@ -325,10 +325,14 @@ def __init__(self, ui, repo, patch, brinfo, mapfile, buffered): changeset_printer.__init__(self, ui, repo, patch, brinfo, buffered) - self.t = templater.templater(mapfile, templater.common_filters, - cache={'parent': '{rev}:{node|short} ', - 'manifest': '{rev}:{node|short}', - 'filecopy': '{name} ({source})'}) + filters = templater.common_filters.copy() + filters['formatnode'] = (ui.debugflag and (lambda x: x) + or (lambda x: x[:12])) + self.t = templater.templater(mapfile, filters, + cache={ + 'parent': '{rev}:{node|formatnode} ', + 'manifest': '{rev}:{node|formatnode}', + 'filecopy': '{name} ({source})'}) def use_template(self, t): '''set template string to use'''