comparison tests/test-commit.t @ 20765:f042d4b263f4 stable

localrepo: save manually edited commit message as soon as possible Before this patch, "localrepository.commit()" invokes specified "editor" to edit commit message manually, and saves it after checking sub-repositories. This may lose manually edited commit message, if unexpected exception is raised while checking (or commiting recursively) sub-repositories. This patch saves manually edited commit message as soon as possible.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Wed, 19 Mar 2014 01:07:41 +0900
parents 94317c2d53b8
children efbf15979538 e259d4c462b5
comparison
equal deleted inserted replaced
20700:b0153cb8b64e 20765:f042d4b263f4
282 HG: added added 282 HG: added added
283 HG: changed changed 283 HG: changed changed
284 HG: removed removed 284 HG: removed removed
285 abort: empty commit message 285 abort: empty commit message
286 [255] 286 [255]
287
288 test saving last-message.txt
289
290 $ hg init sub
291 $ echo a > sub/a
292 $ hg -R sub add sub/a
293 $ cat > sub/.hg/hgrc <<EOF
294 > [hooks]
295 > precommit.test-saving-last-message = false
296 > EOF
297
298 $ echo 'sub = sub' > .hgsub
299 $ hg add .hgsub
300
301 $ cat > $TESTDIR/editor.sh <<EOF
302 > echo "==== before editing:"
303 > cat \$1
304 > echo "===="
305 > echo "test saving last-message.txt" >> \$1
306 > EOF
307
308 $ rm -f .hg/last-message.txt
309 $ HGEDITOR="sh $TESTDIR/editor.sh" hg commit -S -q
310 ==== before editing:
311
312
313 HG: Enter commit message. Lines beginning with 'HG:' are removed.
314 HG: Leave message empty to abort commit.
315 HG: --
316 HG: user: test
317 HG: branch 'default'
318 HG: bookmark 'currentbookmark'
319 HG: subrepo sub
320 HG: added .hgsub
321 HG: added added
322 HG: changed .hgsubstate
323 HG: changed changed
324 HG: removed removed
325 ====
326 abort: precommit.test-saving-last-message hook exited with status 1 (in subrepo sub)
327 [255]
328 $ cat .hg/last-message.txt
329
330
331 test saving last-message.txt
332
287 $ cd .. 333 $ cd ..
288 334
289 335
290 commit copy 336 commit copy
291 337