~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/templates/revision.kid

by accident, i noticed today that loggerhead is sometimes leaving a lot of
file descriptors open.  i think they all come from this one piece of code
that could potentially return without closing the changes cache.  grr.

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