Patchwork D8463: commit: tell user what to do with .hg/last-message.txt

login
register
mail settings
Submitter phabricator
Date April 20, 2020, 9:43 p.m.
Message ID <differential-rev-PHID-DREV-hso6wsy7kot3zundmc6k-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46193/
State Superseded
Headers show

Comments

phabricator - April 20, 2020, 9:43 p.m.
martinvonz created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I have always assumed that the message will be reused by the next `hg
  commit`, but it seems it's just silently dropped on the next
  commit. Let's try to be more helpful by telling the user that they
  have to copy the text themselves.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8463

AFFECTED FILES
  mercurial/localrepo.py
  tests/test-histedit-edit.t
  tests/test-mq-qfold.t
  tests/test-mq-qnew.t
  tests/test-mq-qrefresh-replace-log-message.t
  tests/test-rollback.t
  tests/test-tag.t

CHANGE DETAILS




To: martinvonz, durin42, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-tag.t b/tests/test-tag.t
--- a/tests/test-tag.t
+++ b/tests/test-tag.t
@@ -323,6 +323,7 @@ 
   transaction abort!
   rollback completed
   note: commit message saved in .hg/last-message.txt
+  note: copy the text if you want to keep it; it will not be automatically reused
   abort: pretxncommit.unexpectedabort hook exited with status 1
   [255]
   $ cat .hg/last-message.txt
diff --git a/tests/test-rollback.t b/tests/test-rollback.t
--- a/tests/test-rollback.t
+++ b/tests/test-rollback.t
@@ -116,6 +116,7 @@ 
   transaction abort!
   rollback completed
   note: commit message saved in .hg/last-message.txt
+  note: copy the text if you want to keep it; it will not be automatically reused
   abort: pretxncommit hook exited with status * (glob)
   [255]
   $ cat .hg/last-message.txt
diff --git a/tests/test-mq-qrefresh-replace-log-message.t b/tests/test-mq-qrefresh-replace-log-message.t
--- a/tests/test-mq-qrefresh-replace-log-message.t
+++ b/tests/test-mq-qrefresh-replace-log-message.t
@@ -186,6 +186,7 @@ 
   HG: added file2
   ====
   note: commit message saved in .hg/last-message.txt
+  note: copy the text if you want to keep it; it will not be automatically reused
   transaction abort!
   rollback completed
   qrefresh interrupted while patch was popped! (revert --all, qpush to recover)
@@ -229,6 +230,7 @@ 
   A file2
   ====
   note: commit message saved in .hg/last-message.txt
+  note: copy the text if you want to keep it; it will not be automatically reused
   transaction abort!
   rollback completed
   qrefresh interrupted while patch was popped! (revert --all, qpush to recover)
diff --git a/tests/test-mq-qnew.t b/tests/test-mq-qnew.t
--- a/tests/test-mq-qnew.t
+++ b/tests/test-mq-qnew.t
@@ -308,6 +308,7 @@ 
   transaction abort!
   rollback completed
   note: commit message saved in .hg/last-message.txt
+  note: copy the text if you want to keep it; it will not be automatically reused
   abort: pretxncommit.unexpectedabort hook exited with status 1
   [255]
   $ cat .hg/last-message.txt
diff --git a/tests/test-mq-qfold.t b/tests/test-mq-qfold.t
--- a/tests/test-mq-qfold.t
+++ b/tests/test-mq-qfold.t
@@ -230,6 +230,7 @@ 
   HG: changed a
   ====
   note: commit message saved in .hg/last-message.txt
+  note: copy the text if you want to keep it; it will not be automatically reused
   transaction abort!
   rollback completed
   qrefresh interrupted while patch was popped! (revert --all, qpush to recover)
diff --git a/tests/test-histedit-edit.t b/tests/test-histedit-edit.t
--- a/tests/test-histedit-edit.t
+++ b/tests/test-histedit-edit.t
@@ -373,6 +373,7 @@ 
   transaction abort!
   rollback completed
   note: commit message saved in .hg/last-message.txt
+  note: copy the text if you want to keep it; it will not be automatically reused
   abort: pretxncommit.unexpectedabort hook exited with status 1
   [255]
   $ cat .hg/last-message.txt
@@ -397,6 +398,7 @@ 
   transaction abort!
   rollback completed
   note: commit message saved in .hg/last-message.txt
+  note: copy the text if you want to keep it; it will not be automatically reused
   abort: pretxncommit.unexpectedabort hook exited with status 1
   [255]
 
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -3016,6 +3016,12 @@ 
                     self.ui.write(
                         _(b'note: commit message saved in %s\n') % msgfn
                     )
+                    self.ui.write(
+                        _(
+                            b'note: copy the text if you want to keep it; '
+                            'it will not be automatically reused\n'
+                        )
+                    )
                 raise
 
         def commithook(unused_success):