Branch comparison functionality
cover Branch comparison functionality
Add the ability to compare the available recipes and their versions in two different branches, plus one unrelated patch to fix an issue I noticed recently with cgit URLs.
The following changes since commit 1ce4a85d257ac928307ac0de6edf4cb80b50adce:
editlayer: Be more specific on the searches (2019-10-14 09:20:33 +1300)
are available in the Git repository at:
git://git.yoctoproject.org/layerindex-web paule/branch_comparison
http://git.yoctoproject.org/cgit.cgi/layerindex-web/log/?h=paule/branch_comparison
Paul Eggleton (3):
Track SRCREV for each recipe
Add branch comparison function
Fix cgit commit URL setting
layerindex/forms.py | 19 ++ layerindex/migrations/0043_recipe_srcrev.py | 20 ++ layerindex/models.py | 1 + layerindex/update_layer.py | 4 + layerindex/urls.py | 12 +- layerindex/views.py | 113 +++++++++- templates/base.html | 1 + templates/layerindex/branchcompare.html | 214 +++++++++++++++++++ templates/layerindex/branchcompare_plain.txt | 17 ++ templates/layerindex/editlayer.html | 2 +- templates/layerindex/recipedetail.html | 2 +- 11 files changed, 401 insertions(+), 4 deletions(-) create mode 100644 layerindex/migrations/0043_recipe_srcrev.py create mode 100644 templates/layerindex/branchcompare.html create mode 100644 templates/layerindex/branchcompare_plain.txt
Signature · 1 line
2.20.1
PATCH 1/3 Track SRCREV for each recipe
For the purposes of the branch comparison function I'm about to add it would be useful to track the value of SRCREV, so we can see if it has changed even if PV hasn't.
--- layerindex/migrations/0043_recipe_srcrev.py | 20 ++++++++++++++++++++ layerindex/models.py | 1 + layerindex/update_layer.py | 4 ++++ templates/layerindex/recipedetail.html | 2 +- 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 layerindex/migrations/0043_recipe_srcrev.py
layerindex/migrations/0043_recipe_srcrev.py new file +20 -0
@@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.22 on 2019-10-20 22:15 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('layerindex', '0042_recipe_pe_pr'), + ] + + operations = [ + migrations.AddField( + model_name='recipe', + name='srcrev', + field=models.CharField(blank=True, max_length=64), + ), + ]
layerindex/models.py +1 -0
@@ -475,6 +475,7 @@ class Recipe(models.Model): updated = models.DateTimeField(auto_now=True) blacklisted = models.CharField(max_length=255, blank=True) configopts = models.CharField(max_length=4096, blank=True) + srcrev = models.CharField(max_length=64, blank=True) def vcs_web_url(self): url = self.layerbranch.file_url(os.path.join(self.filepath, self.filename))
layerindex/update_layer.py +4 -0
@@ -110,6 +110,10 @@ def update_recipe_file(tinfoil, data, path, recipe, layerdir_start, repodir, sto recipe.pv = envdata.getVar("PV", True) recipe.pr = envdata.getVar("PR", True) or "" recipe.pe = envdata.getVar("PE", True) or "" + recipe.srcrev = envdata.getVar('SRCREV', True) or '' + if recipe.srcrev == 'INVALID': + # INVALID is the default from bitbake.conf, but we don't want to see it + recipe.srcrev = '' recipe.summary = envdata.getVar("SUMMARY", True) recipe.description = envdata.getVar("DESCRIPTION", True) recipe.section = envdata.getVar("SECTION", True)
templates/layerindex/recipedetail.html +1 -1
@@ -54,7 +54,7 @@ </tr> <tr> <th>Version</th> - <td>{{ recipe.pv }}</td> + <td>{{ recipe.pv }}{% if recipe.srcrev %} ({{ recipe.srcrev }}){% endif %}</td> </tr> <tr> <th>Summary</th>
Signature · 1 line
2.20.1
PATCH 2/3 Add branch comparison function
In reply to Paul EggletonAdd the ability to compare available recipes and their versions between two branches for a selection of layers (default is just OE-Core). This was mainly intended to help us with the Yocto Project release notes preparation (hence the "Plain text" button at the bottom of the page) but is also useful in its own right.
Note: for readability, SRCREVs are only shown when PV has not changed.
--- layerindex/forms.py | 19 ++ layerindex/urls.py | 12 +- layerindex/views.py | 113 +++++++++- templates/base.html | 1 + templates/layerindex/branchcompare.html | 214 +++++++++++++++++++ templates/layerindex/branchcompare_plain.txt | 17 ++ 6 files changed, 374 insertions(+), 2 deletions(-) create mode 100644 templates/layerindex/branchcompare.html create mode 100644 templates/layerindex/branchcompare_plain.txt
layerindex/forms.py +19 -0
@@ -354,3 +354,22 @@ class PatchDispositionForm(StyledModelForm): } PatchDispositionFormSet = modelformset_factory(PatchDisposition, form=PatchDispositionForm, extra=0) + + +class BranchComparisonForm(StyledForm): + from_branch = forms.ModelChoiceField(label='From', queryset=Branch.objects.none()) + to_branch = forms.ModelChoiceField(label='To', queryset=Branch.objects.none()) + layers = forms.CharField(widget=forms.HiddenInput()) + + def __init__(self, *args, request=None, **kwargs): + super(BranchComparisonForm, self).__init__(*args, **kwargs) + qs = Branch.objects.filter(comparison=False, hidden=False).order_by('sort_priority', 'name') + self.fields['from_branch'].queryset = qs + self.fields['to_branch'].queryset = qs + self.request = request + + def clean(self): + cleaned_data = super(BranchComparisonForm, self).clean() + if cleaned_data['from_branch'] == cleaned_data['to_branch']: + raise forms.ValidationError({'to_branch': 'From and to branches cannot be the same'}) + return cleaned_data
layerindex/urls.py +11 -1
@@ -14,7 +14,8 @@ from layerindex.views import LayerListView, LayerReviewListView, LayerReviewDeta bulk_change_edit_view, bulk_change_patch_view, BulkChangeDeleteView, RecipeDetailView, RedirectParamsView, \ ClassicRecipeSearchView, ClassicRecipeDetailView, ClassicRecipeStatsView, LayerUpdateDetailView, UpdateListView, \ UpdateDetailView, StatsView, publish_view, LayerCheckListView, BBClassCheckListView, TaskStatusView, \ - ComparisonRecipeSelectView, ComparisonRecipeSelectDetailView, task_log_view, task_stop_view, email_test_view + ComparisonRecipeSelectView, ComparisonRecipeSelectDetailView, task_log_view, task_stop_view, email_test_view, \ + BranchCompareView from layerindex.models import LayerItem, Recipe, RecipeChangeset from rest_framework import routers from . import restviews
@@ -185,6 +186,15 @@ urlpatterns = [ url(r'^stoptask/(?P<task_id>[-\w]+)/$', task_stop_view, name='task_stop'), + url(r'^branch_comparison/$', + BranchCompareView.as_view( + template_name='layerindex/branchcompare.html'), + name='branch_comparison'), + url(r'^branch_comparison_plain/$', + BranchCompareView.as_view( + content_type='text/plain', + template_name='layerindex/branchcompare_plain.txt'), + name='branch_comparison_plain'), url(r'^ajax/layerchecklist/(?P<branch>[-.\w]+)/$', LayerCheckListView.as_view( template_name='layerindex/layerchecklist.html'),
layerindex/views.py +112 -1
122 lines not on this page · raw message
templates/base.html +1 -0
@@ -87,6 +87,7 @@ <li><a href="{% url 'duplicates' 'master' %}">Duplicates</a></li> <li><a href="{% url 'update_list' %}">Updates</a></li> <li><a href="{% url 'stats' %}">Statistics</a></li> + <li><a href="{% url 'branch_comparison' %}">Branch Comparison</a></li> {% if rrs_enabled %} <li><a href="{% url 'rrs_frontpage' %}">Recipe Maintenance</a></li> {% endif %}
templates/layerindex/branchcompare.html new file +214 -0
214 lines not on this page · raw message
templates/layerindex/branchcompare_plain.txt new file +17 -0
@@ -0,0 +1,17 @@ +From {{ from_branch }} to {{ to_branch }} + + +Added +----- +{% for recipe in added %}{{ recipe.pn }} {% for rv in recipe.to_versions %}{{ rv.pv }}{% if not forloop.last %}, {% endif %}{% endfor %} +{% endfor %} + +Changed +------- +{% for recipe in changed %}{% with pv_changed=recipe.pv_changed %}{{ recipe.pn }} {% for rv in recipe.from_versions %}{{ rv.pv }}{% if rv.srcrev and not pv_changed %} ({{ rv.srcrev|truncatechars:13 }}){% endif %}{% if not forloop.last %}, {% endif %}{% endfor %} -> {% for rv in recipe.to_versions %}{{ rv.pv }}{% if rv.srcrev and not pv_changed %} ({{ rv.srcrev|truncatechars:13 }}){% endif %}{% if not forloop.last %}, {% endif %}{% endfor %} +{% endwith %}{% endfor %} + +Removed +------- +{% for recipe in removed %}{{ recipe.pn }} +{% endfor %}
Signature · 1 line
2.20.1
PATCH 3/3 Fix cgit commit URL setting
In reply to Paul EggletonTypo, there has to be a ? in front of the id or otherwise we don't get linked to the right commit. This would have affected recently added layers with a cgit web frontend.
--- templates/layerindex/editlayer.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
templates/layerindex/editlayer.html +1 -1
@@ -286,7 +286,7 @@ if (e) { $('#id_vcs_web_tree_base_url').val(vcs_web_url + '/tree/%path%?h=%branch%') $('#id_vcs_web_file_base_url').val(vcs_web_url + '/tree/%path%?h=%branch%') - $('#id_vcs_web_commit_url').val(vcs_web_url + '/commit/id=%hash%') + $('#id_vcs_web_commit_url').val(vcs_web_url + '/commit/?id=%hash%') } } else if (type == 'gitweb') {
Signature · 1 line
2.20.1