##// END OF EJS Templates
templates: define a {onelinesummary} keyword...
Martin von Zweigbergk -
r46480:f67741e8 default
parent child Browse files
Show More
@@ -634,6 +634,19 b' def showobsolete(context, mapping):'
634 634 return b''
635 635
636 636
637 @templatekeyword(b'onelinesummary', requires={b'ui', b'ctx'})
638 def showonelinesummary(context, mapping):
639 """String. A one-line summary for the ctx (not including trailing newline).
640 The default template be overridden in command-templates.oneline-summary."""
641 # Avoid cycle:
642 # mercurial.cmdutil -> mercurial.templatekw -> mercurial.cmdutil
643 from . import cmdutil
644
645 ui = context.resource(mapping, b'ui')
646 ctx = context.resource(mapping, b'ctx')
647 return cmdutil.format_changeset_summary(ui, ctx)
648
649
637 650 @templatekeyword(b'path', requires={b'fctx'})
638 651 def showpath(context, mapping):
639 652 """String. Repository-absolute path of the current file. (EXPERIMENTAL)"""
@@ -114,6 +114,30 b' Check that {phase} works correctly on pa'
114 114 |
115 115 o 0 (public): -1 (public) -1 (public)
116 116
117 Test {onelinesummary}
118
119 $ hg log -G -T '{onelinesummary}'
120 @ 8:95c24699272e tip "third"
121 |
122 o 7:29114dbae42b "second"
123
124 o 6:d41e714fe50d "merge"
125 |\
126 | o 5:13207e5a10d9 "new head"
127 | |
128 o | 4:bbe44766e73d "new branch"
129 |/
130 o 3:10e46f2dcbf4 "no user, no domain"
131 |
132 o 2:97054abb4ab8 "no person"
133 |
134 o 1:b608e9d1a3f0 "other 1"
135 |
136 o 0:1e4e1b8f71e0 "line 1"
137
138 $ hg log -T '{onelinesummary}' -r 0 \
139 > --config command-templates.oneline-summary='{rev} - {desc}'
140 0 - line 1 (no-eol)
117 141
118 142 Keys work:
119 143
General Comments 0
You need to be logged in to leave comments. Login now