diff options
author | Florian Bruhin <git@the-compiler.org> | 2014-06-23 16:19:43 +0200 |
---|---|---|
committer | Florian Bruhin <git@the-compiler.org> | 2014-06-23 16:19:43 +0200 |
commit | b6ddda8f1795304ad5e8921dccffe3f16efae24a (patch) | |
tree | b8ddc82a2366938d80f4a677c49448dbdb223d7b /scripts/setupcommon.py | |
parent | af8b2284eada82d9494623a0c2f517e042d3e2f0 (diff) | |
download | qutebrowser-b6ddda8f1795304ad5e8921dccffe3f16efae24a.tar.gz qutebrowser-b6ddda8f1795304ad5e8921dccffe3f16efae24a.zip |
Show git timestamp in version
Diffstat (limited to 'scripts/setupcommon.py')
-rw-r--r-- | scripts/setupcommon.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/setupcommon.py b/scripts/setupcommon.py index 43a955612..b1737391b 100644 --- a/scripts/setupcommon.py +++ b/scripts/setupcommon.py @@ -61,7 +61,7 @@ def _git_str(): """Try to find out git version. Return: - string containing the git commit ID. + string containing the git commit ID and timestamp. None if there was an error or we're not in a git repo. """ if BASEDIR is None: @@ -69,9 +69,13 @@ def _git_str(): if not os.path.isdir(os.path.join(BASEDIR, ".git")): return None try: - return subprocess.check_output( + cid = subprocess.check_output( ['git', 'describe', '--tags', '--dirty', '--always'], cwd=BASEDIR).decode('UTF-8').strip() + date = subprocess.check_output( + ['git', 'show', '-s', '--format=%ci', 'HEAD'], + cwd=BASEDIR).decode('UTF-8').strip() + return '{} ({})'.format(cid, date) except (subprocess.CalledProcessError, FileNotFoundError): return None |