~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/templates/revision.kid

[r=spiv] [!log] prevent turbogears/cherrypy from turning url query arguments into unicode strings.  fixes bug 175228 ("view revision = 500 Internal error").

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
2
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"
 
3
    py:extends="'master.kid'">
 
4
<head>
 
5
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" py:replace="''"/>
 
6
    <title> ${branch.friendly_name} : revision ${change.revno} </title>
 
7
    
 
8
    <span py:strip="True" py:def="file_link(filename, file_id)">
 
9
        <a href="${branch.url([ '/annotate', revid ],
 
10
            **util.get_context(file_id=file_id))}" title="Annotate ${filename}">${filename}</a>
 
11
    </span>
 
12
    <span py:strip="True" py:def="file_link_rev(filename, file_id, revid)">
 
13
        <a href="${branch.url([ '/annotate', revid ],
 
14
            **util.get_context(file_id=file_id))}" title="Annotate ${filename} at revision ${history.get_revno(revid)}">${filename}</a>
 
15
    </span>
 
16
    
 
17
    <span py:replace="use_collapse_buttons()"></span>
 
18
    
 
19
    <script type="text/javascript"> <!--
 
20
    function show_sbs(path) {
 
21
        collapseDisplay('style', 'sbs', 'table');
 
22
        collapseDisplay('style', 'unified', 'none');
 
23
        document.cookie='diff=sbs; path=' + path; 
 
24
    }
 
25
    function show_unified(path) {
 
26
        collapseDisplay('style', 'unified', 'table');
 
27
        collapseDisplay('style', 'sbs', 'none');
 
28
        document.cookie='diff=unified; path=' + path; 
 
29
    }
 
30
    function load(path) {
 
31
        sortCollapseElements();
 
32
        if (document.cookie.indexOf('diff=unified') >= 0) {
 
33
            show_unified(path);
 
34
        }
 
35
        if (document.cookie.indexOf('stop=1') >= 0) {
 
36
            return;
 
37
        }
 
38
        if (document.cookie.indexOf('diff=unified') >= 0) {
 
39
            window.location.hash = window.location.hash;
 
40
            document.cookie='stop=1; max-age=5; path=' + window.location.pathname;
 
41
        } 
 
42
    }
 
43
    // --> </script>
 
44
</head>
 
45
 
 
46
<body onload="javascript:load('${branch.url('/')}')">
 
47
 
 
48
${navbar()}
 
49
 
 
50
<h1> <span class="branch-name">${branch.friendly_name}</span> : revision ${change.revno}
 
51
    <span py:if="compare_revid is not None"> (compared to revision ${history.get_revno(compare_revid)}) </span>
 
52
    
 
53
    <div class="links">
 
54
        <div> <b>&#8594;</b> <a href="${branch.context_url([ '/files', revid ])}">
 
55
            browse files at revision ${change.revno} </a> </div>
 
56
        <div> <b>&#8594;</b> <a href="${branch.context_url('/changes', start_revid=revid)}">
 
57
            view history from revision ${change.revno} </a> </div>
 
58
        <span py:if="compare_revid is not None" py:strip="True">
 
59
            <div> <b>&#8594;</b> <a href="${branch.url([ '/bundle', revid, compare_revid, 'bundle.txt' ])}">
 
60
                download bundle from ${history.get_revno(compare_revid)} to ${change.revno} </a> </div>
 
61
        </span>
 
62
        <span py:if="(remember is not None) and (compare_revid is None) and (revid != remember)" py:strip="True">
 
63
            <div> <b>&#8594;</b> <a href="${branch.context_url([ '/revision', revid ], compare_revid=remember)}">
 
64
                compare with revision ${history.get_revno(remember)} </a></div>
 
65
        </span>
 
66
        <span py:if="remember != revid" py:strip="True">
 
67
            <div> <b>&#8594;</b> <a href="${branch.context_url([ '/revision', revid ], remember=revid, compare_revid=None)}">
 
68
                compare with another revision </a></div>
 
69
        </span>
 
70
        <span py:if="compare_revid is not None" py:strip="True">
 
71
            <div> <b>&#8594;</b> <a href="${branch.context_url([ '/revision', compare_revid ], remember=revid, compare_revid=revid)}">
 
72
                reverse the comparison (${change.revno} to ${history.get_revno(compare_revid)})</a></div>
 
73
            <div> <b>&#8594;</b> <a href="${branch.context_url([ '/revision', revid ], remember=None, compare_revid=None)}">
 
74
                stop comparing with revision ${history.get_revno(compare_revid)} </a></div>
 
75
        </span>
 
76
    </div>
 
77
</h1>
 
78
 
 
79
<div class="revision-info">
 
80
    <table>
 
81
        <tr>
 
82
            <th class="author">committed by:</th>
 
83
            <td class="author"> ${util.hide_email(change.author)} </td>
 
84
        </tr>
 
85
        <tr>
 
86
            <th class="date">date:</th>
 
87
            <td class="date"> ${util.format_date(change.date)} </td>
 
88
        </tr>
 
89
 
 
90
        <tr py:if="len(change.merge_points) > 0">
 
91
            <th class="children"> merged in: </th>
 
92
            <td class="children">
 
93
                <span py:for="child in change.merge_points">
 
94
                    ${revision_link(child.revid, '(' + child.revno + util.if_present(' %s', child.branch_nick) + ')', clear=1, start_revid=child.revid)} <br /> 
 
95
                </span>
 
96
            </td>
 
97
        </tr>
 
98
        <tr py:if="len(change.parents) > 1">
 
99
                <th class="parents"> merged from: </th>
 
100
                <td class="parents">
 
101
                    <span py:for="parent in change.parents"><span py:if="parent.revid != change.parents[0].revid">
 
102
                        ${revision_link(parent.revid, '(' + parent.revno + util.if_present(' %s', parent.branch_nick) + ')', clear=1, start_revid=parent.revid)} <br />
 
103
                    </span></span>
 
104
                </td>
 
105
        </tr>
 
106
 
 
107
        <tr>
 
108
            <th class="description">description:</th>
 
109
            <td class="description"><span py:for="line in change.comment_clean">${XML(line)} <br /></span> </td>
 
110
        </tr>
 
111
        
 
112
        <tr class="divider"> <th></th> <td></td> </tr>
 
113
        
 
114
        <tr py:if="change.changes.added">
 
115
            <th class="files"> files added: </th>
 
116
            <td class="files"> <span py:for="filename, file_id in change.changes.added" class="filename">${file_link(filename, file_id)} <br /></span> </td>
 
117
        </tr>
 
118
        <tr py:if="change.changes.removed">
 
119
            <th class="files"> files removed: </th>
 
120
            <td class="files"> <span py:for="filename, file_id in change.changes.removed" class="filename">
 
121
                ${file_link_rev(filename, file_id, change.parents[0].revid)} <br /></span>
 
122
            </td>
 
123
        </tr>
 
124
        <tr py:if="change.changes.renamed">
 
125
            <th class="files"> files renamed: </th>
 
126
            <td class="files"> <span py:for="old_filename, new_filename, file_id in change.changes.renamed" class="filename">
 
127
                ${file_link(old_filename, file_id)} => ${file_link(new_filename, file_id)}<br />
 
128
            </span> </td>
 
129
        </tr>
 
130
        <tr py:if="change.changes.modified">
 
131
            <th class="files"> files modified: </th>
 
132
            <td class="files">
 
133
                <span py:for="item in change.changes.modified" class="collapse-style-sbs-content">
 
134
                    <a href="#${item.filename}-s" class="filename" title="Jump to ${item.filename} below">${item.filename}</a><br />
 
135
                </span>
 
136
                <span py:for="item in change.changes.modified" class="collapse-style-unified-content">
 
137
                    <a href="#${item.filename}-u" class="filename" title="Jump to ${item.filename} below">${item.filename}</a><br />
 
138
                </span>
 
139
            </td>
 
140
        </tr>
 
141
    </table>
 
142
</div>
 
143
 
 
144
<table class="diff-option-buttons">
 
145
<tr>
 
146
    <td> ${collapse_all_button('file', 'table-row')} </td>
 
147
 
 
148
    <td class="spacey">
 
149
        <a href="javascript:show_sbs('${branch.url('/')}')" class="hide-all collapse-style-sbs-show" title="collapse">
 
150
            <img src="${tg.url('/static/images/nav-small-out.gif')}" width="22" height="10" class="collapse-triangle" />show side by side</a>
 
151
        <a href="javascript:show_unified('${branch.url('/')}')" class="hide-all collapse-style-unified-show" title="expand">
 
152
            <img src="${tg.url('/static/images/nav-small-in.gif')}" width="22" height="10" class="collapse-triangle" />show unified diff</a>
 
153
    </td>
 
154
    
 
155
    <td class="diff-key-block diff-insert"></td>
 
156
    <td class="label"> added </td>
 
157
    <td class="diff-key-block diff-delete"></td>
 
158
    <td class="label"> removed</td>
 
159
</tr>
 
160
</table>
 
161
 
 
162
<!-- ! i'm not a big fan of embedding python code here, but the alternatives all seem to be worse -->
 
163
<?python uniqs={}; ?>
 
164
 
 
165
<div class="diff" py:if="change.changes.modified">
 
166
    <!-- ! side-by-side diff -->
 
167
    <table class="diff-block collapse-style-sbs-content">
 
168
        <span py:strip="True" py:for="item in change.changes.modified">
 
