patchbomb: Allow to specify subject of single-patch-series (issue475)
authorThomas Arendsen Hein <thomas@intevation.de>
Sun, 04 Mar 2007 18:40:08 +0100
changeset 4141 49d7a035235b
parent 4133 a9ee6c53af8d
child 4142 ba3e13306f70
patchbomb: Allow to specify subject of single-patch-series (issue475)
hgext/patchbomb.py
--- a/hgext/patchbomb.py	Sat Mar 03 17:54:13 2007 +0100
+++ b/hgext/patchbomb.py	Sun Mar 04 18:40:08 2007 +0100
@@ -155,12 +155,14 @@
         else:
             body += '\n'.join(patch)
             msg = email.MIMEText.MIMEText(body)
+
+        subj = desc[0].strip()
+        if subj.endswith('.'): subj = subj[:-1]
         if total == 1:
-            subj = '[PATCH] ' + desc[0].strip()
+            subj = '[PATCH] ' + (opts['subject'] or subj)
         else:
             tlen = len(str(total))
-            subj = '[PATCH %0*d of %d] %s' % (tlen, idx, total, desc[0].strip())
-        if subj.endswith('.'): subj = subj[:-1]
+            subj = '[PATCH %0*d of %d] %s' % (tlen, idx, total, subj)
         msg['Subject'] = subj
         msg['X-Mercurial-Node'] = node
         return msg
@@ -309,7 +311,7 @@
       ('', 'plain', None, 'omit hg patch header'),
       ('n', 'test', None, 'print messages that would be sent'),
       ('m', 'mbox', '', 'write messages to mbox file instead of sending them'),
-      ('s', 'subject', '', 'subject of introductory message'),
+      ('s', 'subject', '', 'subject of first message (intro or single patch)'),
       ('t', 'to', [], 'email addresses of recipients')],
      "hg email [OPTION]... [REV]...")
     }