tests/test-mq-qnew.t
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Mon, 05 May 2014 21:26:40 +0900
changeset 21234 b9a16ed5acec
parent 20859 e259d4c462b5
child 21266 19d6fec60b81
permissions -rw-r--r--
qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()" Before this patch, "hg qnew" invokes "ui.edit()" explicitly to get commit message edited manually. This requires explicit "localrepository.savecommitmessage()" invocation to save edited commit message into ".hg/last-message.txt", because unexpected exception raising may abort command execution before saving it in "localrepository.commit()". This patch uses "editor" argument of "localrepository.commit()" instead of explicit "ui.edit()" invocation for "hg qnew". "localrepository.commit()" will invoke "desceditor()" function newly added by this patch, and save edited commit message into ".hg/last-message.txt" automatically. This patch passes not "editor" but "desceditor" to "commit()", because "hg qnew" requires editor function to return edited message if not empty, or default message otherwise. This patch applies "rstrip()" on "defaultmsg" at comparison between "nctx.description()" and "defaultmsg", because the former should be stripped by "changelog.stripdesc()" and the latter may have tail white spaces inherited from "patchfn".
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7296
695383442347 mq: put qnew tests into own file, fold in qnew-twice
Brendan Cully <brendan@kublai.com>
parents: 2990
diff changeset
     1
12466
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
     2
  $ catpatch() {
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
     3
  >     cat $1 | sed -e "s/^\(# Parent \).*/\1/"
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
     4
  > }
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
     5
  $ echo "[extensions]" >> $HGRCPATH
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
     6
  $ echo "mq=" >> $HGRCPATH
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
     7
  $ runtest() {
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
     8
  >     hg init mq
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
     9
  >     cd mq
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    10
  > 
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    11
  >     echo a > a
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    12
  >     hg ci -Ama
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    13
  > 
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    14
  >     echo '% qnew should refuse bad patch names'
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    15
  >     hg qnew series
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    16
  >     hg qnew status
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    17
  >     hg qnew guards
14051
2b1226693c70 mq: add '.' and '..' to list of forbidden patch names
Idan Kamara <idankk86@gmail.com>
parents: 13197
diff changeset
    18
  >     hg qnew .
2b1226693c70 mq: add '.' and '..' to list of forbidden patch names
Idan Kamara <idankk86@gmail.com>
parents: 13197
diff changeset
    19
  >     hg qnew ..
12466
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    20
  >     hg qnew .hgignore
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    21
  >     hg qnew .mqfoo
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    22
  >     hg qnew 'foo#bar'
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    23
  >     hg qnew 'foo:bar'
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    24
  > 
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    25
  >     hg qinit -c
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    26
  > 
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    27
  >     echo '% qnew with name containing slash'
12878
1634287b6ab1 qnew: give better feedback when doing 'hg qnew foo/' (issue2464)
Martin Geisler <mg@aragost.com>
parents: 12466
diff changeset
    28
  >     hg qnew foo/
12466
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    29
  >     hg qnew foo/bar.patch
12879
da4a9ed369c8 qnew: distinguish between existing file and directory (issue2464)
Martin Geisler <mg@aragost.com>
parents: 12878
diff changeset
    30
  >     hg qnew foo
12466
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    31
  >     hg qseries
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    32
  >     hg qpop
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    33
  >     hg qdelete foo/bar.patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    34
  > 
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    35
  >     echo '% qnew with uncommitted changes'
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    36
  >     echo a > somefile
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    37
  >     hg add somefile
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    38
  >     hg qnew uncommitted.patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    39
  >     hg st
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    40
  >     hg qseries
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    41
  > 
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    42
  >     echo '% qnew implies add'
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    43
  >     hg -R .hg/patches st
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    44
  > 
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    45
  >     echo '% qnew missing'
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    46
  >     hg qnew missing.patch missing
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    47
  > 
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    48
  >     echo '% qnew -m'
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    49
  >     hg qnew -m 'foo bar' mtest.patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    50
  >     catpatch .hg/patches/mtest.patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    51
  > 
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    52
  >     echo '% qnew twice'
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    53
  >     hg qnew first.patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    54
  >     hg qnew first.patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    55
  > 
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    56
  >     touch ../first.patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    57
  >     hg qimport ../first.patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    58
  > 
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    59
  >     echo '% qnew -f from a subdirectory'
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    60
  >     hg qpop -a
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    61
  >     mkdir d
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    62
  >     cd d
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    63
  >     echo b > b
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    64
  >     hg ci -Am t
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    65
  >     echo b >> b
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    66
  >     hg st
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    67
  >     hg qnew -g -f p
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    68
  >     catpatch ../.hg/patches/p
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    69
  > 
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    70
  >     echo '% qnew -u with no username configured'
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    71
  >     HGUSER= hg qnew -u blue red
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    72
  >     catpatch ../.hg/patches/red
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    73
  > 
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    74
  >     echo '% qnew -e -u with no username configured'
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    75
  >     HGUSER= hg qnew -e -u chartreuse fucsia
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    76
  >     catpatch ../.hg/patches/fucsia
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    77
  > 
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    78
  >     echo '% fail when trying to import a merge'
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    79
  >     hg init merge
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    80
  >     cd merge
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    81
  >     touch a
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    82
  >     hg ci -Am null
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    83
  >     echo a >> a
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    84
  >     hg ci -m a
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    85
  >     hg up -r 0
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    86
  >     echo b >> a
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    87
  >     hg ci -m b
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    88
  >     hg merge -f 1
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    89
  >     hg resolve --mark a
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    90
  >     hg qnew -f merge
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    91
  > 
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    92
  >     cd ../../..
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    93
  >     rm -r mq
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    94
  > }
