57 Should display 'Fifth commit message\\\n This is the 5th log message' |
57 Should display 'Fifth commit message\\\n This is the 5th log message' |
58 |
58 |
59 $ hg log -l1 --template "{desc}\n" |
59 $ hg log -l1 --template "{desc}\n" |
60 Fifth commit message |
60 Fifth commit message |
61 This is the 5th log message |
61 This is the 5th log message |
|
62 |
|
63 Test saving last-message.txt: |
|
64 |
|
65 $ cat > $TESTTMP/editor.sh << EOF |
|
66 > echo "==== before editing" |
|
67 > cat \$1 |
|
68 > echo "====" |
|
69 > (echo; echo "test saving last-message.txt") >> \$1 |
|
70 > EOF |
|
71 |
|
72 $ cat > $TESTTMP/commitfailure.py <<EOF |
|
73 > from mercurial import util |
|
74 > def reposetup(ui, repo): |
|
75 > class commitfailure(repo.__class__): |
|
76 > def commit(self, *args, **kwargs): |
|
77 > raise util.Abort('emulating unexpected abort') |
|
78 > repo.__class__ = commitfailure |
|
79 > EOF |
|
80 |
|
81 $ cat >> .hg/hgrc <<EOF |
|
82 > [extensions] |
|
83 > # this failure occurs before editor invocation |
|
84 > commitfailure = $TESTTMP/commitfailure.py |
|
85 > EOF |
|
86 |
|
87 $ hg qapplied |
|
88 first-patch |
|
89 second-patch |
|
90 $ hg tip --template "{files}\n" |
|
91 file2 |
|
92 |
|
93 (test that editor is not invoked before transaction starting) |
|
94 |
|
95 $ rm -f .hg/last-message.txt |
|
96 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qrefresh -e |
|
97 refresh interrupted while patch was popped! (revert --all, qpush to recover) |
|
98 abort: emulating unexpected abort |
|
99 [255] |
|
100 $ cat .hg/last-message.txt |
|
101 cat: .hg/last-message.txt: No such file or directory |
|
102 [1] |
|
103 |
|
104 (reset applied patches and directory status) |
|
105 |
|
106 $ cat >> .hg/hgrc <<EOF |
|
107 > [extensions] |
|
108 > commitfailure = ! |
|
109 > EOF |
|
110 |
|
111 $ hg qapplied |
|
112 first-patch |
|
113 $ hg status -A file2 |
|
114 ? file2 |
|
115 $ rm file2 |
|
116 $ hg qpush -q second-patch |
|
117 now at: second-patch |
|
118 |
|
119 (test that editor is invoked and commit message is saved into |
|
120 "last-message.txt") |
|
121 |
|
122 $ cat >> .hg/hgrc <<EOF |
|
123 > [hooks] |
|
124 > # this failure occurs after editor invocation |
|
125 > pretxncommit.unexpectedabort = false |
|
126 > EOF |
|
127 |
|
128 $ rm -f .hg/last-message.txt |
|
129 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qrefresh -e |
|
130 ==== before editing |
|
131 Fifth commit message |
|
132 This is the 5th log message |
|
133 ==== |
|
134 transaction abort! |
|
135 rollback completed |
|
136 note: commit message saved in .hg/last-message.txt |
|
137 refresh interrupted while patch was popped! (revert --all, qpush to recover) |
|
138 abort: pretxncommit.unexpectedabort hook exited with status 1 |
|
139 [255] |
|
140 $ cat .hg/last-message.txt |
|
141 Fifth commit message |
|
142 This is the 5th log message |
|
143 |
|
144 test saving last-message.txt |