Mercurial > public > mercurial-scm > hg-stable
diff tests/test-commit.t @ 26742:bec1a579ebc4
commit: abort when a committemplate is not changed
If a committemplate is provided and no message is provided on the
command line, and no edits are made to the commit template, then abort
the commit.
author | Tony Tung <tonytung@fb.com> |
---|---|
date | Fri, 09 Oct 2015 21:44:54 -0700 |
parents | 4b0fc75f9403 |
children | 87c6ad2251d8 |
line wrap: on
line diff
--- a/tests/test-commit.t Wed Oct 14 16:04:43 2015 -0700 +++ b/tests/test-commit.t Fri Oct 09 21:44:54 2015 -0700 @@ -650,3 +650,30 @@ $ hg co --clean tip abort: path contains illegal component: HG8B6C~2/hgrc (glob) [255] + +# test that an unmodified commit template message aborts + + $ hg init unmodified_commit_template + $ cd unmodified_commit_template + $ echo foo > foo + $ hg add foo + $ hg commit -m "foo" + $ cat >> .hg/hgrc <<EOF + > [committemplate] + > changeset.commit = HI THIS IS NOT STRIPPED + > HG: this is customized commit template + > HG: {extramsg} + > {if(activebookmark, + > "HG: bookmark '{activebookmark}' is activated\n", + > "HG: no bookmark is activated\n")}{subrepos % + > "HG: subrepo '{subrepo}' is changed\n"} + > EOF + $ cat > $TESTTMP/notouching.sh <<EOF + > true + > EOF + $ echo foo2 > foo2 + $ hg add foo2 + $ HGEDITOR="sh $TESTTMP/notouching.sh" hg commit + abort: commit message unchanged + [255] + $ cd ..