tests/test-commit.t
changeset 20773 efbf15979538
parent 20715 b93791e0de25
parent 20765 f042d4b263f4
child 20820 f8e531a3a77c
--- a/tests/test-commit.t	Sat Mar 15 15:44:51 2014 +0100
+++ b/tests/test-commit.t	Tue Mar 18 14:25:28 2014 -0500
@@ -285,6 +285,52 @@
   HG: removed removed
   abort: empty commit message
   [255]
+
+test saving last-message.txt
+
+  $ hg init sub
+  $ echo a > sub/a
+  $ hg -R sub add sub/a
+  $ cat > sub/.hg/hgrc <<EOF
+  > [hooks]
+  > precommit.test-saving-last-message = false
+  > EOF
+
+  $ echo 'sub = sub' > .hgsub
+  $ hg add .hgsub
+
+  $ cat > $TESTDIR/editor.sh <<EOF
+  > echo "==== before editing:"
+  > cat \$1
+  > echo "===="
+  > echo "test saving last-message.txt" >> \$1
+  > EOF
+
+  $ rm -f .hg/last-message.txt
+  $ HGEDITOR="sh $TESTDIR/editor.sh" hg commit -S -q
+  ==== before editing:
+  
+  
+  HG: Enter commit message.  Lines beginning with 'HG:' are removed.
+  HG: Leave message empty to abort commit.
+  HG: --
+  HG: user: test
+  HG: branch 'default'
+  HG: bookmark 'currentbookmark'
+  HG: subrepo sub
+  HG: added .hgsub
+  HG: added added
+  HG: changed .hgsubstate
+  HG: changed changed
+  HG: removed removed
+  ====
+  abort: precommit.test-saving-last-message hook exited with status 1 (in subrepo sub)
+  [255]
+  $ cat .hg/last-message.txt
+  
+  
+  test saving last-message.txt
+
   $ cd ..