Skip to content

Commit

Permalink
use the commit time (in UTC) in version information
Browse files Browse the repository at this point in the history
as it is more meaningfull than the author time
  • Loading branch information
5263 committed Sep 20, 2014
1 parent eae8f22 commit 856418a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/Tools/SubWCRev.py
Expand Up @@ -137,13 +137,12 @@ def extractInfo(self, srcdir):
return False
self.rev='%04d (Git)' % (info.count('\n'))
# date/time
info=os.popen("git log -1 --date=iso").read()
info=info.split("\n")
for i in info:
r = re.match("^Date:\\W+(\\d+-\\d+-\\d+\\W+\\d+:\\d+:\\d+)", i)
if r != None:
self.date = r.groups()[0].replace('-','/')
break
import time
info=os.popen("git log -1 --date=raw --pretty=format:%cd").read()
# commit time is more meaningfull than author time
# use UTC
self.date = time.strftime("%Y/%m/%d %H:%M:%S",time.gmtime(\
float(info.strip().split(' ',1)[0])))
self.hash=os.popen("git log -1 --pretty=format:%H").read()
for self.branch in os.popen("git branch").read().split('\n'):
if re.match( "\*", self.branch ) != None:
Expand Down

0 comments on commit 856418a

Please sign in to comment.