Mercurial > hg-stable
changeset 45792:b4c193509cd0
rebase: use hard-coded template for one-line commit description
This is to prepare for making making the one-line summary
customizable. The template ended up pretty complicated because of the
conditional output of "(<bookmarks etc>)". Maybe we can simplify the
template later.
Differential Revision: https://phab.mercurial-scm.org/D9250
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 22 Oct 2020 22:29:22 -0700 |
parents | 5effb1992c17 |
children | 96fcc37a9c80 |
files | hgext/rebase.py |
diffstat | 1 files changed, 7 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/rebase.py Mon Oct 26 10:33:32 2020 -0700 +++ b/hgext/rebase.py Thu Oct 22 22:29:22 2020 -0700 @@ -34,6 +34,7 @@ dirstateguard, error, extensions, + formatter, merge as mergemod, mergestate as mergestatemod, mergeutil, @@ -51,6 +52,7 @@ scmutil, smartset, state as statemod, + templatekw, util, ) @@ -146,20 +148,12 @@ def _ctxdesc(ctx): """short description for a context""" - desc = b'%d:%s "%s"' % ( - ctx.rev(), - ctx, - ctx.description().split(b'\n', 1)[0], + labels_spec = b'join(filter(namespaces % "{ifeq(namespace, "branches", "", join(names, " "))}"), " ")' + spec = b'{rev}:{node|short} "{desc|firstline}"{if(%s, " ({%s})")}' % ( + labels_spec, + labels_spec, ) - repo = ctx.repo() - names = [] - for nsname, ns in pycompat.iteritems(repo.names): - if nsname == b'branches': - continue - names.extend(ns.names(repo, ctx.node())) - if names: - desc += b' (%s)' % b' '.join(names) - return desc + return cmdutil.rendertemplate(ctx, spec) class rebaseruntime(object):