##// END OF EJS Templates
import: use "getcommiteditor()" instead of explicit editor choice...
FUJIWARA Katsunori -
r21417:308aaeb9 default
parent child Browse files
Show More
@@ -569,9 +569,7 b' def tryimportone(ui, repo, hunk, parents'
569 tmpname, message, user, date, branch, nodeid, p1, p2 = \
569 tmpname, message, user, date, branch, nodeid, p1, p2 = \
570 patch.extract(ui, hunk)
570 patch.extract(ui, hunk)
571
571
572 editor = commiteditor
572 editor = getcommiteditor(**opts)
573 if opts.get('edit'):
574 editor = commitforceeditor
575 update = not opts.get('bypass')
573 update = not opts.get('bypass')
576 strip = opts["strip"]
574 strip = opts["strip"]
577 sim = float(opts.get('similarity') or 0)
575 sim = float(opts.get('similarity') or 0)
@@ -660,7 +658,7 b' def tryimportone(ui, repo, hunk, parents'
660 opts.get('user') or user,
658 opts.get('user') or user,
661 opts.get('date') or date,
659 opts.get('date') or date,
662 branch, files, store,
660 branch, files, store,
663 editor=commiteditor)
661 editor=getcommiteditor())
664 n = memctx.commit()
662 n = memctx.commit()
665 finally:
663 finally:
666 store.close()
664 store.close()
@@ -22,8 +22,10 b' Test --bypass with other options'
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 (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 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
@@ -107,6 +109,8 b' Test unsupported combinations'
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
@@ -131,10 +135,12 b' Test commit editor'
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
@@ -23,6 +23,8 b' generate patches for the test'
23
23
24
24
25 import exported patch
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 $ hg clone -r0 a b
29 $ hg clone -r0 a b
28 adding changesets
30 adding changesets
@@ -31,7 +33,7 b' import exported patch'
31 added 1 changesets with 2 changes to 2 files
33 added 1 changesets with 2 changes to 2 files
32 updating to branch default
34 updating to branch default
33 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
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 applying ../exported-tip.patch
37 applying ../exported-tip.patch
36
38
37 message and committer and date should be same
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 import exported patch with external patcher
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 $ cat > dummypatch.py <<EOF
55 $ cat > dummypatch.py <<EOF
52 > print 'patching file a'
56 > print 'patching file a'
@@ -59,14 +63,25 b' import exported patch with external patc'
59 added 1 changesets with 2 changes to 2 files
63 added 1 changesets with 2 changes to 2 files
60 updating to branch default
64 updating to branch default
61 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
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 applying ../exported-tip.patch
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 $ cat b/a
77 $ cat b/a
65 line2
78 line2
66 $ rm -r b
79 $ rm -r b
67
80
68
81
69 import of plain diff should fail without message
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 $ hg clone -r0 a b
86 $ hg clone -r0 a b
72 adding changesets
87 adding changesets
@@ -75,8 +90,16 b' import of plain diff should fail without'
75 added 1 changesets with 2 changes to 2 files
90 added 1 changesets with 2 changes to 2 files
76 updating to branch default
91 updating to branch default
77 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
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 applying ../diffed-tip.patch
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 abort: empty commit message
103 abort: empty commit message
81 [255]
104 [255]
82 $ rm -r b
105 $ rm -r b
@@ -97,6 +120,8 b' import of plain diff should be ok with m'
97
120
98
121
99 import of plain diff with specific date and user
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 $ hg clone -r0 a b
126 $ hg clone -r0 a b
102 adding changesets
127 adding changesets
@@ -128,6 +153,8 b' import of plain diff with specific date '
128
153
129
154
130 import of plain diff should be ok with --no-commit
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 $ hg clone -r0 a b
159 $ hg clone -r0 a b
133 adding changesets
160 adding changesets
@@ -136,7 +163,7 b' import of plain diff should be ok with -'
136 added 1 changesets with 2 changes to 2 files
163 added 1 changesets with 2 changes to 2 files
137 updating to branch default
164 updating to branch default
138 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
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 applying ../diffed-tip.patch
167 applying ../diffed-tip.patch
141 $ hg --cwd b diff --nodates
168 $ hg --cwd b diff --nodates
142 diff -r 80971e65b431 a
169 diff -r 80971e65b431 a
General Comments 0
You need to be logged in to leave comments. Login now