Mercurial > public > mercurial-scm > hg
diff hgext/mq.py @ 21421:4941caa9f0f8
mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qnew)
This patch also replaces "editor = False" by "editor =
cmdutil.getcommiteditor()", because:
- the latter allows to hook commit message determination easily,
even in the case without "--edit"
- the latter can avoid regression (or additional care) around saving
"last-message.txt", even if MQ's "newcommit()" changes its
implementation logic from "localrepository.commit" to
"localrepository.commitctx" with "memctx" in the future
to save commit message into "last-messge.txt" with "memctx",
"editor" should be valid function.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sun, 11 May 2014 00:49:36 +0900 |
parents | d009f6555b81 |
children | edc6ced48d2d |
line wrap: on
line diff
--- a/hgext/mq.py Sun May 11 00:49:36 2014 +0900 +++ b/hgext/mq.py Sun May 11 00:49:36 2014 +0900 @@ -1081,17 +1081,18 @@ p.write("# Date %s %s\n\n" % date) defaultmsg = "[mq]: %s" % patchfn - editor = False + editor = cmdutil.getcommiteditor() if edit: - def desceditor(repo, ctx, subs): - desc = self.ui.edit(ctx.description() + "\n", - ctx.user()) + def finishdesc(desc): if desc.rstrip(): return desc else: return defaultmsg + # i18n: this message is shown in editor with "HG: " prefix + extramsg = _('Leave message empty to use default message.') + editor = cmdutil.getcommiteditor(finishdesc=finishdesc, + extramsg=extramsg) commitmsg = msg - editor = desceditor else: commitmsg = msg or defaultmsg