##// END OF EJS Templates
qfold: save manually edited commit message into ".hg/last-message.txt"...
FUJIWARA Katsunori -
r20769:1e686e55 stable
parent child Browse files
Show More
@@ -2576,6 +2576,7 b' def fold(ui, repo, *files, **opts):'
2576
2576
2577 if opts.get('edit'):
2577 if opts.get('edit'):
2578 message = ui.edit(message, user or ui.username())
2578 message = ui.edit(message, user or ui.username())
2579 repo.savecommitmessage(message)
2579
2580
2580 diffopts = q.patchopts(q.diffopts(), *patches)
2581 diffopts = q.patchopts(q.diffopts(), *patches)
2581 wlock = repo.wlock()
2582 wlock = repo.wlock()
@@ -140,5 +140,41 b' Fold regular patch into a git patch, exp'
140 b
140 b
141 +b
141 +b
142
142
143 Test saving last-message.txt:
144
145 $ hg qrefresh -m "original message"
146
147 $ cat > $TESTDIR/commitfailure.py <<EOF
148 > from mercurial import util
149 > def reposetup(ui, repo):
150 > class commitfailure(repo.__class__):
151 > def commit(self, *args, **kwargs):
152 > raise util.Abort('emulating unexpected abort')
153 > repo.__class__ = commitfailure
154 > EOF
155
156 $ cat > .hg/hgrc <<EOF
157 > [extensions]
158 > commitfailure = $TESTDIR/commitfailure.py
159 > EOF
160
161 $ cat > $TESTDIR/editor.sh << EOF
162 > echo "==== before editing"
163 > cat \$1
164 > echo "===="
165 > (echo; echo "test saving last-message.txt") >> \$1
166 > EOF
167
168 $ rm -f .hg/last-message.txt
169 $ HGEDITOR="sh $TESTDIR/editor.sh" hg qfold -e p3
170 ==== before editing
171 original message====
172 refresh interrupted while patch was popped! (revert --all, qpush to recover)
173 abort: emulating unexpected abort
174 [255]
175 $ cat .hg/last-message.txt
176 original message
177 test saving last-message.txt
178
143 $ cd ..
179 $ cd ..
144
180
General Comments 0
You need to be logged in to leave comments. Login now