~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to scripts/svnlogservice

  • Committer: wagrant
  • Date: 2008-07-16 05:10:49 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:891
svnlogservice: Link changed paths.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
def pretty_time(epochtime):
41
41
    return time.asctime(time.localtime(epochtime))
42
42
 
43
 
def pretty_path(path):
44
 
    return '%s %s' % (path['action'], path['path'])
 
43
def pretty_path(cpath, revno=None):
 
44
    path = cpath['path']
 
45
    # XXX: We can't assume that the repository root is always equivalent to
 
46
    #      the current user's home directory, although it does work for our
 
47
    #      current setup.
 
48
    url = common.util.make_path(os.path.join('files',
 
49
                                    common.util.split_path(req.path)[0],
 
50
                                    path[1:]))
 
51
    if revno:
 
52
        url += '?r=%d' % revno
 
53
    return '%s <a href="%s">%s</a>' % (cpath['action'], url, path)
45
54
 
46
 
def pretty_paths(paths):
 
55
def pretty_paths(paths, revno=None):
47
56
    output = '<ul>'
48
57
    for path in paths:
49
 
        output += '<li>' + pretty_path(path) + '</li>'
 
58
        output += '<li>' + pretty_path(path, revno) + '</li>'
50
59
    output += '</ul>'
51
60
    return output
52
61
 
54
63
    return '''
55
64
<div class="svnlogentry">
56
65
        <div class="svnloginfo">
57
 
                Revision <a href="%s?r=%d" style="font-weight: bold">%d</a> by <strong>%s</strong> on <strong>%s</strong>
 
66
                Revision <a href="%s?r=%d" style="font-weight: bold">%d</a>
 
67
                by <strong>%s</strong> on <strong>%s</strong>
58
68
        </div>
59
69
        <pre>%s</pre>
60
70
        <hr size="1"/>
65
75
</div>''' % (common.util.make_path(os.path.join('files', req.path)),
66
76
             log.revision.number, log.revision.number, log.author,
67
77
             pretty_time(log.date), log.message,
68
 
             pretty_paths(log.changed_paths))
 
78
             pretty_paths(log.changed_paths, log.revision.number))
69
79
 
70
80
try:
71
81
    client = pysvn.Client()