X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/blobdiff_plain/29d9e8ce8e74d9319c3e9979dd8aa267c0de8239..9e3f506f0d0e1b0c09d1e9d7051af23bfede7834:/stgit/stack.py diff --git a/stgit/stack.py b/stgit/stack.py index 8fa3846..4df306a 100644 --- a/stgit/stack.py +++ b/stgit/stack.py @@ -238,53 +238,31 @@ class Patch: return self.__get_field('authname') def set_authname(self, name): - if not name: - if config.has_option('stgit', 'authname'): - name = config.get('stgit', 'authname') - elif 'GIT_AUTHOR_NAME' in os.environ: - name = os.environ['GIT_AUTHOR_NAME'] - self.__set_field('authname', name) + self.__set_field('authname', name or git.author().name) def get_authemail(self): return self.__get_field('authemail') - def set_authemail(self, address): - if not address: - if config.has_option('stgit', 'authemail'): - address = config.get('stgit', 'authemail') - elif 'GIT_AUTHOR_EMAIL' in os.environ: - address = os.environ['GIT_AUTHOR_EMAIL'] - self.__set_field('authemail', address) + def set_authemail(self, email): + self.__set_field('authemail', email or git.author().email) def get_authdate(self): return self.__get_field('authdate') def set_authdate(self, date): - if not date and 'GIT_AUTHOR_DATE' in os.environ: - date = os.environ['GIT_AUTHOR_DATE'] - self.__set_field('authdate', date) + self.__set_field('authdate', date or git.author().date) def get_commname(self): return self.__get_field('commname') def set_commname(self, name): - if not name: - if config.has_option('stgit', 'commname'): - name = config.get('stgit', 'commname') - elif 'GIT_COMMITTER_NAME' in os.environ: - name = os.environ['GIT_COMMITTER_NAME'] - self.__set_field('commname', name) + self.__set_field('commname', name or git.committer().name) def get_commemail(self): return self.__get_field('commemail') - def set_commemail(self, address): - if not address: - if config.has_option('stgit', 'commemail'): - address = config.get('stgit', 'commemail') - elif 'GIT_COMMITTER_EMAIL' in os.environ: - address = os.environ['GIT_COMMITTER_EMAIL'] - self.__set_field('commemail', address) + def set_commemail(self, email): + self.__set_field('commemail', email or git.committer().email) def get_log(self): return self.__get_field('log')