tests/test-mq-qrefresh-replace-log-message.t
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Sun, 11 May 2014 00:49:36 +0900
changeset 21423 7d408720453d
parent 21236 49148d7868df
child 21713 7a51bced398b
permissions -rw-r--r--
mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold) This patch also replaces "editor = False" by "editor = cmdutil.getcommiteditor()", because: - it allows to hook commit message determination easily, even in the case without "--edit" - it avoids 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.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17478
113d0a3d050b spelling: Environment
timeless@mozdev.org
parents: 12468
diff changeset
     1
Environment setup for MQ
2694
0fb28dbf0dc7 MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff changeset
     2
12468
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
     3
  $ echo "[extensions]" >> $HGRCPATH
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
     4
  $ echo "mq=" >> $HGRCPATH
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
     5
  $ hg init
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
     6
  $ hg qinit
2694
0fb28dbf0dc7 MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff changeset
     7
12468
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
     8
Should fail if no patches applied
21423
7d408720453d mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21236
diff changeset
     9
(this tests also that editor is not invoked if '--edit' is not
7d408720453d mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21236
diff changeset
    10
specified)
2694
0fb28dbf0dc7 MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff changeset
    11
12468
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    12
  $ hg qrefresh
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    13
  no patches applied
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    14
  [1]
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    15
  $ hg qrefresh -e
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    16
  no patches applied
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    17
  [1]
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    18
  $ hg qnew -m "First commit message" first-patch
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    19
  $ echo aaaa > file
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    20
  $ hg add file
21423
7d408720453d mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21236
diff changeset
    21
  $ HGEDITOR=cat hg qrefresh
5334
448eb46d4d84 mq: fix qrefresh -e with no patches applied
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4659
diff changeset
    22
12468
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    23
Should display 'First commit message'
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    24
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    25
  $ hg log -l1 --template "{desc}\n"
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    26
  First commit message
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    27
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    28
Testing changing message with -m
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    29
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    30
  $ echo bbbb > file
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    31
  $ hg qrefresh -m "Second commit message"
2694
0fb28dbf0dc7 MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff changeset
    32
12468
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    33
Should display 'Second commit message'
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    34
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    35
  $ hg log -l1 --template "{desc}\n"
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    36
  Second commit message
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    37
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    38
Testing changing message with -l
2694
0fb28dbf0dc7 MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff changeset
    39
12468
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    40
  $ echo "Third commit message" > logfile
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    41
  $ echo " This is the 3rd log message" >> logfile
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    42
  $ echo bbbb > file
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    43
  $ hg qrefresh -l logfile
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    44
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    45
Should display 'Third commit message\\\n This is the 3rd log message'
2694
0fb28dbf0dc7 MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff changeset
    46
12468
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    47
  $ hg log -l1 --template "{desc}\n"
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    48
  Third commit message
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    49
   This is the 3rd log message
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    50
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    51
Testing changing message with -l-
2694
0fb28dbf0dc7 MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff changeset
    52
12468
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    53
  $ hg qnew -m "First commit message" second-patch
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    54
  $ echo aaaa > file2
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    55
  $ hg add file2
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    56
  $ echo bbbb > file2
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    57
  $ (echo "Fifth commit message"; echo " This is the 5th log message") | hg qrefresh -l-
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    58
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    59
Should display 'Fifth commit message\\\n This is the 5th log message'
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    60
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    61
  $ hg log -l1 --template "{desc}\n"
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    62
  Fifth commit message
d8bf747d2e29 tests: unify test-mq-qrefresh-replace-log-message
Matt Mackall <mpm@selenic.com>
parents: 5334
diff changeset
    63
   This is the 5th log message
