merge with stable
authorMatt Mackall <mpm@selenic.com>
Mon, 14 Apr 2014 15:14:02 -0400
changeset 21029 76f68595ff8e
parent 21027 25ee5dbebc6b (current diff)
parent 21028 a0f437e2f5a9 (diff)
child 21030 9ea132aee96c
merge with stable
hgext/histedit.py
--- a/hgext/histedit.py	Tue Nov 26 03:18:56 2013 +0100
+++ b/hgext/histedit.py	Mon Apr 14 15:14:02 2014 -0400
@@ -404,6 +404,7 @@
             _('Fix up the change and run hg histedit --continue'))
     message = oldctx.description() + '\n'
     message = ui.edit(message, ui.username())
+    repo.savecommitmessage(message)
     commit = commitfuncfor(repo, oldctx)
     new = commit(text=message, user=oldctx.user(), date=oldctx.date(),
                  extra=oldctx.extra())
--- a/tests/test-histedit-edit.t	Tue Nov 26 03:18:56 2013 +0100
+++ b/tests/test-histedit-edit.t	Mon Apr 14 15:14:02 2014 -0400
@@ -189,6 +189,49 @@
   
 
 modify the message
+
+check saving last-message.txt, at first
+
+  $ cat > $TESTTMP/commitfailure.py <<EOF
+  > from mercurial import util
+  > def reposetup(ui, repo):
+  >     class commitfailure(repo.__class__):
+  >         def commit(self, *args, **kwargs):
+  >             raise util.Abort('emulating unexpected abort')
+  >     repo.__class__ = commitfailure
+  > EOF
+  $ cat > .hg/hgrc <<EOF
+  > [extensions]
+  > commitfailure = $TESTTMP/commitfailure.py
+  > EOF
+
+  $ cat > $TESTTMP/editor.sh <<EOF
+  > echo "==== before editing"
+  > cat \$1
+  > echo "===="
+  > echo "check saving last-message.txt" >> \$1
+  > EOF
+  $ rm -f .hg/last-message.txt
+  $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit tip --commands - 2>&1 << EOF | fixbundle
+  > mess 1fd3b2fe7754 f
+  > EOF
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  ==== before editing
+  f
+  ====
+  abort: emulating unexpected abort
+  $ cat .hg/last-message.txt
+  f
+  check saving last-message.txt
+
+  $ cat > .hg/hgrc <<EOF
+  > [extensions]
+  > commitfailure = !
+  > EOF
+  $ hg histedit --abort -q
+
+then, check "modify the message" itself
+
   $ hg histedit tip --commands - 2>&1 << EOF | fixbundle
   > mess 1fd3b2fe7754 f
   > EOF