chiark / gitweb /
Add an --smtp-server commandline option to "stg mail"
authorKarl Hasselström <kha@treskal.com>
Mon, 20 Aug 2007 21:36:00 +0000 (22:36 +0100)
committerCatalin Marinas <catalin.marinas@gmail.com>
Mon, 20 Aug 2007 21:36:34 +0000 (22:36 +0100)
The configuration option stgit.smtpserver is useful if you always talk
to the same SMTP server. But I usually set up a temporary ssh tunnel,
so I'd rather have a commandline option.

Signed-off-by: Karl Hasselström <kha@treskal.com>
stgit/commands/mail.py

index 69712cb848c8b4751c31b5b297d5e691f908d050..71a6e4e190a8ea1204cca7ace3d99a6fa20c42ac 100644 (file)
@@ -28,10 +28,11 @@ from stgit.config import config
 help = 'send a patch or series of patches by e-mail'
 usage = """%prog [options] [<patch1>] [<patch2>] [<patch3>..<patch4>]
 
 help = 'send a patch or series of patches by e-mail'
 usage = """%prog [options] [<patch1>] [<patch2>] [<patch3>..<patch4>]
 
-Send a patch or a range of patches by e-mail using the 'smtpserver'
-configuration option. The From address and the e-mail format are
-generated from the template file passed as argument to '--template'
-(defaulting to '.git/patchmail.tmpl' or
+Send a patch or a range of patches by e-mail using the SMTP server
+specified by the 'stgit.smtpserver' configuration option, or the
+'--smtp-server' command line option. The From address and the e-mail
+format are generated from the template file passed as argument to
+'--template' (defaulting to '.git/patchmail.tmpl' or
 '~/.stgit/templates/patchmail.tmpl' or
 '/usr/share/stgit/templates/patchmail.tmpl').
 
 '~/.stgit/templates/patchmail.tmpl' or
 '/usr/share/stgit/templates/patchmail.tmpl').
 
@@ -118,6 +119,8 @@ options = [make_option('-a', '--all',
                        help = 'sleep for SECONDS between e-mails sending'),
            make_option('--refid',
                        help = 'use REFID as the reference id'),
                        help = 'sleep for SECONDS between e-mails sending'),
            make_option('--refid',
                        help = 'use REFID as the reference id'),
+           make_option('--smtp-server', metavar = 'HOST[:PORT]',
+                       help = 'SMTP server to use for sending mail'),
            make_option('-u', '--smtp-user', metavar = 'USER',
                        help = 'username for SMTP authentication'),
            make_option('-p', '--smtp-password', metavar = 'PASSWORD',
            make_option('-u', '--smtp-user', metavar = 'USER',
                        help = 'username for SMTP authentication'),
            make_option('-p', '--smtp-password', metavar = 'PASSWORD',
@@ -474,7 +477,7 @@ def func(parser, options, args):
     """Send the patches by e-mail using the patchmail.tmpl file as
     a template
     """
     """Send the patches by e-mail using the patchmail.tmpl file as
     a template
     """
-    smtpserver = config.get('stgit.smtpserver')
+    smtpserver = options.smtp_server or config.get('stgit.smtpserver')
 
     applied = crt_series.get_applied()
 
 
     applied = crt_series.get_applied()