File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ class Actor(object):
1111 can be committers and authors or anything with a name and an email as
1212 mentioned in the git log entries."""
1313 # precompiled regex
14- name_only_regex = re .compile ( r'<.+ >' )
14+ name_only_regex = re .compile ( r'<(.+) >' )
1515 name_email_regex = re .compile ( r'(.*) <(.+?)>' )
1616
1717 def __init__ (self , name , email ):
@@ -47,9 +47,16 @@ def _from_string(cls, string):
4747 Returns
4848 Actor
4949 """
50- if cls .name_only_regex .search (string ):
51- m = cls . name_email_regex . search ( string )
50+ m = cls .name_email_regex .search (string )
51+ if m :
5252 name , email = m .groups ()
5353 return Actor (name , email )
5454 else :
55- return Actor (string , None )
55+ m = cls .name_only_regex .search (string )
56+ if m :
57+ return Actor (m .group (1 ), None )
58+ else :
59+ # assume best and use the whole string as name
60+ return Actor (string , None )
61+ # END special case name
62+ # END handle name/email matching
You can’t perform that action at this time.
0 commit comments