diff --git a/lib/vclib/svn/__init__.py b/lib/vclib/svn/__init__.py
index 94b97180..424cc8e1 100644
--- a/lib/vclib/svn/__init__.py
+++ b/lib/vclib/svn/__init__.py
@@ -102,7 +102,10 @@ def _rootpath2url(rootpath, path):
def _datestr_to_date(datestr):
- return datestr and core.svn_time_from_cstring(datestr) / 1000000 or None
+ try:
+ return core.svn_time_from_cstring(datestr) / 1000000
+ except:
+ return None
def _fs_rev_props(fsptr, rev):
diff --git a/lib/viewvc.py b/lib/viewvc.py
index 07e3820f..a99e49e0 100644
--- a/lib/viewvc.py
+++ b/lib/viewvc.py
@@ -968,12 +968,16 @@ def get_file_view_info(request, where, rev=None, mime_type=None, pathrev=-1):
_re_rewrite_url = re.compile('((http|https|ftp|file|svn|svn\+ssh)(://[-a-zA-Z0-9%.~:_/]+)((\?|\&)([-a-zA-Z0-9%.~:_]+)=([-a-zA-Z0-9%.~:_])+)*(#([-a-zA-Z0-9%.~:_]+)?)?)')
_re_rewrite_email = re.compile('([-a-zA-Z0-9_.\+]+)@(([-a-zA-Z0-9]+\.)+[A-Za-z]{2,4})')
def htmlify(html):
+ if not html:
+ return html
html = cgi.escape(html)
html = re.sub(_re_rewrite_url, r'\1', html)
html = re.sub(_re_rewrite_email, r'\1@\2', html)
return html
def format_log(log, cfg):
+ if not log:
+ return log
s = htmlify(log[:cfg.options.short_log_len])
if len(log) > cfg.options.short_log_len:
s = s + '...'
@@ -1359,7 +1363,7 @@ def make_time_string(date, cfg):
"""
if date is None:
- return 'Unknown date'
+ return None
if cfg.options.use_localtime:
localtime = time.localtime(date)
return time.asctime(localtime) + ' ' + time.tzname[localtime[8]]
@@ -1373,7 +1377,7 @@ def make_rss_time_string(date, cfg):
"""
if date is None:
- return 'Unknown date'
+ return None
return time.strftime("%a, %d %b %Y %H:%M:%S", time.gmtime(date)) + ' UTC'
def view_markup(request):
@@ -1623,7 +1627,7 @@ def view_directory(request):
if file.date is not None:
row.date = make_time_string(file.date, cfg)
row.ago = html_time(request, file.date)
- if cfg.options.show_logs and file.log is not None:
+ if cfg.options.show_logs:
row.short_log = format_log(file.log, cfg)
row.log = htmlify(file.log)
@@ -3315,8 +3319,6 @@ def build_commit(request, files, limited_files, dir_strip):
commit_time = f.GetTime()
if commit_time:
commit_time = make_time_string(commit_time, request.cfg)
- else:
- commit_time = ' '
dirname = f.GetDirectory()
filename = f.GetFile()
@@ -3516,7 +3518,8 @@ def view_query(request):
dir_strip = _path_join(repos_dir)
for commit in query.commit_list:
# base modification time on the newest commit ...
- if commit.GetTime() > mod_time: mod_time = commit.GetTime()
+ if commit.GetTime() > mod_time:
+ mod_time = commit.GetTime()
# form plus/minus totals
plus_count = plus_count + int(commit.GetPlusCount())
minus_count = minus_count + int(commit.GetMinusCount())
diff --git a/templates/log.ezt b/templates/log.ezt
index 7dce9a89..8133492d 100644
--- a/templates/log.ezt
+++ b/templates/log.ezt
@@ -48,7 +48,9 @@
[if-index entries last]Added[else]Modified[end]
[end]
- [entries.date] ([entries.ago] ago) by [entries.author]
+ [if-any entries.date][entries.date][else](unknown date)[end]
+ [if-any entries.ago]([entries.ago] ago)[end]
+ by [if-any entries.author][entries.author][else](unknown author)[end]
[if-any entries.orig_path]
Original Path: [entries.orig_path]
diff --git a/templates/log_table.ezt b/templates/log_table.ezt
index 591df9db..203c9c2b 100644
--- a/templates/log_table.ezt
+++ b/templates/log_table.ezt
@@ -126,7 +126,8 @@
[is roottype "svn"]
[if-index entries last]Added[else]Modified[end]
[end]
- [entries.ago] ago
[entries.date]
+ [if-any entries.ago][entries.ago] ago
[end]
+ [if-any entries.date][entries.date][end]
[is roottype "cvs"]
[if-any entries.prev]
[if-any entries.changed]
diff --git a/templates/markup.ezt b/templates/markup.ezt
index a39394cd..9c0ae438 100644
--- a/templates/markup.ezt
+++ b/templates/markup.ezt
@@ -13,9 +13,9 @@ Revision [if-any revision_href][rev]<
[if-any annotate_href](annotate)[end]
[if-any vendor_branch] (vendor branch)[end]
-
[if-any date][date][end]
+
[if-any date][date][else](unknown date)[end]
[if-any ago]([ago] ago)[end]
- [if-any author]by [author][end]
+ by [if-any author][author][else](unknown author)[end]
[if-any orig_path]
Original Path: [orig_path]
[end]
diff --git a/templates/revision.ezt b/templates/revision.ezt
index fdd11ac7..284b90b2 100644
--- a/templates/revision.ezt
+++ b/templates/revision.ezt
@@ -21,11 +21,12 @@