commiteditor: refactor default extramsg
authorMatt Mackall <mpm@selenic.com>
Fri, 18 Jul 2014 23:15:28 -0500
changeset 21923 e582e20cd3e6
parent 21922 50e20154cb68
child 21924 5375ba75df40
commiteditor: refactor default extramsg
mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Thu Jun 26 01:20:25 2014 +0200
+++ b/mercurial/cmdutil.py	Fri Jul 18 23:15:28 2014 -0500
@@ -2171,6 +2171,8 @@
     return commitforceeditor(repo, ctx, subs)
 
 def commitforceeditor(repo, ctx, subs, finishdesc=None, extramsg=None):
+    if not extramsg:
+        extramsg = _("Leave message empty to abort commit.")
     committext = buildcommittext(repo, ctx, subs, extramsg)
 
     # run editor in the repository root
@@ -2196,10 +2198,7 @@
     edittext.append("") # Empty line between message and comments.
     edittext.append(_("HG: Enter commit message."
                       "  Lines beginning with 'HG:' are removed."))
-    if extramsg:
-        edittext.append("HG: %s" % extramsg)
-    else:
-        edittext.append(_("HG: Leave message empty to abort commit."))
+    edittext.append("HG: %s" % extramsg)
     edittext.append("HG: --")
     edittext.append(_("HG: user: %s") % ctx.user())
     if ctx.p2():