tests/test-commit-amend.t
changeset 18206 2c1276825e93
parent 18163 c5bd753c5bc6
parent 18198 9b4adaef0db9
child 18267 5bb610f87d1d
--- a/tests/test-commit-amend.t	Thu Dec 20 19:22:12 2012 +0100
+++ b/tests/test-commit-amend.t	Wed Jan 02 00:24:28 2013 -0600
@@ -58,11 +58,34 @@
   summary:     base
   
 
-Add new file:
+Check proper abort for empty message
 
+  $ cat > editor.sh << '__EOF__'
+  > #!/bin/sh
+  > echo "" > "$1"
+  > __EOF__
   $ echo b > b
-  $ hg ci --amend -Am 'amend base1 new file'
-  adding b
+  $ hg add b
+  $ hg summary
+  parent: 1:43f1ba15f28a tip
+   amend base1
+  branch: default
+  commit: 1 added, 1 unknown
+  update: (current)
+  $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
+  transaction abort!
+  rollback completed
+  abort: empty commit message
+  [255]
+  $ hg summary
+  parent: 1:43f1ba15f28a tip
+   amend base1
+  branch: default
+  commit: 1 added, 1 unknown
+  update: (current)
+
+Add new file:
+  $ hg ci --amend -m 'amend base1 new file'
   saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-amend-backup.hg (glob)
 
 Remove file that was added in amended commit:
@@ -220,6 +243,24 @@
      book1                     1:48bb6e53a15f
    * book2                     1:48bb6e53a15f
 
+abort does not loose bookmarks
+
+  $ cat > editor.sh << '__EOF__'
+  > #!/bin/sh
+  > echo "" > "$1"
+  > __EOF__
+  $ echo a >> a
+  $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
+  transaction abort!
+  rollback completed
+  abort: empty commit message
+  [255]
+  $ hg book
+     book1                     1:48bb6e53a15f
+   * book2                     1:48bb6e53a15f
+  $ hg revert -Caq
+  $ rm editor.sh
+
   $ echo '[defaults]' >> $HGRCPATH
   $ echo "commit=-d '0 0'" >> $HGRCPATH