10397
8cb81d75730c mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents: 10372
diff changeset
    95
12466
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    96
plain headers
7296
695383442347 mq: put qnew tests into own file, fold in qnew-twice
Brendan Cully <brendan@kublai.com>
parents: 2990
diff changeset
    97
12466
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    98
  $ echo "[mq]" >> $HGRCPATH
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
    99
  $ echo "plain=true" >> $HGRCPATH
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   100
  $ mkdir sandbox
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   101
  $ (cd sandbox ; runtest)
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   102
  adding a
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   103
  % qnew should refuse bad patch names
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   104
  abort: "series" cannot be used as the name of a patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   105
  abort: "status" cannot be used as the name of a patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   106
  abort: "guards" cannot be used as the name of a patch
14051
2b1226693c70 mq: add '.' and '..' to list of forbidden patch names
Idan Kamara <idankk86@gmail.com>
parents: 13197
diff changeset
   107
  abort: "." cannot be used as the name of a patch
2b1226693c70 mq: add '.' and '..' to list of forbidden patch names
Idan Kamara <idankk86@gmail.com>
parents: 13197
diff changeset
   108
  abort: ".." cannot be used as the name of a patch
14054
3c616f512a5b mq: be more explicit on invalid patch name message
Idan Kamara <idankk86@gmail.com>
parents: 14051
diff changeset
   109
  abort: patch name cannot begin with ".hg"
3c616f512a5b mq: be more explicit on invalid patch name message
Idan Kamara <idankk86@gmail.com>
parents: 14051
diff changeset
   110
  abort: patch name cannot begin with ".mq"
3c616f512a5b mq: be more explicit on invalid patch name message
Idan Kamara <idankk86@gmail.com>
parents: 14051
diff changeset
   111
  abort: "#" cannot be used in the name of a patch
3c616f512a5b mq: be more explicit on invalid patch name message
Idan Kamara <idankk86@gmail.com>
parents: 14051
diff changeset
   112
  abort: ":" cannot be used in the name of a patch
12466
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   113
  % qnew with name containing slash
16540
4fe8eb4a6e2c tests: add missing accept of native pathname separator
Mads Kiilerich <mads@kiilerich.com>
parents: 15524
diff changeset
   114
  abort: path ends in directory separator: foo/ (glob)
12879
da4a9ed369c8 qnew: distinguish between existing file and directory (issue2464)
Martin Geisler <mg@aragost.com>
parents: 12878
diff changeset
   115
  abort: "foo" already exists as a directory
12466
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   116
  foo/bar.patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   117
  popping foo/bar.patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   118
  patch queue now empty
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   119
  % qnew with uncommitted changes
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   120
  uncommitted.patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   121
  % qnew implies add
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   122
  A .hgignore
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   123
  A series
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   124
  A uncommitted.patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   125
  % qnew missing
15521
117f9190c1ba tests: hide 'No such file or directory' messages
Mads Kiilerich <mads@kiilerich.com>
parents: 14054
diff changeset
   126
  abort: missing: * (glob)
12466
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   127
  % qnew -m
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   128
  foo bar
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   129
  
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   130
  % qnew twice
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   131
  abort: patch "first.patch" already exists
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   132
  abort: patch "first.patch" already exists
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   133
  % qnew -f from a subdirectory
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   134
  popping first.patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   135
  popping mtest.patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   136
  popping uncommitted.patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   137
  patch queue now empty
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   138
  adding d/b
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   139
  M d/b
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   140
  diff --git a/d/b b/d/b
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   141
  --- a/d/b
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   142
  +++ b/d/b
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   143
  @@ -1,1 +1,2 @@
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   144
   b
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   145
  +b
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   146
  % qnew -u with no username configured
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   147
  From: blue
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   148
  
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   149
  % qnew -e -u with no username configured
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   150
  From: chartreuse
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   151
  
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   152
  % fail when trying to import a merge
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   153
  adding a
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   154
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   155
  created new head
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   156
  merging a
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   157
  warning: conflicts during merge.
