Mercurial > hg
changeset 20767:bcfc4f625e57 stable
tag: save manually edited commit message into ".hg/last-message.txt"
Before this patch, manually edited commit message for "hg tag -e"
isn't saved into ".hg/last-message.txt" until it is saved by
"localrepository.savecommitmessage()" in "localrepository.commit()".
This may lose such commit message, if unexpected exception is raised.
This patch saves manually edited commit message for "hg tag -e" into
".hg/last-message.txt" just after user editing. This patch doesn't
save the message specified by -m option (-l is not supported for "hg
tag") as same as other commands.
This is the simplest implementation to fix on stable. Editing and
saving commit message should be centralized into the framework of
"localrepository.commit()" with "editor" argument in the future.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Wed, 19 Mar 2014 01:07:41 +0900 |
parents | 95aab23a806b |
children | 57d0c8c3b947 |
files | mercurial/commands.py tests/test-tag.t |
diffstat | 2 files changed, 22 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Wed Mar 19 01:07:41 2014 +0900 +++ b/mercurial/commands.py Wed Mar 19 01:07:41 2014 +0900 @@ -5694,6 +5694,7 @@ if opts.get('edit'): message = ui.edit(message, ui.username()) + repo.savecommitmessage(message) # don't allow tagging the null rev if (not opts.get('remove') and
--- a/tests/test-tag.t Wed Mar 19 01:07:41 2014 +0900 +++ b/tests/test-tag.t Wed Mar 19 01:07:41 2014 +0900 @@ -222,6 +222,27 @@ > echo "custom tag message" > "$1" > echo "second line" >> "$1" > __EOF__ + +at first, test saving last-message.txt + + $ cat > .hg/hgrc << '__EOF__' + > [hooks] + > pretag.test-saving-lastmessage = false + > __EOF__ + $ rm -f .hg/last-message.txt + $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e + abort: pretag.test-saving-lastmessage hook exited with status 1 + [255] + $ cat .hg/last-message.txt + custom tag message + second line + $ cat > .hg/hgrc << '__EOF__' + > [hooks] + > pretag.test-saving-lastmessage = + > __EOF__ + +then, test custom commit message itself + $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e $ hg log -l1 --template "{desc}\n" custom tag message