Commit 8538cd04 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

commits_since

parent 6da24a77
......@@ -239,6 +239,10 @@ class Project(Links, NamedModel, TimeStampedModel):
self.updated = max(branch.updated, robotpkg.updated)
self.save()
def commits_since(self):
commits = self.git().git.rev_list(f'{self.version}..{self.main_branch()}')
return len(commits.split('\n')) if commits else 0
class Repo(TimeStampedModel):
name = models.CharField(max_length=200)
......
......@@ -29,12 +29,13 @@ class NamespaceTable(StrippedTable):
class ProjectTable(StrippedTable):
commits_since = tables.Column(accessor='commits_since', orderable=False)
repos = tables.Column(accessor='repos', orderable=False)
rpkgs = tables.Column(accessor='rpkgs', orderable=False)
class Meta:
model = models.Project
fields = ('main_namespace', 'name', 'license', 'homepage', 'updated')
fields = ('main_namespace', 'name', 'license', 'homepage', 'updated', 'version')
def render_name(self, record):
return record.get_link()
......
......@@ -25,9 +25,10 @@
<dt>Main namespace</dt> <dd>{{ project.main_namespace }}</dd>
<dt>Main branch</dt> <dd>{{ project.main_branch }}</dd>
<dt>Description</dt> <dd>{{ project.description }}</dd>
<dt>Version</dt> <dd>{{ project.version|default:"—" }}</dd>
<dt>Homepage</dt> <dd>{% if project.homepage %}<a href="{{ project.homepage }}">{{ project.homepage }}</a>{% else %}—{% endif %}</dd>
<dt>Updated</dt> <dd>{{ project.updated }}</dd>
<dt>Updated</dt> <dd>{{ project.updated }}</dd>
<dt>Version</dt> <dd>{{ project.version|default:"—" }}</dd>
<dt>Commits since</dt> <dd>{{ project.commits_since }}</dd>
</dl>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment