Show More
@@ -402,12 +402,12 b' def message(ui, repo, ctx, ha, opts):' | |||||
402 | if stats and stats[3] > 0: |
|
402 | if stats and stats[3] > 0: | |
403 | raise error.InterventionRequired( |
|
403 | raise error.InterventionRequired( | |
404 | _('Fix up the change and run hg histedit --continue')) |
|
404 | _('Fix up the change and run hg histedit --continue')) | |
405 |
message = oldctx.description() |
|
405 | message = oldctx.description() | |
406 | message = ui.edit(message, ui.username()) |
|
406 | def editor(repo, ctx, subs): | |
407 | repo.savecommitmessage(message) |
|
407 | return ui.edit(ctx.description() + "\n", ctx.user()) | |
408 | commit = commitfuncfor(repo, oldctx) |
|
408 | commit = commitfuncfor(repo, oldctx) | |
409 | new = commit(text=message, user=oldctx.user(), date=oldctx.date(), |
|
409 | new = commit(text=message, user=oldctx.user(), date=oldctx.date(), | |
410 | extra=oldctx.extra()) |
|
410 | extra=oldctx.extra(), editor=editor) | |
411 | newctx = repo[new] |
|
411 | newctx = repo[new] | |
412 | if oldctx.node() != newctx.node(): |
|
412 | if oldctx.node() != newctx.node(): | |
413 | return newctx, [(oldctx.node(), (new,))] |
|
413 | return newctx, [(oldctx.node(), (new,))] |
@@ -200,8 +200,9 b' check saving last-message.txt, at first' | |||||
200 | > raise util.Abort('emulating unexpected abort') |
|
200 | > raise util.Abort('emulating unexpected abort') | |
201 | > repo.__class__ = commitfailure |
|
201 | > repo.__class__ = commitfailure | |
202 | > EOF |
|
202 | > EOF | |
203 | $ cat > .hg/hgrc <<EOF |
|
203 | $ cat >> .hg/hgrc <<EOF | |
204 | > [extensions] |
|
204 | > [extensions] | |
|
205 | > # this failure occurs before editor invocation | |||
205 | > commitfailure = $TESTTMP/commitfailure.py |
|
206 | > commitfailure = $TESTTMP/commitfailure.py | |
206 | > EOF |
|
207 | > EOF | |
207 |
|
208 | |||
@@ -211,6 +212,34 b' check saving last-message.txt, at first' | |||||
211 | > echo "====" |
|
212 | > echo "====" | |
212 | > echo "check saving last-message.txt" >> \$1 |
|
213 | > echo "check saving last-message.txt" >> \$1 | |
213 | > EOF |
|
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 | $ rm -f .hg/last-message.txt |
|
243 | $ rm -f .hg/last-message.txt | |
215 | $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit tip --commands - 2>&1 << EOF | fixbundle |
|
244 | $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit tip --commands - 2>&1 << EOF | fixbundle | |
216 | > mess 1fd3b2fe7754 f |
|
245 | > mess 1fd3b2fe7754 f | |
@@ -219,14 +248,17 b' check saving last-message.txt, at first' | |||||
219 | ==== before editing |
|
248 | ==== before editing | |
220 | f |
|
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 | $ cat .hg/last-message.txt |
|
255 | $ cat .hg/last-message.txt | |
224 | f |
|
256 | f | |
225 | check saving last-message.txt |
|
257 | check saving last-message.txt | |
226 |
|
258 | |||
227 | $ cat > .hg/hgrc <<EOF |
|
259 | $ cat >> .hg/hgrc <<EOF | |
228 | > [extensions] |
|
260 | > [hooks] | |
229 | > commitfailure = ! |
|
261 | > pretxncommit.unexpectedabort = | |
230 | > EOF |
|
262 | > EOF | |
231 | $ hg histedit --abort -q |
|
263 | $ hg histedit --abort -q | |
232 |
|
264 |
General Comments 0
You need to be logged in to leave comments.
Login now