comparison mercurial/cmdutil.py @ 21923:e582e20cd3e6

commiteditor: refactor default extramsg
author Matt Mackall <mpm@selenic.com>
date Fri, 18 Jul 2014 23:15:28 -0500
parents e2530d4a47c1
children 5375ba75df40
comparison
equal deleted inserted replaced
21922:50e20154cb68 21923:e582e20cd3e6
2169 if ctx.description(): 2169 if ctx.description():
2170 return ctx.description() 2170 return ctx.description()
2171 return commitforceeditor(repo, ctx, subs) 2171 return commitforceeditor(repo, ctx, subs)
2172 2172
2173 def commitforceeditor(repo, ctx, subs, finishdesc=None, extramsg=None): 2173 def commitforceeditor(repo, ctx, subs, finishdesc=None, extramsg=None):
2174 if not extramsg:
2175 extramsg = _("Leave message empty to abort commit.")
2174 committext = buildcommittext(repo, ctx, subs, extramsg) 2176 committext = buildcommittext(repo, ctx, subs, extramsg)
2175 2177
2176 # run editor in the repository root 2178 # run editor in the repository root
2177 olddir = os.getcwd() 2179 olddir = os.getcwd()
2178 os.chdir(repo.root) 2180 os.chdir(repo.root)
2194 edittext.append(ctx.description()) 2196 edittext.append(ctx.description())
2195 edittext.append("") 2197 edittext.append("")
2196 edittext.append("") # Empty line between message and comments. 2198 edittext.append("") # Empty line between message and comments.
2197 edittext.append(_("HG: Enter commit message." 2199 edittext.append(_("HG: Enter commit message."
2198 " Lines beginning with 'HG:' are removed.")) 2200 " Lines beginning with 'HG:' are removed."))
2199 if extramsg: 2201 edittext.append("HG: %s" % extramsg)
2200 edittext.append("HG: %s" % extramsg)
2201 else:
2202 edittext.append(_("HG: Leave message empty to abort commit."))
2203 edittext.append("HG: --") 2202 edittext.append("HG: --")
2204 edittext.append(_("HG: user: %s") % ctx.user()) 2203 edittext.append(_("HG: user: %s") % ctx.user())
2205 if ctx.p2(): 2204 if ctx.p2():
2206 edittext.append(_("HG: branch merge")) 2205 edittext.append(_("HG: branch merge"))
2207 if ctx.branch(): 2206 if ctx.branch():