summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
authorAnssi Kääriäinen <akaariai@gmail.com>2012-06-08 22:52:16 +0300
committerAnssi Kääriäinen <akaariai@gmail.com>2012-06-08 23:04:03 +0300
commit90985048fc1882483794e6734eb91401aefbe768 (patch)
tree7989f16285fd94ac54bf25ed0a63da5c81f68c89 /django/utils
parentc63c62a18a2b434284d3438bcb2be0893d8fcce3 (diff)
Used git log instead of git show for last commit's timestamp
The reason for this was that git show included the whole changeset in the output, but only the UTC timestamp was needed. By using git log it is possible to get just the timestamp. The whole changeset can be large, and can cause unicode encoding errors.
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/version.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/utils/version.py b/django/utils/version.py
index 3d66b9ef52..2271d415db 100644
--- a/django/utils/version.py
+++ b/django/utils/version.py
@@ -40,10 +40,10 @@ def get_git_changeset():
so it's sufficient for generating the development version numbers.
"""
repo_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
- git_show = subprocess.Popen('git show --pretty=format:%ct --quiet HEAD',
+ git_log = subprocess.Popen('git log --pretty=format:%ct --quiet -1 HEAD',
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
shell=True, cwd=repo_dir, universal_newlines=True)
- timestamp = git_show.communicate()[0].partition('\n')[0]
+ timestamp = git_log.communicate()[0]
try:
timestamp = datetime.datetime.utcfromtimestamp(int(timestamp))
except ValueError: