X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/blobdiff_plain/26f4a431939dc3a605773dded9c7c6bc1420de80..79df2f0df89f382b63e4122aa15099a257a06463:/stgit/commands/common.py diff --git a/stgit/commands/common.py b/stgit/commands/common.py index 466f584..2e57824 100644 --- a/stgit/commands/common.py +++ b/stgit/commands/common.py @@ -303,6 +303,24 @@ def name_email_date(address): return str_list[0] +def address_or_alias(addr_str): + """Return the address if it contains an e-mail address or look up + the aliases in the config files. + """ + def __address_or_alias(addr): + if addr.find('@') >= 0: + # it's an e-mail address + return addr + if config.has_option('mail "alias"', addr): + # it's an alias + return config.get('mail "alias"', addr) + + raise CmdException, 'unknown e-mail alias: %s' % addr + + addr_list = [__address_or_alias(addr.strip()) + for addr in addr_str.split(',')] + return ', '.join(addr_list) + def patch_name_from_msg(msg): """Return a string to be used as a patch name. This is generated from the first 30 characters of the top line of the string passed