X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/blobdiff_plain/101239d59905d3a747ec0da1d09127ff953fe42d..37a4d1bfabaca3dd947799f10c6cfc369a9edb5e:/stgit/commands/common.py diff --git a/stgit/commands/common.py b/stgit/commands/common.py index 86f62fb..c6d4535 100644 --- a/stgit/commands/common.py +++ b/stgit/commands/common.py @@ -117,8 +117,18 @@ def name_email(string): """Return a tuple consisting of the name and email parsed from a standard 'name ' string """ - names = re.split('([^<>]*)<([^<>]*)>', string) - if len(names) != 4: + str_list = re.findall('^(.*)\s+<(.*)>$', string) + if not str_list: raise CmdException, 'Incorrect "name " string: %s' % string - return tuple([names[1].strip(), names[2].strip()]) + return str_list[0] + +def name_email_date(string): + """Return a tuple consisting of the name, email and date parsed + from a 'name date' string + """ + str_list = re.findall('^(.*)\s+<(.*)>\s+(.*)$', string) + if not str_list: + raise CmdException, 'Incorrect "name date" string: %s' % string + + return str_list[0]