From 233e3ffe0ef35dbabe49340ba567499690dcc166 Mon Sep 17 00:00:00 2001 From: Michael Trier Date: Fri, 30 May 2008 21:01:44 -0400 Subject: renamed git_python to git. Removed pop_key and replaced with dict.pop. Fixed up tests so they pass except for stderr test. Modified version information retrieval. --- lib/git/actor.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 lib/git/actor.py (limited to 'lib/git/actor.py') diff --git a/lib/git/actor.py b/lib/git/actor.py new file mode 100644 index 00000000..ed21d8ba --- /dev/null +++ b/lib/git/actor.py @@ -0,0 +1,33 @@ +import re + +class Actor(object): + def __init__(self, name, email): + self.name = name + self.email = email + + def __str__(self): + return self.name + + def __repr__(self): + return '">' % (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 + + Returns + Actor + """ + if re.search(r'<.+>', string): + m = re.search(r'(.*) <(.+?)>', string) + name, email = m.groups() + return Actor(name, email) + else: + return Actor(string, None) -- cgit v1.2.3