Show More
@@ -402,12 +402,12 b' def message(ui, repo, ctx, ha, opts):' | |||
|
402 | 402 | if stats and stats[3] > 0: |
|
403 | 403 | raise error.InterventionRequired( |
|
404 | 404 | _('Fix up the change and run hg histedit --continue')) |
|
405 |
message = oldctx.description() |
|
|
406 | message = ui.edit(message, ui.username()) | |
|
407 | repo.savecommitmessage(message) | |
|
405 | message = oldctx.description() | |
|
406 | def editor(repo, ctx, subs): | |
|
407 | return ui.edit(ctx.description() + "\n", ctx.user()) | |
|
408 | 408 | commit = commitfuncfor(repo, oldctx) |
|
409 | 409 | new = commit(text=message, user=oldctx.user(), date=oldctx.date(), |
|
410 | extra=oldctx.extra()) | |
|
410 | extra=oldctx.extra(), editor=editor) | |
|
411 | 411 | newctx = repo[new] |
|
412 | 412 | if oldctx.node() != newctx.node(): |
|
413 | 413 | return newctx, [(oldctx.node(), (new,))] |
@@ -200,8 +200,9 b' check saving last-message.txt, at first' | |||
|
200 | 200 | > raise util.Abort('emulating unexpected abort') |
|
201 | 201 | > repo.__class__ = commitfailure |
|
202 | 202 | > EOF |
|
203 | $ cat > .hg/hgrc <<EOF | |
|
203 | $ cat >> .hg/hgrc <<EOF | |
|
204 | 204 | > [extensions] |
|
205 | > # this failure occurs before editor invocation | |
|
205 | 206 | > commitfailure = $TESTTMP/commitfailure.py |
|
206 | 207 | > EOF |
|
207 | 208 | |
@@ -211,6 +212,34 b' check saving last-message.txt, at first' | |||
|
211 | 212 | > echo "====" |
|
212 | 213 | > echo "check saving last-message.txt" >> \$1 |
|
213 | 214 | > EOF |
|
215 | ||
|
216 | (test that editor is not invoked before transaction starting) | |
|
217 | ||
|
218 | $ rm -f .hg/last-message.txt | |
|
219 | $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit tip --commands - 2>&1 << EOF | fixbundle | |
|
220 | > mess 1fd3b2fe7754 f | |
|
221 | > EOF | |
|
222 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
|
223 | abort: emulating unexpected abort | |
|
224 | $ cat .hg/last-message.txt | |
|
225 | cat: .hg/last-message.txt: No such file or directory | |
|
226 | [1] | |
|
227 | ||
|
228 | $ cat >> .hg/hgrc <<EOF | |
|
229 | > [extensions] | |
|
230 | > commitfailure = ! | |
|
231 | > EOF | |
|
232 | $ hg histedit --abort -q | |
|
233 | ||
|
234 | (test that editor is invoked and commit message is saved into | |
|
235 | "last-message.txt") | |
|
236 | ||
|
237 | $ cat >> .hg/hgrc <<EOF | |
|
238 | > [hooks] | |
|
239 | > # this failure occurs after editor invocation | |
|
240 | > pretxncommit.unexpectedabort = false | |
|
241 | > EOF | |
|
242 | ||
|
214 | 243 | $ rm -f .hg/last-message.txt |
|
215 | 244 | $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit tip --commands - 2>&1 << EOF | fixbundle |
|
216 | 245 | > mess 1fd3b2fe7754 f |
@@ -219,14 +248,17 b' check saving last-message.txt, at first' | |||
|
219 | 248 | ==== before editing |
|
220 | 249 | f |
|
221 | 250 | ==== |
|
222 | abort: emulating unexpected abort | |
|
251 | transaction abort! | |
|
252 | rollback completed | |
|
253 | note: commit message saved in .hg/last-message.txt | |
|
254 | abort: pretxncommit.unexpectedabort hook exited with status 1 | |
|
223 | 255 | $ cat .hg/last-message.txt |
|
224 | 256 | f |
|
225 | 257 | check saving last-message.txt |
|
226 | 258 | |
|
227 | $ cat > .hg/hgrc <<EOF | |
|
228 | > [extensions] | |
|
229 | > commitfailure = ! | |
|
259 | $ cat >> .hg/hgrc <<EOF | |
|
260 | > [hooks] | |
|
261 | > pretxncommit.unexpectedabort = | |
|
230 | 262 | > EOF |
|
231 | 263 | $ hg histedit --abort -q |
|
232 | 264 |
General Comments 0
You need to be logged in to leave comments.
Login now