Author | zPlus <zplus@peers.community> 2022-08-04 16:25:57 |
Committer | zPlus <zplus@peers.community> 2022-08-04 16:25:57 |
Commit | 87759ce (patch) |
Tree | 5ae788d |
Parent(s) |
-rw-r--r-- | static/css/clif.css | 47 | ||
-rw-r--r-- | templates/repository/refs.html | 83 | ||
-rw-r--r-- | web.py | 47 |
index f5d98e5..0b4965d | |||
old size: 6K - new size: 6K | |||
@@ -69,10 +69,6 @@ pre { | |||
69 | 69 | padding: .2rem; | |
70 | 70 | } | |
71 | 71 | ||
72 | - | .repositories_list > div:hover { | |
73 | - | background-color: #e3ecfa; | |
74 | - | } | |
75 | - | ||
76 | 72 | .repository { | |
77 | 73 | display: flex; | |
78 | 74 | width: 100%; | |
@@ -119,19 +115,6 @@ ul.menu { | |||
119 | 115 | border-bottom: .2rem solid black; | |
120 | 116 | } | |
121 | 117 | ||
122 | - | div.ref_title { | |
123 | - | font-weight: bold; | |
124 | - | margin-bottom: 1rem; | |
125 | - | } | |
126 | - | ||
127 | - | div.ref_title:not(:first-child) { | |
128 | - | margin-top: 4rem; | |
129 | - | } | |
130 | - | ||
131 | - | div.ref_title ~ div.ref { | |
132 | - | margin: 0 0 0 1rem; | |
133 | - | } | |
134 | - | ||
135 | 118 | span.head_label { | |
136 | 119 | background-color: #b9faca; | |
137 | 120 | border-radius: .1rem; | |
@@ -159,6 +142,28 @@ div.tree_list { | |||
159 | 142 | background-color: #e3ecfa; | |
160 | 143 | } | |
161 | 144 | ||
145 | + | table.refs { | |
146 | + | width: 100%; | |
147 | + | } | |
148 | + | ||
149 | + | table.refs tr td:nth-child(1) { | |
150 | + | width: 10%; | |
151 | + | } | |
152 | + | ||
153 | + | table.refs tr td:nth-child(3) { | |
154 | + | width: 10%; | |
155 | + | } | |
156 | + | ||
157 | + | table.refs .lightweight { | |
158 | + | font-size: .75rem; | |
159 | + | vertical-align: middle; | |
160 | + | } | |
161 | + | ||
162 | + | table.refs .annotated { | |
163 | + | font-size: .75rem; | |
164 | + | vertical-align: middle; | |
165 | + | } | |
166 | + | ||
162 | 167 | table.log { | |
163 | 168 | border-spacing: 0; | |
164 | 169 | width: 100%; | |
@@ -184,10 +189,6 @@ table.log { | |||
184 | 189 | ||
185 | 190 | table.log > tbody { | |
186 | 191 | } | |
187 | - | ||
188 | - | table.log > tbody > tr:hover { | |
189 | - | background-color: #e3ecfa; | |
190 | - | } | |
191 | 192 | ||
192 | 193 | table.log > tbody td.short_id { | |
193 | 194 | font-family: ui-monospace, monospace; | |
@@ -302,6 +303,10 @@ div.threads { | |||
302 | 303 | background-color: #f8f8f8; | |
303 | 304 | } | |
304 | 305 | ||
306 | + | .striped > *:hover { | |
307 | + | background-color: #ededed; | |
308 | + | } | |
309 | + | ||
305 | 310 | /* Override some Pygments rules of the default style */ | |
306 | 311 | .highlight { | |
307 | 312 | background: none; |
index cd8b50a..e2b4594 | |||
old size: 800B - new size: 3K | |||
@@ -6,24 +6,73 @@ | |||
6 | 6 | ||
7 | 7 | {% block content %} | |
8 | 8 | ||
9 | - | <div class="ref_title">Heads</div> | |
9 | + | <table class="refs"> | |
10 | + | <thead> | |
11 | + | <tr> | |
12 | + | <td><b>Head</b></td> | |
13 | + | <td><b>Commit</b></td> | |
14 | + | <td><b>Committed</b></td> | |
15 | + | </tr> | |
16 | + | </thead> | |
17 | + | <tbody class="striped"> | |
18 | + | {% for head in heads %} | |
19 | + | <tr> | |
20 | + | <td> | |
21 | + | <a href="{{ url('tree', repository=repository[:-4], revision=head.ref.shorthand) }}">{{ head.ref.shorthand }}</a> | |
22 | + | ||
23 | + | {% if head.ref.name == HEAD %} | |
24 | + | <span class="head_label">HEAD</span> | |
25 | + | {% endif %} | |
26 | + | </td> | |
27 | + | <td> | |
28 | + | [{{ head.commit.short_id }}] | |
29 | + | {{ head.commit.message[:80] }}... | |
30 | + | </td> | |
31 | + | <td> | |
32 | + | {{ commit_time(head.commit.committer.time, head.commit.committer.offset)|ago }} | |
33 | + | </td> | |
34 | + | </tr> | |
35 | + | {% endfor %} | |
36 | + | </tbody> | |
37 | + | </table> | |
10 | 38 | ||
11 | - | {% for branch in heads %} | |
12 | - | <div class="ref"> | |
13 | - | <a href="{{ url('tree', repository=repository[:-4], revision=branch[11:]) }}">{{ branch[11:] }}</a> | |
14 | - | ||
15 | - | {% if branch == head %} | |
16 | - | <span class="head_label">HEAD</span> | |
17 | - | {% endif %} | |
18 | - | </div> | |
19 | - | {% endfor %} | |
39 | + | <br /><br /> | |
20 | 40 | ||
21 | - | <div class="ref_title">Tags</div> | |
22 | - | ||
23 | - | {% for tag in tags %} | |
24 | - | <div class="ref"> | |
25 | - | <a href="{{ url('tree', repository=repository[:-4], revision=tag[10:]) }}">{{ tag[10:] }}</a> | |
26 | - | </div> | |
27 | - | {% endfor %} | |
41 | + | <table class="refs"> | |
42 | + | <thead> | |
43 | + | <tr> | |
44 | + | <td><b>Tag</b></td> | |
45 | + | <td><b>Tagger</b></td> | |
46 | + | <td><b>Tagged</b></td> | |
47 | + | </tr> | |
48 | + | </thead> | |
49 | + | <tbody class="striped"> | |
50 | + | {% for tag in tags %} | |
51 | + | <tr> | |
52 | + | <td> | |
53 | + | {% if tag.is_annotated %} | |
54 | + | <span title="Annotated" class="annotated">A</span> | |
55 | + | {% else %} | |
56 | + | <span title="Lightweight" class="lightweight">L</span> | |
57 | + | {% endif %} | |
58 | + | ||
59 | + | <a href="{{ url('tree', repository=repository[:-4], revision=tag.ref.shorthand) }}">{{ tag.ref.shorthand }}</a> | |
60 | + | </td> | |
61 | + | <td> | |
62 | + | {% if tag.object.tagger %} | |
63 | + | <span title="{{ tag.object.tagger.email }}"> | |
64 | + | {{ tag.object.tagger.name }} | |
65 | + | </span> | |
66 | + | {% endif %} | |
67 | + | </td> | |
68 | + | <td> | |
69 | + | {% if tag.object.tagger %} | |
70 | + | {{ commit_time(tag.object.tagger.time, tag.object.tagger.offset)|ago }} | |
71 | + | {% endif %} | |
72 | + | </td> | |
73 | + | </tr> | |
74 | + | {% endfor %} | |
75 | + | </tbody> | |
76 | + | </table> | |
28 | 77 | ||
29 | 78 | {% endblock %} |
index e36d895..80c7971 | |||
old size: 24K - new size: 24K | |||
@@ -283,27 +283,50 @@ def refs(repository): | |||
283 | 283 | return template('repository/refs.html', | |
284 | 284 | repository=repository) | |
285 | 285 | ||
286 | - | HEAD = None | |
286 | + | try: HEAD = repo.head.name | |
287 | + | except: HEAD = None | |
288 | + | ||
287 | 289 | heads = [] | |
288 | 290 | tags = [] | |
289 | 291 | ||
290 | 292 | for ref in repo.references: | |
291 | - | if ref.startswith('refs/heads/'): | |
292 | - | heads.append(ref) | |
293 | - | if ref.startswith('refs/tags/'): | |
294 | - | tags.append(ref) | |
293 | + | ref = repo.references.get(ref) | |
294 | + | ||
295 | + | if not ref: | |
296 | + | continue | |
297 | + | ||
298 | + | if ref.name.startswith('refs/heads/'): | |
299 | + | heads.append({ | |
300 | + | 'ref': ref, | |
301 | + | 'commit': ref.peel(pygit2.GIT_OBJ_COMMIT) | |
302 | + | }) | |
303 | + | ||
304 | + | if ref.name.startswith('refs/tags/'): | |
305 | + | target = repo.get(str(ref.target)) | |
306 | + | ||
307 | + | tags.append({ | |
308 | + | 'ref': ref, | |
309 | + | 'object': target, | |
310 | + | 'is_annotated': target.type == pygit2.GIT_OBJ_TAG | |
311 | + | }) | |
295 | 312 | ||
296 | - | heads.sort() | |
297 | - | tags.sort() | |
313 | + | heads.sort(key = lambda item: item['ref'].name) | |
298 | 314 | ||
299 | - | try: | |
300 | - | HEAD = repo.head.name | |
301 | - | except: | |
302 | - | pass | |
315 | + | def tagsort(item): | |
316 | + | try: | |
317 | + | if item['object'].type == pygit2.GIT_OBJ_TAG: | |
318 | + | return item['object'].tagger.time | |
319 | + | ||
320 | + | if item['object'].type == pygit2.GIT_OBJ_COMMIT: | |
321 | + | return item['object'].commit_time | |
322 | + | except: | |
323 | + | return 0 | |
324 | + | ||
325 | + | tags.sort(key = lambda item: tagsort(item), reverse=True) | |
303 | 326 | ||
304 | 327 | return template('repository/refs.html', | |
305 | 328 | repository=repository, | |
306 | - | heads=heads, tags=tags, head=HEAD) | |
329 | + | heads=heads, tags=tags, HEAD=HEAD) | |
307 | 330 | ||
308 | 331 | @bottle.get('/<repository:path>.git/tree/<revision>', name='tree') | |
309 | 332 | @bottle.get('/<repository:path>.git/tree/<revision>/<tree_path:path>', name='tree_path') |