Mercurial > hg
comparison hgext/mq.py @ 21423:7d408720453d
mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)
This patch also replaces "editor = False" by "editor =
cmdutil.getcommiteditor()", because:
- it allows to hook commit message determination easily, even in the
case without "--edit"
- it avoids 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 | edc6ced48d2d |
children | 7a51bced398b |
comparison
equal
deleted
inserted
replaced
21422:edc6ced48d2d | 21423:7d408720453d |
---|---|
1654 | 1654 |
1655 try: | 1655 try: |
1656 # might be nice to attempt to roll back strip after this | 1656 # might be nice to attempt to roll back strip after this |
1657 | 1657 |
1658 defaultmsg = "[mq]: %s" % patchfn | 1658 defaultmsg = "[mq]: %s" % patchfn |
1659 editor = False | 1659 editor = cmdutil.getcommiteditor() |
1660 if edit: | 1660 if edit: |
1661 def desceditor(repo, ctx, subs): | 1661 def finishdesc(desc): |
1662 desc = self.ui.edit(ctx.description() + "\n", | |
1663 ctx.user()) | |
1664 if desc.rstrip(): | 1662 if desc.rstrip(): |
1665 ph.setmessage(desc) | 1663 ph.setmessage(desc) |
1666 return desc | 1664 return desc |
1667 return defaultmsg | 1665 return defaultmsg |
1666 # i18n: this message is shown in editor with "HG: " prefix | |
1667 extramsg = _('Leave message empty to use default message.') | |
1668 editor = cmdutil.getcommiteditor(finishdesc=finishdesc, | |
1669 extramsg=extramsg) | |
1668 message = msg or "\n".join(ph.message) | 1670 message = msg or "\n".join(ph.message) |
1669 editor = desceditor | |
1670 elif not msg: | 1671 elif not msg: |
1671 if not ph.message: | 1672 if not ph.message: |
1672 message = defaultmsg | 1673 message = defaultmsg |
1673 else: | 1674 else: |
1674 message = "\n".join(ph.message) | 1675 message = "\n".join(ph.message) |