3
# IVLE - Informatics Virtual Learning Environment
4
# Copyright (C) 2008 The University of Melbourne
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
# Author: William Grant
24
# A CGI script for viewing a Subversion log. Used by the svnlog app.
30
from common import cgirequest
32
req = cgirequest.CGIRequest()
33
req.content_type = "text/html"
35
req.write('<h1>Subversion Log</h1>\n')
38
def pretty_time(epochtime):
39
return time.asctime(time.localtime(epochtime))
41
def pretty_path(path):
42
return '%s %s' % (path['action'], path['path'])
44
def pretty_paths(paths):
47
output += '<li>' + pretty_path(path) + '</li>'
53
<div class="svnlogentry">
54
<div class="svnloginfo">
55
Revision <strong>%d</strong> by <strong>%s</strong> on <strong>%s</strong>
59
<h2>Changed paths:</h2>
60
<div class="svnlogpathlist">
63
</div>''' % (log.revision.number, log.author, pretty_time(log.date),
64
log.message, pretty_paths(log.changed_paths))
67
client = pysvn.Client()
68
logs = client.log(os.path.join('/home', req.path), discover_changed_paths=True)
69
[req.write(pretty_log(log)) for log in logs]
70
except pysvn.ClientError, e:
71
req.write('<p><b>Error:</b></p>\n')
72
req.write('<pre>%s</pre>\n' % cgi.escape(str(e)))