[PATCH] patchbomb: save introductory message in .hg/last-email.txt
Nicolas Dumazet
nicdumz at gmail.com
Tue Dec 21 04:54:01 CST 2010
# HG changeset patch
# User Nicolas Dumazet <nicdumz.commits at gmail.com>
# Date 1292928268 -32400
# Node ID 0a59c78e85b2b5079a5f658e4be58494becd9d8c
# Parent c6e00dfcdcb820c3af4db4a81b1dac4bb136b247
patchbomb: save introductory message in .hg/last-email.txt
diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -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):
diff --git a/tests/test-patchbomb.t b/tests/test-patchbomb.t
--- a/tests/test-patchbomb.t
+++ b/tests/test-patchbomb.t
@@ -145,6 +145,17 @@
+b
+.hg/last-email.txt
+
+ $ cat > editor << '__EOF__'
+ > #!/bin/sh
+ > echo "a precious introductory message" > "$1"
+ > __EOF__
+ $ chmod +x editor
+ $ HGEDITOR="'`pwd`'"/editor hg email -n -t foo -s test -r 0:tip > /dev/null
+ $ cat .hg/last-email.txt
+ a precious introductory message
+
$ hg email -m test.mbox -f quux -t foo -c bar -s test 0:tip \
> --config extensions.progress= --config progress.assume-tty=1 \
> --config progress.delay=0 --config progress.refresh=0
More information about the Mercurial-devel
mailing list