martinvonz created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Whoever wrote D8463 <https://phab.mercurial-scm.org/D8463> just used a 
hard-coded path to
  `.hg/last-message.text` instead of using the relative path that was
  already available in the `msgfn` variable (and used just a few lines
  up in related message). Let's fix that.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  mercurial/localrepo.py
  tests/test-histedit-edit.t

CHANGE DETAILS

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
@@ -356,6 +356,8 @@
   A f
 
   $ rm -f .hg/last-message.txt
+  $ mkdir dir
+  $ cd dir
   $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit tip --commands - 2>&1 << EOF
   > mess 1fd3b2fe7754 f
   > EOF
@@ -372,10 +374,11 @@
   ====
   transaction abort!
   rollback completed
-  note: commit message saved in .hg/last-message.txt
-  note: use 'hg commit --logfile .hg/last-message.txt --edit' to reuse it
+  note: commit message saved in ../.hg/last-message.txt
+  note: use 'hg commit --logfile ../.hg/last-message.txt --edit' to reuse it
   abort: pretxncommit.unexpectedabort hook exited with status 1
   [40]
+  $ cd ..
   $ cat .hg/last-message.txt
   f
   
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -3176,7 +3176,7 @@
             # Save commit message in case this transaction gets rolled back
             # (e.g. by a pretxncommit hook).  Leave the content alone on
             # the assumption that the user will use the same editor again.
-            msgfn = self.savecommitmessage(cctx._text)
+            msg_path = self.savecommitmessage(cctx._text)
 
             # commit subs and write new state
             if subs:
@@ -3206,13 +3206,14 @@
             except:  # re-raises
                 if edited:
                     self.ui.write(
-                        _(b'note: commit message saved in %s\n') % msgfn
+                        _(b'note: commit message saved in %s\n') % msg_path
                     )
                     self.ui.write(
                         _(
                             b"note: use 'hg commit --logfile "
-                            b".hg/last-message.txt --edit' to reuse it\n"
+                            b"%s --edit' to reuse it\n"
                         )
+                        % msg_path
                     )
                 raise
 



To: martinvonz, durin42, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to