15501
2371f4aea665 merge: give a special message for internal:merge failure (issue3105)
Matt Mackall <mpm@selenic.com>
parents: 14054
diff changeset
   158
  merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
12466
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   159
  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   160
  use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   161
  abort: cannot manage merge changesets
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   162
  $ rm -r sandbox
2714
85070b784896 Fix test-mq-qnew-twice exit code and output.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2711
diff changeset
   163
12466
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   164
hg headers
11575
a5903e612f07 mq: evaluate --user before invoking editor with -e (issue2289)
Brendan Cully <brendan@kublai.com>
parents: 11513
diff changeset
   165
12466
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   166
  $ echo "plain=false" >> $HGRCPATH
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   167
  $ mkdir sandbox
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   168
  $ (cd sandbox ; runtest)
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   169
  adding a
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   170
  % qnew should refuse bad patch names
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   171
  abort: "series" cannot be used as the name of a patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   172
  abort: "status" cannot be used as the name of a patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   173
  abort: "guards" cannot be used as the name of a patch
14051
2b1226693c70 mq: add '.' and '..' to list of forbidden patch names
Idan Kamara <idankk86@gmail.com>
parents: 13197
diff changeset
   174
  abort: "." cannot be used as the name of a patch
2b1226693c70 mq: add '.' and '..' to list of forbidden patch names
Idan Kamara <idankk86@gmail.com>
parents: 13197
diff changeset
   175
  abort: ".." cannot be used as the name of a patch
14054
3c616f512a5b mq: be more explicit on invalid patch name message
Idan Kamara <idankk86@gmail.com>
parents: 14051
diff changeset
   176
  abort: patch name cannot begin with ".hg"
3c616f512a5b mq: be more explicit on invalid patch name message
Idan Kamara <idankk86@gmail.com>
parents: 14051
diff changeset
   177
  abort: patch name cannot begin with ".mq"
3c616f512a5b mq: be more explicit on invalid patch name message
Idan Kamara <idankk86@gmail.com>
parents: 14051
diff changeset
   178
  abort: "#" cannot be used in the name of a patch
3c616f512a5b mq: be more explicit on invalid patch name message
Idan Kamara <idankk86@gmail.com>
parents: 14051
diff changeset
   179
  abort: ":" cannot be used in the name of a patch
12466
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   180
  % qnew with name containing slash
16540
4fe8eb4a6e2c tests: add missing accept of native pathname separator
Mads Kiilerich <mads@kiilerich.com>
parents: 15524
diff changeset
   181
  abort: path ends in directory separator: foo/ (glob)
12879
da4a9ed369c8 qnew: distinguish between existing file and directory (issue2464)
Martin Geisler <mg@aragost.com>
parents: 12878
diff changeset
   182
  abort: "foo" already exists as a directory
12466
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   183
  foo/bar.patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   184
  popping foo/bar.patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   185
  patch queue now empty
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   186
  % qnew with uncommitted changes
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   187
  uncommitted.patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   188
  % qnew implies add
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   189
  A .hgignore
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   190
  A series
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   191
  A uncommitted.patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   192
  % qnew missing
15521
117f9190c1ba tests: hide 'No such file or directory' messages
Mads Kiilerich <mads@kiilerich.com>
parents: 14054
diff changeset
   193
  abort: missing: * (glob)
12466
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   194
  % qnew -m
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   195
  # HG changeset patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   196
  # Parent 
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   197
  foo bar
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   198
  
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   199
  % qnew twice
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   200
  abort: patch "first.patch" already exists
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   201
  abort: patch "first.patch" already exists
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   202
  % qnew -f from a subdirectory
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   203
  popping first.patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   204
  popping mtest.patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   205
  popping uncommitted.patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   206
  patch queue now empty
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   207
  adding d/b
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   208
  M d/b
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   209
  # HG changeset patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   210
  # Parent 
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   211
  diff --git a/d/b b/d/b
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   212
  --- a/d/b
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   213
  +++ b/d/b
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   214
  @@ -1,1 +1,2 @@
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   215
   b
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   216
  +b
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   217
  % qnew -u with no username configured
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   218
  # HG changeset patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   219
  # Parent 
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   220
  # User blue
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   221
  % qnew -e -u with no username configured
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   222
  # HG changeset patch
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   223
  # Parent 
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   224
  # User chartreuse
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   225
  % fail when trying to import a merge
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   226
  adding a
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   227
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   228
  created new head
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   229
  merging a
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   230
  warning: conflicts during merge.
