Show More
@@ -569,9 +569,7 b' def tryimportone(ui, repo, hunk, parents' | |||
|
569 | 569 | tmpname, message, user, date, branch, nodeid, p1, p2 = \ |
|
570 | 570 | patch.extract(ui, hunk) |
|
571 | 571 | |
|
572 | editor = commiteditor | |
|
573 | if opts.get('edit'): | |
|
574 | editor = commitforceeditor | |
|
572 | editor = getcommiteditor(**opts) | |
|
575 | 573 | update = not opts.get('bypass') |
|
576 | 574 | strip = opts["strip"] |
|
577 | 575 | sim = float(opts.get('similarity') or 0) |
@@ -660,7 +658,7 b' def tryimportone(ui, repo, hunk, parents' | |||
|
660 | 658 | opts.get('user') or user, |
|
661 | 659 | opts.get('date') or date, |
|
662 | 660 | branch, files, store, |
|
663 | editor=commiteditor) | |
|
661 | editor=getcommiteditor()) | |
|
664 | 662 | n = memctx.commit() |
|
665 | 663 | finally: |
|
666 | 664 | store.close() |
@@ -22,8 +22,10 b' Test --bypass with other options' | |||
|
22 | 22 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
23 | 23 | |
|
24 | 24 | Test importing an existing revision |
|
25 | (this also tests that editor is not invoked for '--bypass', if the | |
|
26 | patch contains the commit message, regardless of '--edit') | |
|
25 | 27 | |
|
26 | $ hg import --bypass --exact ../test.diff | |
|
28 | $ HGEDITOR=cat hg import --bypass --exact --edit ../test.diff | |
|
27 | 29 | applying ../test.diff |
|
28 | 30 | $ shortlog |
|
29 | 31 | o 1:4e322f7ce8e3 test 0 0 - foo - changea |
@@ -107,6 +109,8 b' Test unsupported combinations' | |||
|
107 | 109 | [255] |
|
108 | 110 | |
|
109 | 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 | 115 | $ cat > ../test.diff <<EOF |
|
112 | 116 | > diff -r 07f494440405 -r 4e322f7ce8e3 a |
@@ -131,10 +135,12 b' Test commit editor' | |||
|
131 | 135 | [255] |
|
132 | 136 | |
|
133 | 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 | 141 | $ python -c 'file("a", "wb").write("a\r\n")' |
|
136 | 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 | 144 | applying ../test.diff |
|
139 | 145 | patching file a |
|
140 | 146 | Hunk #1 FAILED at 0 |
@@ -23,6 +23,8 b' generate patches for the test' | |||
|
23 | 23 | |
|
24 | 24 | |
|
25 | 25 | import exported patch |
|
26 | (this also tests that editor is not invoked, if the patch contains the | |
|
27 | commit message and '--edit' is not specified) | |
|
26 | 28 | |
|
27 | 29 | $ hg clone -r0 a b |
|
28 | 30 | adding changesets |
@@ -31,7 +33,7 b' import exported patch' | |||
|
31 | 33 | added 1 changesets with 2 changes to 2 files |
|
32 | 34 | updating to branch default |
|
33 | 35 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
34 | $ hg --cwd b import ../exported-tip.patch | |
|
36 | $ HGEDITOR=cat hg --cwd b import ../exported-tip.patch | |
|
35 | 37 | applying ../exported-tip.patch |
|
36 | 38 | |
|
37 | 39 | message and committer and date should be same |
@@ -47,6 +49,8 b' message and committer and date should be' | |||
|
47 | 49 | |
|
48 | 50 | |
|
49 | 51 | import exported patch with external patcher |
|
52 | (this also tests that editor is invoked, if the '--edit' is specified, | |
|
53 | regardless of the commit message in the patch) | |
|
50 | 54 | |
|
51 | 55 | $ cat > dummypatch.py <<EOF |
|
52 | 56 | > print 'patching file a' |
@@ -59,14 +63,25 b' import exported patch with external patc' | |||
|
59 | 63 | added 1 changesets with 2 changes to 2 files |
|
60 | 64 | updating to branch default |
|
61 | 65 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
62 | $ hg --config ui.patch='python ../dummypatch.py' --cwd b import ../exported-tip.patch | |
|
66 | $ HGEDITOR=cat hg --config ui.patch='python ../dummypatch.py' --cwd b import --edit ../exported-tip.patch | |
|
63 | 67 | applying ../exported-tip.patch |
|
68 | second change | |
|
69 | ||
|
70 | ||
|
71 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
|
72 | HG: Leave message empty to abort commit. | |
|
73 | HG: -- | |
|
74 | HG: user: someone | |
|
75 | HG: branch 'default' | |
|
76 | HG: changed a | |
|
64 | 77 | $ cat b/a |
|
65 | 78 | line2 |
|
66 | 79 | $ rm -r b |
|
67 | 80 | |
|
68 | 81 | |
|
69 | 82 | import of plain diff should fail without message |
|
83 | (this also tests that editor is invoked, if the patch doesn't contain | |
|
84 | the commit message, regardless of '--edit') | |
|
70 | 85 | |
|
71 | 86 | $ hg clone -r0 a b |
|
72 | 87 | adding changesets |
@@ -75,8 +90,16 b' import of plain diff should fail without' | |||
|
75 | 90 | added 1 changesets with 2 changes to 2 files |
|
76 | 91 | updating to branch default |
|
77 | 92 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
78 | $ hg --cwd b import ../diffed-tip.patch | |
|
93 | $ HGEDITOR=cat hg --cwd b import ../diffed-tip.patch | |
|
79 | 94 | applying ../diffed-tip.patch |
|
95 | ||
|
96 | ||
|
97 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
|
98 | HG: Leave message empty to abort commit. | |
|
99 | HG: -- | |
|
100 | HG: user: test | |
|
101 | HG: branch 'default' | |
|
102 | HG: changed a | |
|
80 | 103 | abort: empty commit message |
|
81 | 104 | [255] |
|
82 | 105 | $ rm -r b |
@@ -97,6 +120,8 b' import of plain diff should be ok with m' | |||
|
97 | 120 | |
|
98 | 121 | |
|
99 | 122 | import of plain diff with specific date and user |
|
123 | (this also tests that editor is not invoked, if | |
|
124 | '--message'/'--logfile' is specified and '--edit' is not) | |
|
100 | 125 | |
|
101 | 126 | $ hg clone -r0 a b |
|
102 | 127 | adding changesets |
@@ -128,6 +153,8 b' import of plain diff with specific date ' | |||
|
128 | 153 | |
|
129 | 154 | |
|
130 | 155 | import of plain diff should be ok with --no-commit |
|
156 | (this also tests that editor is not invoked, if '--no-commit' is | |
|
157 | specified, regardless of '--edit') | |
|
131 | 158 | |
|
132 | 159 | $ hg clone -r0 a b |
|
133 | 160 | adding changesets |
@@ -136,7 +163,7 b' import of plain diff should be ok with -' | |||
|
136 | 163 | added 1 changesets with 2 changes to 2 files |
|
137 | 164 | updating to branch default |
|
138 | 165 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
139 | $ hg --cwd b import --no-commit ../diffed-tip.patch | |
|
166 | $ HGEDITOR=cat hg --cwd b import --no-commit --edit ../diffed-tip.patch | |
|
140 | 167 | applying ../diffed-tip.patch |
|
141 | 168 | $ hg --cwd b diff --nodates |
|
142 | 169 | diff -r 80971e65b431 a |
General Comments 0
You need to be logged in to leave comments.
Login now