Allow mailing a given patch list
authorPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Fri, 16 Sep 2005 19:35:22 +0000 (21:35 +0200)
committerCatalin Marinas <catalin.marinas@gmail.com>
Sat, 17 Sep 2005 07:56:05 +0000 (08:56 +0100)
From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>

I tried to mail a cherry-picked subset of my series and that didn't work - using
stg export and quilt was even worse, so I had to code something.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
stgit/commands/mail.py

index 45b2ca8..9f4b3d1 100644 (file)
@@ -26,7 +26,7 @@ from stgit.config import config
 
 
 help = 'send a patch or series of patches by e-mail'
-usage = """%prog [options] [<patch>]
+usage = """%prog [options] [<patch> [<patch2...]]
 
 Send a patch or a range of patches (defaulting to the applied patches)
 by e-mail using the 'smtpserver' configuration option. The From
@@ -278,9 +278,6 @@ def func(parser, options, args):
     """Send the patches by e-mail using the patchmail.tmpl file as
     a template
     """
-    if len(args) > 1:
-        parser.error('incorrect number of arguments')
-
     if not config.has_option('stgit', 'smtpserver'):
         raise CmdException, 'smtpserver not defined'
     smtpserver = config.get('stgit', 'smtpserver')
@@ -294,11 +291,11 @@ def func(parser, options, args):
 
     applied = crt_series.get_applied()
 
-    if len(args) == 1:
-        if args[0] in applied:
-            patches = [args[0]]
-        else:
-            raise CmdException, 'Patch "%s" not applied' % args[0]
+    if len(args) >= 1:
+        for patch in args:
+            if not patch in applied:
+                raise CmdException, 'Patch "%s" not applied' % patch
+            patches = args
     elif options.all:
         patches = applied
     elif options.range: