Mercurial > hg-stable
comparison tests/test-import-bypass.t @ 21417:308aaeb956e2
import: use "getcommiteditor()" instead of explicit editor choice
This patch also enhances "test-import-bypass.t" and "test-import.t",
because "hg import" hasn't been explicitly tested around editor
invocation and "--edit" option.
This patch explicitly tests below:
- with "--bypass" (regardless of "--edit"):
- not invoked, if the patch contains the commit message
- not invoked, if the commit message is explicitly specified
- invoked, otherwise (just adding comment)
- without "--bypass":
- with "--edit":
- not invoked, if "--no-commit" is not specified
- invoked, otherwise
- without "--edit":
- not invoked, if the patch contains the commit message
- not invoked, if "--message" or "--logfile" is specified
(just adding comment)
- invoked, otherwise
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sun, 11 May 2014 00:49:36 +0900 |
parents | aa9385f983fa |
children | e116abad3afa |
comparison
equal
deleted
inserted
replaced
21416:3e717c9376fc | 21417:308aaeb956e2 |
---|---|
20 $ hg export . > ../test.diff | 20 $ hg export . > ../test.diff |
21 $ hg up null | 21 $ hg up null |
22 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | 22 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
23 | 23 |
24 Test importing an existing revision | 24 Test importing an existing revision |
25 | 25 (this also tests that editor is not invoked for '--bypass', if the |
26 $ hg import --bypass --exact ../test.diff | 26 patch contains the commit message, regardless of '--edit') |
27 | |
28 $ HGEDITOR=cat hg import --bypass --exact --edit ../test.diff | |
27 applying ../test.diff | 29 applying ../test.diff |
28 $ shortlog | 30 $ shortlog |
29 o 1:4e322f7ce8e3 test 0 0 - foo - changea | 31 o 1:4e322f7ce8e3 test 0 0 - foo - changea |
30 | | 32 | |
31 o 0:07f494440405 test 0 0 - default - adda | 33 o 0:07f494440405 test 0 0 - default - adda |
105 $ hg import --bypass --similarity 50 ../test.diff | 107 $ hg import --bypass --similarity 50 ../test.diff |
106 abort: cannot use --similarity with --bypass | 108 abort: cannot use --similarity with --bypass |
107 [255] | 109 [255] |
108 | 110 |
109 Test commit editor | 111 Test commit editor |
112 (this also tests that editor is invoked, if the patch doesn't contain | |
113 the commit message, regardless of '--edit') | |
110 | 114 |
111 $ cat > ../test.diff <<EOF | 115 $ cat > ../test.diff <<EOF |
112 > diff -r 07f494440405 -r 4e322f7ce8e3 a | 116 > diff -r 07f494440405 -r 4e322f7ce8e3 a |
113 > --- a/a Thu Jan 01 00:00:00 1970 +0000 | 117 > --- a/a Thu Jan 01 00:00:00 1970 +0000 |
114 > +++ b/a Thu Jan 01 00:00:00 1970 +0000 | 118 > +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
129 HG: changed a | 133 HG: changed a |
130 abort: empty commit message | 134 abort: empty commit message |
131 [255] | 135 [255] |
132 | 136 |
133 Test patch.eol is handled | 137 Test patch.eol is handled |
138 (this also tests that editor is not invoked for '--bypass', if the | |
139 commit message is explicitly specified, regardless of '--edit') | |
134 | 140 |
135 $ python -c 'file("a", "wb").write("a\r\n")' | 141 $ python -c 'file("a", "wb").write("a\r\n")' |
136 $ hg ci -m makeacrlf | 142 $ hg ci -m makeacrlf |
137 $ hg import -m 'should fail because of eol' --bypass ../test.diff | 143 $ HGEDITOR=cat hg import -m 'should fail because of eol' --edit --bypass ../test.diff |
138 applying ../test.diff | 144 applying ../test.diff |
139 patching file a | 145 patching file a |
140 Hunk #1 FAILED at 0 | 146 Hunk #1 FAILED at 0 |
141 abort: patch failed to apply | 147 abort: patch failed to apply |
142 [255] | 148 [255] |