public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Sam Vilain <sam@vilain•net>
To: Catalin Marinas <catalin.marinas@gmail•com>
Cc: Git Mailing List <git@vger•kernel.org>
Subject: [stgit] [PATCH] common: parse 'email (name)' correctly
Date: Thu, 09 Mar 2006 18:29:58 +1300	[thread overview]
Message-ID: <440FBD56.1040007@vilain.net> (raw)

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]

                 reply	other threads:[~2006-03-09  5:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=440FBD56.1040007@vilain.net \
    --to=sam@vilain$(echo .)net \
    --cc=catalin.marinas@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox