hgext/patchbomb.py
changeset 10734 7a0502a6f9a1
parent 10611 e764f24a45ee
child 10973 49a07f441496
--- a/hgext/patchbomb.py	Thu Mar 18 14:36:24 2010 -0700
+++ b/hgext/patchbomb.py	Mon Mar 15 22:37:38 2010 +0100
@@ -105,6 +105,10 @@
         raise util.Abort(_('diffstat rejected'))
     return s
 
+def introneeded(opts, number):
+    '''is an introductory message required?'''
+    return number > 1 or opts.get('intro') or opts.get('desc')
+
 def makepatch(ui, repo, patch, opts, _charsets, idx, total, patchname=None):
 
     desc = []
@@ -170,7 +174,7 @@
         flag = ' ' + flag
 
     subj = desc[0].strip().rstrip('. ')
-    if total == 1 and not opts.get('intro'):
+    if not introneeded(opts, total):
         subj = '[PATCH%s] %s' % (flag, opts.get('subject') or subj)
     else:
         tlen = len(str(total))
@@ -329,7 +333,7 @@
                             len(patches), name)
             msgs.append(msg)
 
-        if len(patches) > 1 or opts.get('intro'):
+        if introneeded(opts, len(patches)):
             tlen = len(str(len(patches)))
 
             flag = ' '.join(opts.get('flag'))