Apply a patch from apache.org: watch out (and recover) for files which have

"illegal" timestamps in them.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@180 8cb11bc2-c004-0410-86c3-e597b4017df7
remotes/tags/V0_7
gstein 2001-05-12 12:26:46 +00:00
parent edf252fb2f
commit d790f07d2c
1 changed files with 16 additions and 1 deletions

View File

@ -840,7 +840,22 @@ def parse_log_entry(fp):
# there was a parsing error
return None, eof
date = int(time.mktime(compat.cvs_strptime(match.group(1)))) - time.timezone
# parse out a time tuple for the local time
tm = compat.cvs_strptime(match.group(1))
try:
date = int(time.mktime(tm)) - time.timezone
except OverflowError:
# it is possible that CVS recorded an "illegal" time, such as those
# which occur during a Daylight Savings Time switchover (there is a
# gap in the time continuum). Let's advance one hour and try again.
# While the time isn't necessarily "correct", recall that the gap means
# that times *should* be an hour forward. This is certainly close enough
# for our needs.
#
# Note: a true overflow will simply raise an error again, which we won't
# try to catch a second time.
tm = tm[:3] + (tm[3] + 1,) + tm[4:]
date = int(time.mktime(tm)) - time.timezone
return LogEntry(rev, date,
# author, state, lines changed