From: Guido Günther Date: Sun, 26 Apr 2009 20:09:43 +0000 (+0200) Subject: add get_author_email X-Git-Tag: debian/0.4.53~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=129b3c4ee1ad8858de98db25e8a6ad0e5e72d52d;p=tools%2Fgit-buildpackage.git add get_author_email that parses git config and environment --- diff --git a/gbp/git_utils.py b/gbp/git_utils.py index 09fc5b05..b6e4b35c 100644 --- a/gbp/git_utils.py +++ b/gbp/git_utils.py @@ -162,6 +162,19 @@ class GitRepository(object): if ret: raise KeyError return value[0][:-1] # first line with \n ending removed + def get_author_info(self): + try: + name = self.get_config("user.email") + except KeyError: + name = os.getenv("USER") + try: + email = self.get_config("user.email") + except KeyError: + email = os.getenv("EMAIL") + email = os.getenv("GIT_AUTHOR_EMAIL", email) + name = os.getenv("GIT_AUTHOR_NAME", name) + return (name, email) + def create_repo(path): """create a repository at path""" abspath = os.path.abspath(path)