diff tests/test-tag.t @ 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 a91894c8064a
children 0054a77f49df
line wrap: on
line diff
--- 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