##// END OF EJS Templates
commit: save commit message so it's not destroyed by rollback....
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.

File last commit:

r9934:720f70b7 default
r9934:720f70b7 default
Show More
test-rollback
39 lines | 690 B | text/plain | TextLexer
Vadim Gelfer
deprecate undo command, replace with rollback command.
r2227 #!/bin/sh
mkdir t
cd t
hg init
echo a > a
hg add a
hg commit -m "test" -d "1000000 0"
hg verify
hg parents
hg status
hg rollback
hg verify
hg parents
hg status
Alexandre Vassalotti
restore branch after rollback (issue 902)
r5814
Thomas Arendsen Hein
Do not abort rollback if undo.branch isn't available, but warn.
r6058 echo % Test issue 902
Greg Ward
commit: save commit message so it's not destroyed by rollback....
r9934 hg commit -m "test2"
Alexandre Vassalotti
restore branch after rollback (issue 902)
r5814 hg branch test
hg rollback
hg branch
Thomas Arendsen Hein
Do not abort rollback if undo.branch isn't available, but warn.
r6058
Greg Ward
commit: save commit message so it's not destroyed by rollback....
r9934 echo '% Test issue 1635 (commit message saved)'
echo '.hg/last-message.txt:'
cat .hg/last-message.txt
Thomas Arendsen Hein
Do not abort rollback if undo.branch isn't available, but warn.
r6058 echo % Test rollback of hg before issue 902 was fixed
Greg Ward
commit: save commit message so it's not destroyed by rollback....
r9934 hg commit -m "test3"
Thomas Arendsen Hein
Do not abort rollback if undo.branch isn't available, but warn.
r6058 hg branch test
rm .hg/undo.branch
hg rollback
hg branch
Greg Ward
commit: save commit message so it's not destroyed by rollback....
r9934
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