Mercurial > public > mercurial-scm > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Thu Oct 22 22:29:22 2020 -0700 +++ b/mercurial/cmdutil.py Thu Oct 22 23:10:06 2020 -0700 @@ -1210,6 +1210,24 @@ return t.renderdefault(mapping) +def format_changeset_summary(ui, ctx, command=None, default_spec=None): + """Format a changeset summary (one line).""" + spec = None + if command: + spec = ui.config( + b'command-templates', b'oneline-summary.%s' % command, None + ) + if not spec: + spec = ui.config(b'command-templates', b'oneline-summary') + if not spec: + spec = default_spec + if not spec: + # TODO: Pick a default we can agree on. This isn't used yet. + raise error.ProgrammingError(b"no default one-line summary defined yet") + text = rendertemplate(ctx, spec) + return text.split(b'\n')[0] + + def _buildfntemplate(pat, total=None, seqno=None, revwidth=None, pathname=None): r"""Convert old-style filename format string to template string