Mercurial > hg
comparison hgext/rebase.py @ 45769: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 | 5c8230ca37f2 |
children | 96fcc37a9c80 |
comparison
equal
deleted
inserted
replaced
45768:5effb1992c17 | 45769:b4c193509cd0 |
---|---|
32 copies, | 32 copies, |
33 destutil, | 33 destutil, |
34 dirstateguard, | 34 dirstateguard, |
35 error, | 35 error, |
36 extensions, | 36 extensions, |
37 formatter, | |
37 merge as mergemod, | 38 merge as mergemod, |
38 mergestate as mergestatemod, | 39 mergestate as mergestatemod, |
39 mergeutil, | 40 mergeutil, |
40 node as nodemod, | 41 node as nodemod, |
41 obsolete, | 42 obsolete, |
49 revsetlang, | 50 revsetlang, |
50 rewriteutil, | 51 rewriteutil, |
51 scmutil, | 52 scmutil, |
52 smartset, | 53 smartset, |
53 state as statemod, | 54 state as statemod, |
55 templatekw, | |
54 util, | 56 util, |
55 ) | 57 ) |
56 | 58 |
57 # The following constants are used throughout the rebase module. The ordering of | 59 # The following constants are used throughout the rebase module. The ordering of |
58 # their values must be maintained. | 60 # their values must be maintained. |
144 return smartset.baseset(dests) | 146 return smartset.baseset(dests) |
145 | 147 |
146 | 148 |
147 def _ctxdesc(ctx): | 149 def _ctxdesc(ctx): |
148 """short description for a context""" | 150 """short description for a context""" |
149 desc = b'%d:%s "%s"' % ( | 151 labels_spec = b'join(filter(namespaces % "{ifeq(namespace, "branches", "", join(names, " "))}"), " ")' |
150 ctx.rev(), | 152 spec = b'{rev}:{node|short} "{desc|firstline}"{if(%s, " ({%s})")}' % ( |
151 ctx, | 153 labels_spec, |
152 ctx.description().split(b'\n', 1)[0], | 154 labels_spec, |
153 ) | 155 ) |
154 repo = ctx.repo() | 156 return cmdutil.rendertemplate(ctx, spec) |
155 names = [] | |
156 for nsname, ns in pycompat.iteritems(repo.names): | |
157 if nsname == b'branches': | |
158 continue | |
159 names.extend(ns.names(repo, ctx.node())) | |
160 if names: | |
161 desc += b' (%s)' % b' '.join(names) | |
162 return desc | |
163 | 157 |
164 | 158 |
165 class rebaseruntime(object): | 159 class rebaseruntime(object): |
166 """This class is a container for rebase runtime state""" | 160 """This class is a container for rebase runtime state""" |
167 | 161 |