##// END OF EJS Templates
mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)...
FUJIWARA Katsunori -
r21423:7d408720 default
parent child Browse files
Show More
@@ -1656,17 +1656,18 b' class queue(object):'
1656 # might be nice to attempt to roll back strip after this
1656 # might be nice to attempt to roll back strip after this
1657
1657
1658 defaultmsg = "[mq]: %s" % patchfn
1658 defaultmsg = "[mq]: %s" % patchfn
1659 editor = False
1659 editor = cmdutil.getcommiteditor()
1660 if edit:
1660 if edit:
1661 def desceditor(repo, ctx, subs):
1661 def finishdesc(desc):
1662 desc = self.ui.edit(ctx.description() + "\n",
1663 ctx.user())
1664 if desc.rstrip():
1662 if desc.rstrip():
1665 ph.setmessage(desc)
1663 ph.setmessage(desc)
1666 return desc
1664 return desc
1667 return defaultmsg
1665 return defaultmsg
1666 # i18n: this message is shown in editor with "HG: " prefix
1667 extramsg = _('Leave message empty to use default message.')
1668 editor = cmdutil.getcommiteditor(finishdesc=finishdesc,
1669 extramsg=extramsg)
1668 message = msg or "\n".join(ph.message)
1670 message = msg or "\n".join(ph.message)
1669 editor = desceditor
1670 elif not msg:
1671 elif not msg:
1671 if not ph.message:
1672 if not ph.message:
1672 message = defaultmsg
1673 message = defaultmsg
@@ -20,6 +20,8 b' init:'
20 $ hg qnew -f p3
20 $ hg qnew -f p3
21
21
22 Fold in the middle of the queue:
22 Fold in the middle of the queue:
23 (this tests also that editor is not invoked if '--edit' is not
24 specified)
23
25
24 $ hg qpop p1
26 $ hg qpop p1
25 popping p3
27 popping p3
@@ -34,7 +36,7 b' Fold in the middle of the queue:'
34 a
36 a
35 +a
37 +a
36
38
37 $ hg qfold p2
39 $ HGEDITOR=cat hg qfold p2
38 $ grep git .hg/patches/p1 && echo 'git patch found!'
40 $ grep git .hg/patches/p1 && echo 'git patch found!'
39 [1]
41 [1]
40
42
@@ -215,6 +217,15 b' Test saving last-message.txt:'
215 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qfold -e p3
217 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qfold -e p3
216 ==== before editing
218 ==== before editing
217 original message
219 original message
220
221
222 HG: Enter commit message. Lines beginning with 'HG:' are removed.
223 HG: Leave message empty to use default message.
224 HG: --
225 HG: user: test
226 HG: branch 'default'
227 HG: added aa
228 HG: changed a
218 ====
229 ====
219 transaction abort!
230 transaction abort!
220 rollback completed
231 rollback completed
@@ -225,7 +236,26 b' Test saving last-message.txt:'
225 $ cat .hg/last-message.txt
236 $ cat .hg/last-message.txt
226 original message
237 original message
227
238
239
240
228 test saving last-message.txt
241 test saving last-message.txt
229
242
243 (confirm whether files listed up in the commit message editing are correct)
244
245 $ cat >> .hg/hgrc <<EOF
246 > [hooks]
247 > pretxncommit.unexpectedabort =
248 > EOF
249 $ hg status -u | while read f; do rm ${f}; done
250 $ hg revert --no-backup -q --all
251 $ hg qpush -q git
252 now at: git
253 $ hg qpush -q --move p3
254 now at: p3
255
256 $ hg status --rev "git^1" --rev . -arm
257 M a
258 A aa
259
230 $ cd ..
260 $ cd ..
231
261
@@ -6,6 +6,8 b' Environment setup for MQ'
6 $ hg qinit
6 $ hg qinit
7
7
8 Should fail if no patches applied
8 Should fail if no patches applied
9 (this tests also that editor is not invoked if '--edit' is not
10 specified)
9
11
10 $ hg qrefresh
12 $ hg qrefresh
11 no patches applied
13 no patches applied
@@ -16,7 +18,7 b' Should fail if no patches applied'
16 $ hg qnew -m "First commit message" first-patch
18 $ hg qnew -m "First commit message" first-patch
17 $ echo aaaa > file
19 $ echo aaaa > file
18 $ hg add file
20 $ hg add file
19 $ hg qrefresh
21 $ HGEDITOR=cat hg qrefresh
20
22
21 Should display 'First commit message'
23 Should display 'First commit message'
22
24
@@ -126,10 +128,20 b' Test saving last-message.txt:'
126 > EOF
128 > EOF
127
129
128 $ rm -f .hg/last-message.txt
130 $ rm -f .hg/last-message.txt
131 $ hg status --rev "second-patch^1" -arm
132 A file2
129 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qrefresh -e
133 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qrefresh -e
130 ==== before editing
134 ==== before editing
131 Fifth commit message
135 Fifth commit message
132 This is the 5th log message
136 This is the 5th log message
137
138
139 HG: Enter commit message. Lines beginning with 'HG:' are removed.
140 HG: Leave message empty to use default message.
141 HG: --
142 HG: user: test
143 HG: branch 'default'
144 HG: added file2
133 ====
145 ====
134 transaction abort!
146 transaction abort!
135 rollback completed
147 rollback completed
@@ -141,4 +153,6 b' Test saving last-message.txt:'
141 Fifth commit message
153 Fifth commit message
142 This is the 5th log message
154 This is the 5th log message
143
155
156
157
144 test saving last-message.txt
158 test saving last-message.txt
General Comments 0
You need to be logged in to leave comments. Login now