##// END OF EJS Templates
patchbomb: Validate email config before we start prompting for info.
Bryan O'Sullivan -
r4489:a11e13d5 default
parent child Browse files
Show More
@@ -223,6 +223,9 b' def patchbomb(ui, repo, *revs, **opts):'
223 pass
223 pass
224 os.rmdir(tmpdir)
224 os.rmdir(tmpdir)
225
225
226 if not opts['test']:
227 mail.validateconfig(ui)
228
226 # option handling
229 # option handling
227 commands.setremoteconfig(ui, opts)
230 commands.setremoteconfig(ui, opts)
228 if opts.get('outgoint') and opts.get('bundle'):
231 if opts.get('outgoint') and opts.get('bundle'):
@@ -68,3 +68,15 b' def connect(ui):'
68
68
69 def sendmail(ui, sender, recipients, msg):
69 def sendmail(ui, sender, recipients, msg):
70 return connect(ui).sendmail(sender, recipients, msg)
70 return connect(ui).sendmail(sender, recipients, msg)
71
72 def validateconfig(ui):
73 '''determine if we have enough config data to try sending email.'''
74 method = ui.config('email', 'method', 'smtp')
75 if method == 'smtp':
76 if not ui.config('smtp', 'host'):
77 raise util.Abort(_('smtp specified as email transport, '
78 'but no smtp host configured'))
79 else:
80 if not util.find_exe(method):
81 raise util.Abort(_('%r specified as email transport, '
82 'but not in PATH') % method)
General Comments 0
You need to be logged in to leave comments. Login now