Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
722247c2be | ||
|
39cff29f4b |
11
git.py
11
git.py
@ -223,6 +223,17 @@ class Repo:
|
||||
refs = self._for_each_ref(pattern="refs/heads/", sort="-authordate")
|
||||
return [ref[len("refs/heads/") :] for _, _, ref in refs]
|
||||
|
||||
@functools.cache
|
||||
def main_branch(self):
|
||||
"""Get the name of the main branch."""
|
||||
bs = self.branch_names()
|
||||
for branch in ["master", "main"]:
|
||||
if branch in bs:
|
||||
return branch
|
||||
if bs:
|
||||
return bs[0]
|
||||
return None
|
||||
|
||||
@functools.cache
|
||||
def tags(self, sort="-taggerdate"):
|
||||
"""Get the (name, obj_id) of the tags."""
|
||||
|
@ -159,6 +159,15 @@ table.projects td.name a {
|
||||
}
|
||||
|
||||
|
||||
/* Truncate long descriptions based on the viewport width. */
|
||||
table.projects td.desc {
|
||||
max-width: 50vw;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
|
||||
/* Age of an object.
|
||||
* Note this is hidden by default as we rely on javascript to show it. */
|
||||
span.age {
|
||||
|
@ -20,7 +20,8 @@
|
||||
% for repo in sorted(repos.values(), key = lambda r: r.name):
|
||||
<tr>
|
||||
<td class="name"><a href="r/{{repo.name}}/">{{repo.name}}</a></td>
|
||||
<td class="desc"><a href="r/{{repo.name}}/">{{repo.info.desc}}</a></td>
|
||||
<td class="desc"><a href="r/{{repo.name}}/" title="{{repo.info.desc}}">
|
||||
{{repo.info.desc}}</a></td>
|
||||
<td><span class="age">{{repo.last_commit_timestamp()}}</span></td>
|
||||
</tr>
|
||||
%end
|
||||
|
@ -35,20 +35,22 @@
|
||||
<hr/>
|
||||
% end
|
||||
|
||||
% if "master" in repo.branch_names():
|
||||
% if repo.main_branch():
|
||||
<div class="toggable-title" onclick="toggle('commits')">
|
||||
<a href="b/master/">commits (master)</a>
|
||||
<a href="b/{{repo.main_branch()}}/">commits ({{repo.main_branch()}})</a>
|
||||
</div>
|
||||
% kwargs = dict(repo = repo, start_ref = "refs/heads/master",
|
||||
% kwargs = dict(repo = repo,
|
||||
% start_ref = "refs/heads/" + repo.main_branch(),
|
||||
% limit = repo.info.commits_in_summary,
|
||||
% shorten = shorten, repo_root = ".", offset = 0)
|
||||
% include commit-list **kwargs
|
||||
<hr/>
|
||||
<div class="toggable-title" onclick="toggle('ls')">
|
||||
<a href="b/master/t/">tree (master)</a>
|
||||
<a href="b/{{repo.main_branch()}}/t/">tree ({{repo.main_branch()}})</a>
|
||||
</div>
|
||||
% kwargs = dict(repo = repo, tree=repo.tree("master"),
|
||||
% treeroot="b/master/t", dirname=smstr.from_url(""))
|
||||
% kwargs = dict(repo = repo, tree=repo.tree(repo.main_branch()),
|
||||
% treeroot="b/" + repo.main_branch() + "/t",
|
||||
% dirname=smstr.from_url(""))
|
||||
% include tree-list **kwargs
|
||||
<hr/>
|
||||
% end
|
||||
|
Loading…
Reference in New Issue
Block a user