layerindex: show a layer's branches in a table on the layer page
PATCH 1/1 layerindex: show a layer's branches in a table on the layer page
For a layer like meta-qt6, where each branch tracks a different git branch, the layer page only showed the branch being viewed. Add a Branches tab listing every branch of the layer, with the git branch it tracks (actual_branch), the date of its last commit, and whether it is still updated.
[YOCTO #15380]
AI-Generated: Claude Opus 5.5
---
This depends on "[PATCH v2] layerindex: show when a layer branch is no longer updated" (bug 14781) for the updates column, and applies on top of it and on master-next. Editing the branches, also asked for in the bug, would follow separately.
On a test instance loaded with a copy of the layers.openembedded.org database, meta-qt6's table shows each branch's git branch (master: dev,
scarthgap: lts-6.8, kirkstone: 6.5, ...) and that langdale is no longer updated.
layerindex/views.py | 1 + templates/layerindex/detail.html | 23 ++++++++++++++++ tests/test_branch_table.py | 45 ++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 tests/test_branch_table.py
layerindex/views.py +1 -0
@@ -493,6 +493,7 @@ class LayerDetailView(DetailView): context['appends'] = layerbranch.bbappend_set.order_by('filename') context['classes'] = layerbranch.bbclass_set.order_by('name') context['updates'] = LayerUpdate.objects.filter(layer=layerbranch.layer, branch=layerbranch.branch).order_by('-started') + context['layerbranches'] = LayerBranch.objects.filter(layer=layer, branch__hidden=False, branch__comparison=False).select_related('layer', 'branch').order_by('branch__sort_priority') context['url_branch'] = self.kwargs['branch'] context['this_url_name'] = resolve(self.request.path_info).url_name if 'rrs' in settings.INSTALLED_APPS:
templates/layerindex/detail.html +23 -0
@@ -224,6 +224,7 @@ {% if updates.count > 0 %} <li><a href="#updates" data-toggle="tab">Updates</a></li> {% endif %} + <li><a href="#branches" data-toggle="tab">Branches</a></li> </ul> <div class="tab-content">
@@ -393,6 +394,28 @@ </table> </div> {% endif %} + <div class="tab-pane" id="branches"> + <table class="table table-bordered"> + <thead> + <tr> + <th>Branch</th> + <th>Git branch</th> + <th>Last commit</th> + <th>Updates</th> + </tr> + </thead> + <tbody> + {% for lb in layerbranches %} + <tr> + <td>{% if lb.branch.name == url_branch %}<b>{{ lb.branch.name }}</b>{% else %}<a href="{% url 'layer_item' lb.branch.name layeritem.name %}">{{ lb.branch.name }}</a>{% endif %}</td> + <td>{{ lb.get_checkout_branch }}</td> + <td>{% if lb.vcs_last_commit %}{{ lb.vcs_last_commit|date:"Y-m-d" }}{% else %}<span class="text-muted">not indexed</span>{% endif %}</td> + <td>{% with reason=lb.updates_disabled_reason %}{% if reason %}<span class="label label-default label-not-updated">not updated</span> <small class="text-muted">{{ reason }}</small>{% else %}updated{% endif %}{% endwith %}</td> + </tr> + {% endfor %} + </tbody> + </table> + </div> </div>
tests/test_branch_table.py new file +45 -0
45 lines not on this page · raw message
base-commit: 08e58cdece30019a6f9e5d14af16ebe20afa6177
prerequisite-patch-id: d08807a0e95947278caa6b5f1c6c2e6e74dba0e5
Signature · 1 line
2.56.0