Skip to content
Snippets Groups Projects
Commit d67a15b2e608 authored by Greg Ward's avatar Greg Ward
Browse files

patchbomb: simplify some contorted logic and odd variable names.

parent f3edee8dc40c
No related branches found
No related tags found
No related merge requests found
......@@ -429,11 +429,8 @@
showaddrs = []
def getaddrs(opt, prpt=None, default=None):
addrs = opts.get(opt.replace('-', '_'))
if opt != 'reply-to':
showaddr = '%s:' % opt.capitalize()
else:
showaddr = 'Reply-To:'
def getaddrs(header, ask=False, default=None):
configkey = header.lower()
opt = header.replace('-', '_').lower()
addrs = opts.get(opt)
if addrs:
......@@ -439,4 +436,4 @@
if addrs:
showaddrs.append('%s %s' % (showaddr, ', '.join(addrs)))
showaddrs.append('%s: %s' % (header, ', '.join(addrs)))
return mail.addrlistencode(ui, addrs, _charsets, opts.get('test'))
......@@ -441,6 +438,12 @@
return mail.addrlistencode(ui, addrs, _charsets, opts.get('test'))
addrs = ui.config('email', opt) or ui.config('patchbomb', opt) or ''
if not addrs and prpt:
addrs = prompt(ui, prpt, default)
# not on the command line: fallback to config and then maybe ask
addr = (ui.config('email', configkey) or
ui.config('patchbomb', configkey) or
'')
if not addr and ask:
addr = prompt(ui, header, default)
if addr:
showaddrs.append('%s: %s' % (header, addr))
return mail.addrlistencode(ui, [addr], _charsets, opts.get('test'))
......@@ -446,12 +449,8 @@
if addrs:
showaddrs.append('%s %s' % (showaddr, addrs))
return mail.addrlistencode(ui, [addrs], _charsets, opts.get('test'))
to = getaddrs('to', 'To')
cc = getaddrs('cc', 'Cc', '')
bcc = getaddrs('bcc')
replyto = getaddrs('reply-to')
to = getaddrs('To', ask=True)
cc = getaddrs('Cc', ask=True, default='')
bcc = getaddrs('Bcc')
replyto = getaddrs('Reply-To')
if opts.get('diffstat') or opts.get('confirm'):
ui.write(_('\nFinal summary:\n\n'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment