comparison tests/test-mq-qnew.t @ 21421:4941caa9f0f8

mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qnew) This patch also replaces "editor = False" by "editor = cmdutil.getcommiteditor()", because: - the latter allows to hook commit message determination easily, even in the case without "--edit" - the latter can avoid regression (or additional care) around saving "last-message.txt", even if MQ's "newcommit()" changes its implementation logic from "localrepository.commit" to "localrepository.commitctx" with "memctx" in the future to save commit message into "last-messge.txt" with "memctx", "editor" should be valid function.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sun, 11 May 2014 00:49:36 +0900
parents 25b7c760235a
children a5168eb9b2bc
comparison
equal deleted inserted replaced
21420:d009f6555b81 21421:4941caa9f0f8
282 > # this failure occurs after editor invocation 282 > # this failure occurs after editor invocation
283 > pretxncommit.unexpectedabort = false 283 > pretxncommit.unexpectedabort = false
284 > EOF 284 > EOF
285 285
286 $ rm -f .hg/last-message.txt 286 $ rm -f .hg/last-message.txt
287 $ hg status
287 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qnew -e patch 288 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qnew -e patch
288 ==== before editing 289 ==== before editing
289 290
291
292 HG: Enter commit message. Lines beginning with 'HG:' are removed.
293 HG: Leave message empty to use default message.
294 HG: --
295 HG: user: test
296 HG: branch 'default'
297 HG: no files changed
290 ==== 298 ====
291 transaction abort! 299 transaction abort!
292 rollback completed 300 rollback completed
293 note: commit message saved in .hg/last-message.txt 301 note: commit message saved in .hg/last-message.txt
294 abort: pretxncommit.unexpectedabort hook exited with status 1 302 abort: pretxncommit.unexpectedabort hook exited with status 1
295 [255] 303 [255]
296 $ cat .hg/last-message.txt 304 $ cat .hg/last-message.txt
297 305
306
298 test saving last-message.txt 307 test saving last-message.txt
299 308
300 $ cat >> .hg/hgrc <<EOF 309 $ cat >> .hg/hgrc <<EOF
301 > [hooks] 310 > [hooks]
302 > pretxncommit.unexpectedabort = 311 > pretxncommit.unexpectedabort =
312 > echo "====" 321 > echo "===="
313 > echo "[mq]: patch " > \$1 322 > echo "[mq]: patch " > \$1
314 > EOF 323 > EOF
315 324
316 $ rm -f .hg/last-message.txt 325 $ rm -f .hg/last-message.txt
326 $ hg status
317 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qnew -e "patch " 327 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qnew -e "patch "
318 ==== before editing 328 ==== before editing
319 329
330
331 HG: Enter commit message. Lines beginning with 'HG:' are removed.
332 HG: Leave message empty to use default message.
333 HG: --
334 HG: user: test
335 HG: branch 'default'
336 HG: no files changed
320 ==== 337 ====
321 $ cat ".hg/patches/patch " 338 $ cat ".hg/patches/patch "
322 # HG changeset patch 339 # HG changeset patch
323 # Parent 0000000000000000000000000000000000000000 340 # Parent 0000000000000000000000000000000000000000
324 341