15501
2371f4aea665 merge: give a special message for internal:merge failure (issue3105)
Matt Mackall <mpm@selenic.com>
parents: 14054
diff changeset
   231
  merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
12466
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   232
  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   233
  use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   234
  abort: cannot manage merge changesets
3160698100c6 tests: unify test-mq-qnew
Matt Mackall <mpm@selenic.com>
parents: 11575
diff changeset
   235
  $ rm -r sandbox
20768
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   236
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   237
Test saving last-message.txt
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   238
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   239
  $ hg init repo
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   240
  $ cd repo
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   241
20859
e259d4c462b5 tests: use TESTTMP instead of TESTDIR
Sean Farley <sean.michael.farley@gmail.com>
parents: 20768
diff changeset
   242
  $ cat > $TESTTMP/commitfailure.py <<EOF
20768
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   243
  > from mercurial import util
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   244
  > def reposetup(ui, repo):
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   245
  >     class commitfailure(repo.__class__):
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   246
  >         def commit(self, *args, **kwargs):
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   247
  >             raise util.Abort('emulating unexpected abort')
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   248
  >     repo.__class__ = commitfailure
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   249
  > EOF
21234
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   250
  $ cat >> .hg/hgrc <<EOF
20768
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   251
  > [extensions]
21234
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   252
  > # this failure occurs before editor invocation
20859
e259d4c462b5 tests: use TESTTMP instead of TESTDIR
Sean Farley <sean.michael.farley@gmail.com>
parents: 20768
diff changeset
   253
  > commitfailure = $TESTTMP/commitfailure.py
20768
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   254
  > EOF
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   255
20859
e259d4c462b5 tests: use TESTTMP instead of TESTDIR
Sean Farley <sean.michael.farley@gmail.com>
parents: 20768
diff changeset
   256
  $ cat > $TESTTMP/editor.sh << EOF
20768
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   257
  > echo "==== before editing"
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   258
  > cat \$1
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   259
  > echo "===="
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   260
  > echo "test saving last-message.txt" >> \$1
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   261
  > EOF
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   262
21234
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   263
(test that editor is not invoked before transaction starting)
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   264
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   265
  $ rm -f .hg/last-message.txt
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   266
  $ HGEDITOR="sh $TESTTMP/editor.sh" hg qnew -e patch
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   267
  abort: emulating unexpected abort
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   268
  [255]
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   269
  $ cat .hg/last-message.txt
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   270
  cat: .hg/last-message.txt: No such file or directory
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   271
  [1]
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   272
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   273
(test that editor is invoked and commit message is saved into
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   274
"last-message.txt")
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   275
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   276
  $ cat >> .hg/hgrc <<EOF
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   277
  > [extensions]
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   278
  > commitfailure = !
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   279
  > [hooks]
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   280
  > # this failure occurs after editor invocation
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   281
  > pretxncommit.unexpectedabort = false
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   282
  > EOF
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   283
20768
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   284
  $ rm -f .hg/last-message.txt
20859
e259d4c462b5 tests: use TESTTMP instead of TESTDIR
Sean Farley <sean.michael.farley@gmail.com>
parents: 20768
diff changeset
   285
  $ HGEDITOR="sh $TESTTMP/editor.sh" hg qnew -e patch
20768
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   286
  ==== before editing
21234
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   287
  
20768
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   288
  ====
21234
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   289
  transaction abort!
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   290
  rollback completed
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   291
  note: commit message saved in .hg/last-message.txt
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   292
  abort: pretxncommit.unexpectedabort hook exited with status 1
20768
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   293
  [255]
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   294
  $ cat .hg/last-message.txt
21234
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   295
  
20768
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   296
  test saving last-message.txt
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   297
21234
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   298
  $ cat >> .hg/hgrc <<EOF
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   299
  > [hooks]
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   300
  > pretxncommit.unexpectedabort =
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   301
  > EOF
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   302
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   303
Test handling default message with the patch filename with tail whitespaces
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   304
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   305
  $ cat > $TESTTMP/editor.sh << EOF
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   306
  > echo "==== before editing"
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   307
  > cat \$1
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   308
  > echo "===="
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   309
  > echo "[mq]: patch        " > \$1
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   310
  > EOF
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   311
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   312
  $ rm -f .hg/last-message.txt
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   313
  $ HGEDITOR="sh $TESTTMP/editor.sh" hg qnew -e "patch "
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   314
  ==== before editing
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   315
  
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   316
  ====
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   317
  $ cat ".hg/patches/patch "
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   318
  # HG changeset patch
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   319
  # Parent 0000000000000000000000000000000000000000
b9a16ed5acec qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   320
20768
57d0c8c3b947 qnew: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16540
diff changeset
   321
  $ cd ..