237 Test saving last-message.txt |
237 Test saving last-message.txt |
238 |
238 |
239 $ hg init repo |
239 $ hg init repo |
240 $ cd repo |
240 $ cd repo |
241 |
241 |
242 $ cat > $TESTDIR/commitfailure.py <<EOF |
242 $ cat > $TESTTMP/commitfailure.py <<EOF |
243 > from mercurial import util |
243 > from mercurial import util |
244 > def reposetup(ui, repo): |
244 > def reposetup(ui, repo): |
245 > class commitfailure(repo.__class__): |
245 > class commitfailure(repo.__class__): |
246 > def commit(self, *args, **kwargs): |
246 > def commit(self, *args, **kwargs): |
247 > raise util.Abort('emulating unexpected abort') |
247 > raise util.Abort('emulating unexpected abort') |
248 > repo.__class__ = commitfailure |
248 > repo.__class__ = commitfailure |
249 > EOF |
249 > EOF |
250 $ cat > .hg/hgrc <<EOF |
250 $ cat > .hg/hgrc <<EOF |
251 > [extensions] |
251 > [extensions] |
252 > commitfailure = $TESTDIR/commitfailure.py |
252 > commitfailure = $TESTTMP/commitfailure.py |
253 > EOF |
253 > EOF |
254 |
254 |
255 $ cat > $TESTDIR/editor.sh << EOF |
255 $ cat > $TESTTMP/editor.sh << EOF |
256 > echo "==== before editing" |
256 > echo "==== before editing" |
257 > cat \$1 |
257 > cat \$1 |
258 > echo "====" |
258 > echo "====" |
259 > echo "test saving last-message.txt" >> \$1 |
259 > echo "test saving last-message.txt" >> \$1 |
260 > EOF |
260 > EOF |
261 |
261 |
262 $ rm -f .hg/last-message.txt |
262 $ rm -f .hg/last-message.txt |
263 $ HGEDITOR="sh $TESTDIR/editor.sh" hg qnew -e patch |
263 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qnew -e patch |
264 ==== before editing |
264 ==== before editing |
265 ==== |
265 ==== |
266 abort: emulating unexpected abort |
266 abort: emulating unexpected abort |
267 [255] |
267 [255] |
268 $ cat .hg/last-message.txt |
268 $ cat .hg/last-message.txt |