From 129b3c4ee1ad8858de98db25e8a6ad0e5e72d52d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Guido=20G=C3=BCnther?= Date: Sun, 26 Apr 2009 22:09:43 +0200 Subject: [PATCH] add get_author_email that parses git config and environment --- gbp/git_utils.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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) -- 2.34.1