* [stgit] [PATCH] common: parse 'email (name)' correctly
@ 2006-03-09 5:29 Sam Vilain
0 siblings, 0 replies; only message in thread
From: Sam Vilain @ 2006-03-09 5:29 UTC (permalink / raw)
To: Catalin Marinas; +Cc: Git Mailing List
Currently only e-mails of the form "Name <email>" are accepted by
stgit import etc, however some people use "email (Name)". Accept this
alternate form.
---
Note: the function just below it might need consideration, too.
stgit/commands/common.py | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/stgit/commands/common.py b/stgit/commands/common.py
index 2985379..4bfa4dd 100644
--- a/stgit/commands/common.py
+++ b/stgit/commands/common.py
@@ -175,12 +175,15 @@ def push_patches(patches, check_merged =
def name_email(address):
"""Return a tuple consisting of the name and email parsed from a
- standard 'name <email>' string
+ standard 'name <email>' or 'email (name)' string
"""
address = re.sub('[\\\\"]', '\\\\\g<0>', address)
str_list = re.findall('^(.*)\s*<(.*)>\s*$', address)
if not str_list:
- raise CmdException, 'Incorrect "name <email>" string: %s' % address
+ str_list = re.findall('^(.*)\s*\((.*)\)\s*$', address)
+ if not str_list:
+ raise CmdException, 'Incorrect "name <email>"/"email
(name)" string: %s' % address
+ return ( str_list[0][1], str_list[0][0] )
return str_list[0]
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2006-03-09 5:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-09 5:29 [stgit] [PATCH] common: parse 'email (name)' correctly Sam Vilain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).