summaryrefslogtreecommitdiff
path: root/gbp
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2009-04-26 22:09:43 +0200
committerGuido Günther <agx@sigxcpu.org>2009-05-02 19:54:07 +0200
commit129b3c4ee1ad8858de98db25e8a6ad0e5e72d52d (patch)
treed2b8e4faca266e667a3f215f7e1d6771f98c74de /gbp
parent5ed307867972692d2a9b87dd3044229b990140b1 (diff)
downloadgit-buildpackage-129b3c4ee1ad8858de98db25e8a6ad0e5e72d52d.tar.gz
git-buildpackage-129b3c4ee1ad8858de98db25e8a6ad0e5e72d52d.tar.bz2
git-buildpackage-129b3c4ee1ad8858de98db25e8a6ad0e5e72d52d.zip
add get_author_email
that parses git config and environment
Diffstat (limited to 'gbp')
-rw-r--r--gbp/git_utils.py13
1 files changed, 13 insertions, 0 deletions
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)