diff --git a/static/css/clif.css b/static/css/clif.css index f5d98e5..0b4965d 100644 --- a/static/css/clif.css +++ b/static/css/clif.css @@ -69,10 +69,6 @@ pre { padding: .2rem; } -.repositories_list > div:hover { - background-color: #e3ecfa; -} - .repository { display: flex; width: 100%; @@ -119,19 +115,6 @@ ul.menu { border-bottom: .2rem solid black; } -div.ref_title { - font-weight: bold; - margin-bottom: 1rem; -} - -div.ref_title:not(:first-child) { - margin-top: 4rem; -} - - div.ref_title ~ div.ref { - margin: 0 0 0 1rem; - } - span.head_label { background-color: #b9faca; border-radius: .1rem; @@ -159,6 +142,28 @@ div.tree_list { background-color: #e3ecfa; } +table.refs { + width: 100%; +} + + table.refs tr td:nth-child(1) { + width: 10%; + } + + table.refs tr td:nth-child(3) { + width: 10%; + } + + table.refs .lightweight { + font-size: .75rem; + vertical-align: middle; + } + + table.refs .annotated { + font-size: .75rem; + vertical-align: middle; + } + table.log { border-spacing: 0; width: 100%; @@ -184,10 +189,6 @@ table.log { table.log > tbody { } - - table.log > tbody > tr:hover { - background-color: #e3ecfa; - } table.log > tbody td.short_id { font-family: ui-monospace, monospace; @@ -302,6 +303,10 @@ div.threads { background-color: #f8f8f8; } +.striped > *:hover { + background-color: #ededed; +} + /* Override some Pygments rules of the default style */ .highlight { background: none; diff --git a/templates/repository/refs.html b/templates/repository/refs.html index cd8b50a..e2b4594 100644 --- a/templates/repository/refs.html +++ b/templates/repository/refs.html @@ -6,24 +6,73 @@ {% block content %} -
Heads
+ + + + + + + + + + {% for head in heads %} + + + + + + {% endfor %} + +
HeadCommitCommitted
+ {{ head.ref.shorthand }} + + {% if head.ref.name == HEAD %} + HEAD + {% endif %} + + [{{ head.commit.short_id }}] + {{ head.commit.message[:80] }}... + + {{ commit_time(head.commit.committer.time, head.commit.committer.offset)|ago }} +
- {% for branch in heads %} -
- {{ branch[11:] }} - - {% if branch == head %} - HEAD - {% endif %} -
- {% endfor %} +

-
Tags
- - {% for tag in tags %} -
- {{ tag[10:] }} -
- {% endfor %} + + + + + + + + + + {% for tag in tags %} + + + + + + {% endfor %} + +
TagTaggerTagged
+ {% if tag.is_annotated %} + A + {% else %} + L + {% endif %} + + {{ tag.ref.shorthand }} + + {% if tag.object.tagger %} + + {{ tag.object.tagger.name }} + + {% endif %} + + {% if tag.object.tagger %} + {{ commit_time(tag.object.tagger.time, tag.object.tagger.offset)|ago }} + {% endif %} +
{% endblock %} diff --git a/web.py b/web.py index e36d895..80c7971 100644 --- a/web.py +++ b/web.py @@ -283,27 +283,50 @@ def refs(repository): return template('repository/refs.html', repository=repository) - HEAD = None + try: HEAD = repo.head.name + except: HEAD = None + heads = [] tags = [] for ref in repo.references: - if ref.startswith('refs/heads/'): - heads.append(ref) - if ref.startswith('refs/tags/'): - tags.append(ref) + ref = repo.references.get(ref) + + if not ref: + continue + + if ref.name.startswith('refs/heads/'): + heads.append({ + 'ref': ref, + 'commit': ref.peel(pygit2.GIT_OBJ_COMMIT) + }) + + if ref.name.startswith('refs/tags/'): + target = repo.get(str(ref.target)) + + tags.append({ + 'ref': ref, + 'object': target, + 'is_annotated': target.type == pygit2.GIT_OBJ_TAG + }) - heads.sort() - tags.sort() + heads.sort(key = lambda item: item['ref'].name) - try: - HEAD = repo.head.name - except: - pass + def tagsort(item): + try: + if item['object'].type == pygit2.GIT_OBJ_TAG: + return item['object'].tagger.time + + if item['object'].type == pygit2.GIT_OBJ_COMMIT: + return item['object'].commit_time + except: + return 0 + + tags.sort(key = lambda item: tagsort(item), reverse=True) return template('repository/refs.html', repository=repository, - heads=heads, tags=tags, head=HEAD) + heads=heads, tags=tags, HEAD=HEAD) @bottle.get('/.git/tree/', name='tree') @bottle.get('/.git/tree//', name='tree_path')