##// END OF EJS Templates
qnew: save manually edited commit message into ".hg/last-message.txt"...
FUJIWARA Katsunori -
r20768:57d0c8c3 stable
parent child Browse files
Show More
@@ -1083,6 +1083,7 b' class queue(object):'
1083 p.write("# Date %s %s\n\n" % date)
1083 p.write("# Date %s %s\n\n" % date)
1084 if util.safehasattr(msg, '__call__'):
1084 if util.safehasattr(msg, '__call__'):
1085 msg = msg()
1085 msg = msg()
1086 repo.savecommitmessage(msg)
1086 commitmsg = msg and msg or ("[mq]: %s" % patchfn)
1087 commitmsg = msg and msg or ("[mq]: %s" % patchfn)
1087 n = newcommit(repo, None, commitmsg, user, date, match=match,
1088 n = newcommit(repo, None, commitmsg, user, date, match=match,
1088 force=True)
1089 force=True)
@@ -233,3 +233,39 b' hg headers'
233 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
233 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
234 abort: cannot manage merge changesets
234 abort: cannot manage merge changesets
235 $ rm -r sandbox
235 $ rm -r sandbox
236
237 Test saving last-message.txt
238
239 $ hg init repo
240 $ cd repo
241
242 $ cat > $TESTDIR/commitfailure.py <<EOF
243 > from mercurial import util
244 > def reposetup(ui, repo):
245 > class commitfailure(repo.__class__):
246 > def commit(self, *args, **kwargs):
247 > raise util.Abort('emulating unexpected abort')
248 > repo.__class__ = commitfailure
249 > EOF
250 $ cat > .hg/hgrc <<EOF
251 > [extensions]
252 > commitfailure = $TESTDIR/commitfailure.py
253 > EOF
254
255 $ cat > $TESTDIR/editor.sh << EOF
256 > echo "==== before editing"
257 > cat \$1
258 > echo "===="
259 > echo "test saving last-message.txt" >> \$1
260 > EOF
261
262 $ rm -f .hg/last-message.txt
263 $ HGEDITOR="sh $TESTDIR/editor.sh" hg qnew -e patch
264 ==== before editing
265 ====
266 abort: emulating unexpected abort
267 [255]
268 $ cat .hg/last-message.txt
269 test saving last-message.txt
270
271 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now