Mercurial > hg-stable
diff tests/test-rollback @ 9934:720f70b720d3
commit: save commit message so it's not destroyed by rollback.
(issue1635)
Rationale: if a pretxncommit hook rejects this commit, the transaction
is rolled back and the user's commit message is irrevocably lost.
So save a copy in .hg/last-message.txt, just in case. Also handy if
the user deliberately rolls back a commit in order to amend it.
author | Greg Ward <greg-hg@gerg.ca> |
---|---|
date | Tue, 24 Nov 2009 21:08:39 -0500 |
parents | 88b4d726332a |
children | 48b81d9bca8d |
line wrap: on
line diff
--- a/tests/test-rollback Fri Aug 14 08:19:49 2009 -0400 +++ b/tests/test-rollback Tue Nov 24 21:08:39 2009 -0500 @@ -15,14 +15,25 @@ hg status echo % Test issue 902 -hg commit -m "test" +hg commit -m "test2" hg branch test hg rollback hg branch +echo '% Test issue 1635 (commit message saved)' +echo '.hg/last-message.txt:' +cat .hg/last-message.txt + echo % Test rollback of hg before issue 902 was fixed -hg commit -m "test" +hg commit -m "test3" hg branch test rm .hg/undo.branch hg rollback hg branch + +echo '% rollback by pretxncommit saves commit message (issue 1635)' +echo a >> a +hg --config hooks.pretxncommit=/bin/false commit -m"precious commit message" + +echo '.hg/last-message.txt:' +cat .hg/last-message.txt