diff options
Diffstat (limited to 'lib/git/actor.py')
-rw-r--r-- | lib/git/actor.py | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/lib/git/actor.py b/lib/git/actor.py index 28f50e73..f1aeda9b 100644 --- a/lib/git/actor.py +++ b/lib/git/actor.py @@ -7,40 +7,40 @@ import re class Actor(object): - """Actors hold information about a person acting on the repository. They - can be committers and authors or anything with a name and an email as - mentioned in the git log entries.""" - # precompiled regex - name_only_regex = re.compile( r'<.+>' ) - name_email_regex = re.compile( r'(.*) <(.+?)>' ) - - def __init__(self, name, email): - self.name = name - self.email = email - - def __str__(self): - return self.name - - def __repr__(self): - return '<git.Actor "%s <%s>">' % (self.name, self.email) - - @classmethod - def from_string(cls, string): - """ - Create an Actor from a string. - - ``str`` - is the string, which is expected to be in regular git format - - Format - John Doe <jdoe@example.com> - - Returns - Actor - """ - if cls.name_only_regex.search(string): - m = cls.name_email_regex.search(string) - name, email = m.groups() - return Actor(name, email) - else: - return Actor(string, None) + """Actors hold information about a person acting on the repository. They + can be committers and authors or anything with a name and an email as + mentioned in the git log entries.""" + # precompiled regex + name_only_regex = re.compile( r'<.+>' ) + name_email_regex = re.compile( r'(.*) <(.+?)>' ) + + def __init__(self, name, email): + self.name = name + self.email = email + + def __str__(self): + return self.name + + def __repr__(self): + return '<git.Actor "%s <%s>">' % (self.name, self.email) + + @classmethod + def from_string(cls, string): + """ + Create an Actor from a string. + + ``str`` + is the string, which is expected to be in regular git format + + Format + John Doe <jdoe@example.com> + + Returns + Actor + """ + if cls.name_only_regex.search(string): + m = cls.name_email_regex.search(string) + name, email = m.groups() + return Actor(name, email) + else: + return Actor(string, None) |