Comments
Patch
@@ -218,13 +218,22 @@
# leave the attribute unspecified.
testedwith = 'internal'
-editcomment = _("""# Edit history between %s and %s
+def geteditcomment(first, last):
+ """ construct the editor comment
+ The comment includes::
+ - an intro
+ - short commands
+
+ Commands are only included once.
+ Internal commands (those beginning with `_`) are omitted.
+ """
+ intro = _("""# Edit history between %s and %s
#
# Commits are listed from least to most recent
#
# Commands:
-%s""") % ("%s", "%s",
-''.join(["# %s\n" % l for l in (
+%s""")
+ verbs = (
"p, pick = %s" % _("use commit"),
"e, edit = %s" % _("use commit, but stop for amending"),
"f, fold = %s" % _("use commit, but combine it with the one above"),
@@ -232,8 +241,10 @@
"d, drop = %s" % _("remove commit from history"),
"m, mess = %s" % _("edit commit message without changing commit content"),
"",
-)])
)
+ verbs = ''.join(["# %s\n" % l for l in verbs])
+
+ return intro % (first, last, verbs)
class histeditstate(object):
def __init__(self, repo, parentctxnode=None, actions=None, keep=None,
@@ -964,7 +975,7 @@
elif goal == 'edit-plan':
state.read()
if not rules:
- comment = editcomment % (node.short(state.parentctxnode),
+ comment = geteditcomment(node.short(state.parentctxnode),
node.short(state.topmost))
rules = ruleeditor(repo, ui, state.actions, comment)
else:
@@ -1049,7 +1060,7 @@
ctxs = [repo[r] for r in revs]
if not rules:
- comment = editcomment % (node.short(root), node.short(topmost))
+ comment = geteditcomment(node.short(root), node.short(topmost))
actions = [pick(state, r) for r in revs]
rules = ruleeditor(repo, ui, actions, comment)
else: