Show More
@@ -835,6 +835,15 class localrepository(repo.repository): | |||
|
835 | 835 | state[s] = (state[s][0], sr) |
|
836 | 836 | subrepo.writestate(self, state) |
|
837 | 837 | |
|
838 | # Save commit message in case this transaction gets rolled back | |
|
839 | # (e.g. by a pretxncommit hook). (Save in text mode in case a | |
|
840 | # Windows user wants to edit it with Notepad. Normalize | |
|
841 | # trailing whitespace so the file always looks the same -- | |
|
842 | # makes testing easier.) | |
|
843 | msgfile = self.opener('last-message.txt', 'w') | |
|
844 | msgfile.write(cctx._text.rstrip() + '\n') | |
|
845 | msgfile.close() | |
|
846 | ||
|
838 | 847 | ret = self.commitctx(cctx, True) |
|
839 | 848 | |
|
840 | 849 | # update dirstate and mergestate |
@@ -50,6 +50,7 adding tst.d/foo | |||
|
50 | 50 | .hg/data/tst.d.hg |
|
51 | 51 | .hg/data/tst.d.hg/foo.i |
|
52 | 52 | .hg/dirstate |
|
53 | .hg/last-message.txt | |
|
53 | 54 | .hg/requires |
|
54 | 55 | .hg/undo |
|
55 | 56 | .hg/undo.branch |
@@ -59,6 +60,7 adding tst.d/Foo | |||
|
59 | 60 | .hg |
|
60 | 61 | .hg/00changelog.i |
|
61 | 62 | .hg/dirstate |
|
63 | .hg/last-message.txt | |
|
62 | 64 | .hg/requires |
|
63 | 65 | .hg/store |
|
64 | 66 | .hg/store/00changelog.i |
@@ -14,6 +14,7 00770 ./.hg/store/ | |||
|
14 | 14 | 00700 ./.hg/ |
|
15 | 15 | 00600 ./.hg/00changelog.i |
|
16 | 16 | 00660 ./.hg/dirstate |
|
17 | 00660 ./.hg/last-message.txt | |
|
17 | 18 | 00600 ./.hg/requires |
|
18 | 19 | 00770 ./.hg/store/ |
|
19 | 20 | 00660 ./.hg/store/00changelog.i |
@@ -15,14 +15,25 hg parents | |||
|
15 | 15 | hg status |
|
16 | 16 | |
|
17 | 17 | echo % Test issue 902 |
|
18 | hg commit -m "test" | |
|
18 | hg commit -m "test2" | |
|
19 | 19 | hg branch test |
|
20 | 20 | hg rollback |
|
21 | 21 | hg branch |
|
22 | 22 | |
|
23 | echo '% Test issue 1635 (commit message saved)' | |
|
24 | echo '.hg/last-message.txt:' | |
|
25 | cat .hg/last-message.txt | |
|
26 | ||
|
23 | 27 | echo % Test rollback of hg before issue 902 was fixed |
|
24 | hg commit -m "test" | |
|
28 | hg commit -m "test3" | |
|
25 | 29 | hg branch test |
|
26 | 30 | rm .hg/undo.branch |
|
27 | 31 | hg rollback |
|
28 | 32 | hg branch |
|
33 | ||
|
34 | echo '% rollback by pretxncommit saves commit message (issue 1635)' | |
|
35 | echo a >> a | |
|
36 | hg --config hooks.pretxncommit=/bin/false commit -m"precious commit message" | |
|
37 | ||
|
38 | echo '.hg/last-message.txt:' | |
|
39 | cat .hg/last-message.txt |
@@ -20,8 +20,17 A a | |||
|
20 | 20 | marked working directory as branch test |
|
21 | 21 | rolling back last transaction |
|
22 | 22 | default |
|
23 | % Test issue 1635 (commit message saved) | |
|
24 | .hg/last-message.txt: | |
|
25 | test2 | |
|
23 | 26 | % Test rollback of hg before issue 902 was fixed |
|
24 | 27 | marked working directory as branch test |
|
25 | 28 | rolling back last transaction |
|
26 | 29 | Named branch could not be reset, current branch still is: test |
|
27 | 30 | test |
|
31 | % rollback by pretxncommit saves commit message (issue 1635) | |
|
32 | transaction abort! | |
|
33 | rollback completed | |
|
34 | abort: pretxncommit hook exited with status 1 | |
|
35 | .hg/last-message.txt: | |
|
36 | precious commit message |
General Comments 0
You need to be logged in to leave comments.
Login now