Mercurial > hg-stable
changeset 11947:59ec12093261
mq: save qrefresh message for easy recovery in case it fails (issue2062)
Currently, if you start editing a commit message from qrefresh -e and, for any
reason: forget you were editing it, leave the editor open and start qpopping
and qpushing, when you decide to save your commit message, it is going to fail.
This patch copies the commit behavior of saving the message contents in
$HGROOT/.hg/last-message.txt before continuing.
author | Renato Cunha <renatoc@gmail.com> |
---|---|
date | Mon, 16 Aug 2010 16:35:20 -0300 |
parents | 851161f07068 |
children | 88d4911930bf |
files | hgext/mq.py |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Tue Aug 17 17:38:19 2010 -0500 +++ b/hgext/mq.py Mon Aug 16 16:35:20 2010 -0300 @@ -2041,6 +2041,10 @@ If -s/--short is specified, files currently included in the patch will be refreshed just like matched files and remain in the patch. + If -e/--edit is specified, Mercurial will start your configured editor for + you to enter a message. In case qrefresh fails, you will find a backup of + your message in ``.hg/last-message.txt``. + hg add/remove/copy/rename work as usual, though you might want to use git-style patches (-g/--git or [diff] git=1) to track copies and renames. See the diffs help topic for more information on the @@ -2057,6 +2061,10 @@ patch = q.applied[-1].name ph = patchheader(q.join(patch), q.plainmode) message = ui.edit('\n'.join(ph.message), ph.user or ui.username()) + # We don't want to lose the patch message if qrefresh fails (issue2062) + msgfile = repo.opener('last-message.txt', 'wb') + msgfile.write(message) + msgfile.close() setupheaderopts(ui, opts) ret = q.refresh(repo, pats, msg=message, **opts) q.save_dirty()