##// END OF EJS Templates
vcs: make commit datetimes utc
dan -
r154:3953c69f default
parent child Browse files
Show More
@@ -35,7 +35,7 b' def makedate():'
35 35 return time.mktime(lt), tz
36 36
37 37
38 def date_fromtimestamp(unixts, tzoffset=0):
38 def utcdate_fromtimestamp(unixts, tzoffset=0):
39 39 """
40 40 Makes a local datetime object out of unix timestamp
41 41
@@ -43,7 +43,7 b' def date_fromtimestamp(unixts, tzoffset='
43 43 :param tzoffset:
44 44 """
45 45
46 return datetime.datetime.fromtimestamp(float(unixts))
46 return datetime.datetime.utcfromtimestamp(float(unixts))
47 47
48 48
49 49 def date_astimestamp(value):
@@ -30,7 +30,7 b' from StringIO import StringIO'
30 30
31 31 from zope.cachedescriptors.property import Lazy as LazyProperty
32 32
33 from rhodecode.lib.datelib import date_fromtimestamp
33 from rhodecode.lib.datelib import utcdate_fromtimestamp
34 34 from rhodecode.lib.utils import safe_unicode, safe_str
35 35 from rhodecode.lib.utils2 import safe_int
36 36 from rhodecode.lib.vcs.conf import settings
@@ -95,7 +95,7 b' class GitCommit(base.BaseCommit):'
95 95 if value:
96 96 value = safe_unicode(value)
97 97 elif attr == "date":
98 value = date_fromtimestamp(*value)
98 value = utcdate_fromtimestamp(*value)
99 99 elif attr == "parents":
100 100 value = self._make_commits(value)
101 101 self.__dict__[attr] = value
@@ -135,7 +135,7 b' class GitCommit(base.BaseCommit):'
135 135 def date(self):
136 136 unix_ts, tz = self._remote.get_object_attrs(
137 137 self.raw_id, self._date_property, self._date_tz_property)
138 return date_fromtimestamp(unix_ts, tz)
138 return utcdate_fromtimestamp(unix_ts, tz)
139 139
140 140 @LazyProperty
141 141 def status(self):
@@ -31,7 +31,7 b' import time'
31 31 from zope.cachedescriptors.property import Lazy as LazyProperty
32 32
33 33 from rhodecode.lib.compat import OrderedDict
34 from rhodecode.lib.datelib import makedate, date_fromtimestamp
34 from rhodecode.lib.datelib import makedate, utcdate_fromtimestamp
35 35 from rhodecode.lib.utils import safe_unicode, safe_str
36 36 from rhodecode.lib.vcs import connection, path as vcspath
37 37 from rhodecode.lib.vcs.backends.base import (
@@ -269,7 +269,7 b' class GitRepository(BaseRepository):'
269 269 Returns last change made on this repository as
270 270 `datetime.datetime` object.
271 271 """
272 return date_fromtimestamp(self._get_mtime(), makedate()[1])
272 return utcdate_fromtimestamp(self._get_mtime(), makedate()[1])
273 273
274 274 def _get_mtime(self):
275 275 try:
@@ -26,7 +26,7 b' import os'
26 26
27 27 from zope.cachedescriptors.property import Lazy as LazyProperty
28 28
29 from rhodecode.lib.datelib import date_fromtimestamp
29 from rhodecode.lib.datelib import utcdate_fromtimestamp
30 30 from rhodecode.lib.utils import safe_str, safe_unicode
31 31 from rhodecode.lib.vcs import path as vcspath
32 32 from rhodecode.lib.vcs.backends import base
@@ -78,7 +78,7 b' class MercurialCommit(base.BaseCommit):'
78 78 elif attr == "affected_files":
79 79 value = map(safe_unicode, value)
80 80 elif attr == "date":
81 value = date_fromtimestamp(*value)
81 value = utcdate_fromtimestamp(*value)
82 82 elif attr in ["children", "parents"]:
83 83 value = self._make_commits(value)
84 84 self.__dict__[attr] = value
@@ -114,7 +114,7 b' class MercurialCommit(base.BaseCommit):'
114 114
115 115 @LazyProperty
116 116 def date(self):
117 return date_fromtimestamp(*self._remote.ctx_date(self.idx))
117 return utcdate_fromtimestamp(*self._remote.ctx_date(self.idx))
118 118
119 119 @LazyProperty
120 120 def status(self):
@@ -33,8 +33,7 b' from zope.cachedescriptors.property impo'
33 33
34 34 from rhodecode.lib.compat import OrderedDict
35 35 from rhodecode.lib.datelib import (
36 date_fromtimestamp, makedate, date_to_timestamp_plus_offset,
37 date_astimestamp)
36 utcdate_fromtimestamp, makedate, date_astimestamp)
38 37 from rhodecode.lib.utils import safe_unicode, safe_str
39 38 from rhodecode.lib.vcs import connection
40 39 from rhodecode.lib.vcs.backends.base import (
@@ -368,7 +367,7 b' class MercurialRepository(BaseRepository'
368 367 Returns last change made on this repository as
369 368 `datetime.datetime` object
370 369 """
371 return date_fromtimestamp(self._get_mtime(), makedate()[1])
370 return utcdate_fromtimestamp(self._get_mtime(), makedate()[1])
372 371
373 372 def _get_mtime(self):
374 373 try:
General Comments 0
You need to be logged in to leave comments. Login now