Skip to content
Browse files

Handle repositories that contain no commits (e.g. those just created).

  • Loading branch information...
1 parent ce9e7a3 commit a768d12aaad416f7cbbc557ea1d9e4d34704cf9f Jochen Kupperschmidt committed Feb 29, 2012
Showing with 10 additions and 3 deletions.
  1. +4 −1 klaus.py
  2. +6 −2 templates/repo_list.html
View
5 klaus.py
@@ -240,7 +240,10 @@ def view(self):
refs = [repo[ref] for ref in repo.get_refs()]
refs.sort(key=lambda obj:getattr(obj, 'commit_time', None),
reverse=True)
- repos.append((name, refs[0].commit_time))
+ last_updated_at = None
+ if refs:
+ last_updated_at = refs[0].commit_time
+ repos.append((name, last_updated_at))
if 'by-last-update' in self.GET:
repos.sort(key=lambda x: x[1], reverse=True)
else:
View
8 templates/repo_list.html
@@ -8,12 +8,16 @@
</span>
</h2>
<ul class=repolist>
- {% for name, head in repos %}
+ {% for name, last_update_at in repos %}
<li>
<a href="{{ build_url('history', repo=name, commit_id='master', path='') }}">
<span class=name>{{ name }}</span>
<span class=last-updated>
- last updated {{ head|timesince }} ago
+ {% if last_update_at is not none %}
+ last updated {{ last_update_at|timesince }} ago
+ {% else %}
+ no commits yet
+ {% endif %}
</span></a>
</li>
{% endfor %}

0 comments on commit a768d12

Please sign in to comment.
Something went wrong with that request. Please try again.