169
            <tr><th class="filename" colspan="4">
 
170
                ${collapse_button('file', util.uniq(uniqs, item.file_id), 'table-row')}
 
171
                <a href="${branch.url([ '/annotate', change.revid ], **util.get_context(file_id=item.file_id))}"
 
172
                    name="${item.filename}-s" title="Annotate ${item.filename}">${item.filename}</a>
 
173
            </th></tr>
 
174
 
 
175
            <span py:strip="True" py:for="chunk in item.sbs_chunks">
 
176
                <tr class="diff-chunk collapse-file-${util.uniq(uniqs, item.file_id)}-content">
 
177
                    <th class="lineno">old</th> <th></th> <th class="lineno">new</th> <th></th>
 
178
                </tr>
 
179
                <tr py:for="line in chunk.diff" class="diff-chunk collapse-file-${util.uniq(uniqs, item.file_id)}-content">
 
180
                    <span py:if="line.old_lineno" py:strip="True">
 
181
                        <td class="lineno">${line.old_lineno}</td>
 
182
                        <td class="diff-${line.old_type}">${line.old_line}</td>
 
183
                    </span>
 
184
                    <span py:if="not line.old_lineno" py:strip="True">
 
185
                        <td class="lineno-skip">${line.old_lineno}</td>
 
186
                        <td class="diff-${line.old_type}-skip">${line.old_line}</td>
 
187
                    </span>
 
188
                    <span py:if="line.new_lineno" py:strip="True">
 
189
                        <td py:if="line.new_lineno" class="lineno">${line.new_lineno}</td>
 
190
                        <td class="diff-${line.new_type}">${line.new_line}</td>
 
191
                    </span>
 
192
                    <span py:if="not line.new_lineno" py:strip="True">
 
193
                        <td py:if="not line.new_lineno" class="lineno-skip">${line.new_lineno}</td>
 
194
                        <td class="diff-${line.new_type}-skip">${line.new_line}</td>
 
195
                    </span>
 
196
                </tr>
 
197
                <tr class="diff-chunk-spacing collapse-file-${util.uniq(uniqs, item.file_id)}-content"> <td colspan="4"> &nbsp; </td> </tr>
 
198
            </span>
 
199
            <tr class="diff-spacing"> <td colspan="4"> &nbsp; </td> </tr>
 
200
        </span>
 
201
    </table>
 
202
    
 
203
    <!-- ! unified diff -->
 
204
    <table class="diff-block collapse-style-unified-content">
 
205
        <span py:strip="True" py:for="item in change.changes.modified">
 
206
            <tr><th class="filename" colspan="4">
 
207
                ${collapse_button('file', util.uniq(uniqs, item.file_id), 'table-row')}
 
208
                <a href="${branch.url([ '/annotate', change.revid ], **util.get_context(file_id=item.file_id))}"
 
209
                    name="${item.filename}-u" title="Annotate ${item.filename}">${item.filename}</a>
 
210
            </th></tr>
 
211
 
 
212
            <span py:strip="True" py:for="chunk in item.chunks">
 
213
                <tr class="diff-chunk collapse-file-${util.uniq(uniqs, item.file_id)}-content"> <th class="lineno">old</th> <th class="lineno">new</th> <th></th> <th></th> </tr>
 
214
                <tr py:for="line in chunk.diff" class="diff-chunk collapse-file-${util.uniq(uniqs, item.file_id)}-content">
 
215
                    <td class="lineno">${line.old_lineno}</td>
 
216
                    <td class="lineno">${line.new_lineno}</td>
 
217
                    <td class="diff-${line.type} text">${line.line}</td>
 
218
                    <td> </td>
 
219
                </tr>
 
220
                <tr class="diff-chunk-spacing collapse-file-${util.uniq(uniqs, item.file_id)}-content"> <td colspan="4"> &nbsp; </td> </tr>
 
221
            </span>
 
222
            <tr class="diff-spacing"> <td colspan="4"> &nbsp; </td> </tr>
 
223
        </span>
 
224
    </table>
 
225
 
 
226
</div>
 
227
 
 
228
<div py:if="navigation.prev_page_revid or navigation.next_page_revid" class="bar">
 
229
    <table>
 
230
        <tr>
 
231
        <td class="buttons">
 
232
            <a py:if="navigation.prev_page_revid" href="${navigation.prev_page_url}"> &lt; revision ${history.get_revno(navigation.prev_page_revid)} </a>
 
233
        </td>
 
234
        <td class="rbuttons" align="right">
 
235
            <a py:if="navigation.next_page_revid" href="${navigation.next_page_url}"> revision ${history.get_revno(navigation.next_page_revid)} &gt; </a>
 
236
        </td>
 
237
        </tr>
 
238
    </table>
 
239
</div>
 
240
 
 
241
</body>
 
242
</html>