comparison mercurial/cmdutil.py @ 45793:96fcc37a9c80

rebase: make summary template configurable, with default to shared template Differential Revision: https://phab.mercurial-scm.org/D9251
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 22 Oct 2020 23:10:06 -0700
parents 508dfd1c18df
children f90a5c211251
comparison
equal deleted inserted replaced
45792:b4c193509cd0 45793:96fcc37a9c80
1206 ) 1206 )
1207 mapping = {b'ctx': ctx} 1207 mapping = {b'ctx': ctx}
1208 if props: 1208 if props:
1209 mapping.update(props) 1209 mapping.update(props)
1210 return t.renderdefault(mapping) 1210 return t.renderdefault(mapping)
1211
1212
1213 def format_changeset_summary(ui, ctx, command=None, default_spec=None):
1214 """Format a changeset summary (one line)."""
1215 spec = None
1216 if command:
1217 spec = ui.config(
1218 b'command-templates', b'oneline-summary.%s' % command, None
1219 )
1220 if not spec:
1221 spec = ui.config(b'command-templates', b'oneline-summary')
1222 if not spec:
1223 spec = default_spec
1224 if not spec:
1225 # TODO: Pick a default we can agree on. This isn't used yet.
1226 raise error.ProgrammingError(b"no default one-line summary defined yet")
1227 text = rendertemplate(ctx, spec)
1228 return text.split(b'\n')[0]
1211 1229
1212 1230
1213 def _buildfntemplate(pat, total=None, seqno=None, revwidth=None, pathname=None): 1231 def _buildfntemplate(pat, total=None, seqno=None, revwidth=None, pathname=None):
1214 r"""Convert old-style filename format string to template string 1232 r"""Convert old-style filename format string to template string
1215 1233