summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-09-20 00:36:12 -0700
committerZac Medico <zmedico@gentoo.org>2010-09-20 00:36:12 -0700
commit7f089f0d6b25d539d1ff16abc6bcc930a613e22a (patch)
treee816426465cd4f972c5c50517aaf8972cc6110af
parent656e886e825792c81381938045712dd9e1bda87d (diff)
downloadportage-7f089f0d6b25d539d1ff16abc6bcc930a613e22a.tar.gz
portage-7f089f0d6b25d539d1ff16abc6bcc930a613e22a.tar.bz2
portage-7f089f0d6b25d539d1ff16abc6bcc930a613e22a.zip
Use git rev-list --format option to simplify _LazyVersion committer
timestamp code.
-rw-r--r--pym/portage/__init__.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 895e8457e..4d400999a 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -545,7 +545,7 @@ if VERSION == 'HEAD':
status, output = subprocess_getstatusoutput((
"cd %s ; git describe --tags || exit $? ; " + \
"if [ -n \"`git diff-index --name-only --diff-filter=M HEAD`\" ] ; " + \
- "then echo modified ; git rev-list --pretty=raw -n 1 HEAD ; fi ; " + \
+ "then echo modified ; git rev-list --format=%%ct -n 1 HEAD ; fi ; " + \
"exit 0") % _shell_quote(PORTAGE_BASE_PATH))
if os.WIFEXITED(status) and os.WEXITSTATUS(status) == os.EX_OK:
output_lines = output.splitlines()
@@ -559,15 +559,11 @@ if VERSION == 'HEAD':
VERSION = "%s_p%s" %(VERSION, version_split[1])
if len(output_lines) > 1 and output_lines[1] == 'modified':
head_timestamp = None
- for line in output_lines[2:]:
- if line.startswith('author '):
- author_split = line.split()
- if len(author_split) > 1:
- try:
- head_timestamp = long(author_split[-2])
- except ValueError:
- pass
- break
+ if len(output_lines) > 3:
+ try:
+ head_timestamp = long(output_lines[3])
+ except ValueError:
+ pass
timestamp = long(time.time())
if head_timestamp is not None and timestamp > head_timestamp:
timestamp = timestamp - head_timestamp