Robustness fixes in the query stuffs where empty or missing revision

metadata occurs.

* lib/cvsdb.py
  (Commit.SetTime, Commit.GetTime, CheckinDatabase.AddCommit): Handle
    missing dates.

* bin/svndbadmin
  (SvnRev.__init__): Handle missing or invalid datestamps.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1534 8cb11bc2-c004-0410-86c3-e597b4017df7
remotes/options-overhaul
cmpilato 2007-02-26 20:20:04 +00:00
parent 891dfa4b85
commit 300a8236cb
2 changed files with 16 additions and 8 deletions

View File

@ -142,13 +142,16 @@ class SvnRev:
subpool = svn.core.svn_pool_create(pool)
# revision properties ...
properties = svn.fs.revision_proplist(repo.fs, rev, pool)
self.author = str(properties.get(svn.core.SVN_PROP_REVISION_AUTHOR,''))
self.date = str(properties.get(svn.core.SVN_PROP_REVISION_DATE, ''))
self.log = str(properties.get(svn.core.SVN_PROP_REVISION_LOG, ''))
revprops = svn.fs.revision_proplist(repo.fs, rev, pool)
self.author = str(revprops.get(svn.core.SVN_PROP_REVISION_AUTHOR,''))
self.date = str(revprops.get(svn.core.SVN_PROP_REVISION_DATE, ''))
self.log = str(revprops.get(svn.core.SVN_PROP_REVISION_LOG, ''))
# convert the date string to seconds since epoch ...
self.date = svn.core.secs_from_timestr(self.date, pool)
try:
self.date = svn.core.secs_from_timestr(self.date, pool)
except:
self.date = None
# get a root for the current revisions
fsroot = self._get_root_for_rev(rev)

View File

@ -240,7 +240,7 @@ class CheckinDatabase:
self.AddCommit(commit)
def AddCommit(self, commit):
ci_when = dbi.DateTimeFromTicks(commit.GetTime())
ci_when = dbi.DateTimeFromTicks(commit.GetTime() or 0.0)
ci_type = commit.GetTypeString()
who_id = self.GetAuthorID(commit.GetAuthor())
repository_id = self.GetRepositoryID(commit.GetRepository())
@ -531,10 +531,15 @@ class Commit:
return self.__revision
def SetTime(self, gmt_time):
self.__gmt_time = float(gmt_time)
if gmt_time is None:
### We're just going to assume that a datestamp of The Epoch
### ain't real.
self.__gmt_time = 0.0
else:
self.__gmt_time = float(gmt_time)
def GetTime(self):
return self.__gmt_time
return self.__gmt_time and self.__gmt_time or None
def SetAuthor(self, author):
self.__author = author