21236
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    64
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    65
Test saving last-message.txt:
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    66
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    67
  $ cat > $TESTTMP/editor.sh << EOF
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    68
  > echo "==== before editing"
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    69
  > cat \$1
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    70
  > echo "===="
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    71
  > (echo; echo "test saving last-message.txt") >> \$1
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    72
  > EOF
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    73
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    74
  $ cat > $TESTTMP/commitfailure.py <<EOF
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    75
  > from mercurial import util
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    76
  > def reposetup(ui, repo):
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    77
  >     class commitfailure(repo.__class__):
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    78
  >         def commit(self, *args, **kwargs):
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    79
  >             raise util.Abort('emulating unexpected abort')
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    80
  >     repo.__class__ = commitfailure
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    81
  > EOF
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    82
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    83
  $ cat >> .hg/hgrc <<EOF
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    84
  > [extensions]
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    85
  > # this failure occurs before editor invocation
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    86
  > commitfailure = $TESTTMP/commitfailure.py
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    87
  > EOF
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    88
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    89
  $ hg qapplied
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    90
  first-patch
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    91
  second-patch
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    92
  $ hg tip --template "{files}\n"
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    93
  file2
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    94
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    95
(test that editor is not invoked before transaction starting)
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    96
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    97
  $ rm -f .hg/last-message.txt
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    98
  $ HGEDITOR="sh $TESTTMP/editor.sh" hg qrefresh -e
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
    99
  refresh interrupted while patch was popped! (revert --all, qpush to recover)
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   100
  abort: emulating unexpected abort
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   101
  [255]
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   102
  $ cat .hg/last-message.txt
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   103
  cat: .hg/last-message.txt: No such file or directory
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   104
  [1]
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   105
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   106
(reset applied patches and directory status)
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   107
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   108
  $ cat >> .hg/hgrc <<EOF
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   109
  > [extensions]
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   110
  > commitfailure = !
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   111
  > EOF
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   112
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   113
  $ hg qapplied
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   114
  first-patch
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   115
  $ hg status -A file2
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   116
  ? file2
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   117
  $ rm file2
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   118
  $ hg qpush -q second-patch
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   119
  now at: second-patch
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   120
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   121
(test that editor is invoked and commit message is saved into
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   122
"last-message.txt")
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   123
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   124
  $ cat >> .hg/hgrc <<EOF
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   125
  > [hooks]
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   126
  > # this failure occurs after editor invocation
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   127
  > pretxncommit.unexpectedabort = false
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   128
  > EOF
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   129
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   130
  $ rm -f .hg/last-message.txt
21423
7d408720453d mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21236
diff changeset
   131
  $ hg status --rev "second-patch^1" -arm
7d408720453d mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21236
diff changeset
   132
  A file2
21236
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   133
  $ HGEDITOR="sh $TESTTMP/editor.sh" hg qrefresh -e
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   134
  ==== before editing
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   135
  Fifth commit message
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   136
   This is the 5th log message
21423
7d408720453d mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21236
diff changeset
   137
  
7d408720453d mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21236
diff changeset
   138
  
7d408720453d mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21236
diff changeset
   139
  HG: Enter commit message.  Lines beginning with 'HG:' are removed.
7d408720453d mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21236
diff changeset
   140
  HG: Leave message empty to use default message.
7d408720453d mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21236
diff changeset
   141
  HG: --
7d408720453d mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21236
diff changeset
   142
  HG: user: test
7d408720453d mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21236
diff changeset
   143
  HG: branch 'default'
7d408720453d mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21236
diff changeset
   144
  HG: added file2
21236
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   145
  ====
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   146
  transaction abort!
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   147
  rollback completed
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   148
  note: commit message saved in .hg/last-message.txt
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   149
  refresh interrupted while patch was popped! (revert --all, qpush to recover)
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   150
  abort: pretxncommit.unexpectedabort hook exited with status 1
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   151
  [255]
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   152
  $ cat .hg/last-message.txt
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   153
  Fifth commit message
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   154
   This is the 5th log message
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   155
  
21423
7d408720453d mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21236
diff changeset
   156
  
7d408720453d mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21236
diff changeset
   157
  
21236
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17478
diff changeset
   158
  test saving last-message.txt