mercurial/localrepo.py
changeset 9934 720f70b720d3
parent 9924 ea3acaae25bb
child 9935 48b81d9bca8d
--- a/mercurial/localrepo.py	Fri Aug 14 08:19:49 2009 -0400
+++ b/mercurial/localrepo.py	Tue Nov 24 21:08:39 2009 -0500
@@ -835,6 +835,15 @@
                     state[s] = (state[s][0], sr)
                 subrepo.writestate(self, state)
 
+            # Save commit message in case this transaction gets rolled back
+            # (e.g. by a pretxncommit hook).  (Save in text mode in case a
+            # Windows user wants to edit it with Notepad.  Normalize
+            # trailing whitespace so the file always looks the same --
+            # makes testing easier.)
+            msgfile = self.opener('last-message.txt', 'w')
+            msgfile.write(cctx._text.rstrip() + '\n')
+            msgfile.close()
+
             ret = self.commitctx(cctx, True)
 
             # update dirstate and mergestate