diff hgext/patchbomb.py @ 13198:e71b2aa74ce3

patchbomb: save introductory message in .hg/last-email.txt
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Tue, 21 Dec 2010 19:44:28 +0900
parents d85e30889f26
children 14f3795a5ed7
line wrap: on
line diff
--- a/hgext/patchbomb.py	Fri Dec 17 12:05:45 2010 +0000
+++ b/hgext/patchbomb.py	Tue Dec 21 19:44:28 2010 +0900
@@ -193,6 +193,9 @@
     PAGER environment variable is set, your pager will be fired up once
     for each patchbomb message, so you can verify everything is alright.
 
+    In case email sending fails, you will find a backup of your series
+    introductory message in ``.hg/last-email.txt``.
+
     Examples::
 
       hg email -r 3000          # send patch 3000 only
@@ -309,6 +312,10 @@
             ui.write(_('\nWrite the introductory message for the '
                        'patch series.\n\n'))
             body = ui.edit(body, sender)
+            # Save serie description in case sendmail fails
+            msgfile = repo.opener('last-email.txt', 'wb')
+            msgfile.write(body)
+            msgfile.close()
         return body
 
     def getpatchmsgs(patches, patchnames=None):