description: >
URL format for the list archive's Message-ID redirector. {} will be
replaced by the Message-ID.
+ commit_url_format:
+ title: Web SCM URL format for a particular commit
+ type: string
Series:
type: object
properties:
description: >
URL format for the list archive's Message-ID redirector. {} will be
replaced by the Message-ID.
+ commit_url_format:
+ title: Web SCM URL format for a particular commit
+ type: string
+ readOnly: true
SeriesEmbedded:
type: object
properties:
description: >
URL format for the list archive's Message-ID redirector. {} will be
replaced by the Message-ID.
+ commit_url_format:
+ title: Web SCM URL format for a particular commit
+ type: string
{% endif %}
Series:
type: object
description: >
URL format for the list archive's Message-ID redirector. {} will be
replaced by the Message-ID.
+ commit_url_format:
+ title: Web SCM URL format for a particular commit
+ type: string
+ readOnly: true
{% endif %}
SeriesEmbedded:
type: object
description: >
URL format for the list archive's Message-ID redirector. {} will be
replaced by the Message-ID.
+ commit_url_format:
+ title: Web SCM URL format for a particular commit
+ type: string
Series:
type: object
properties:
description: >
URL format for the list archive's Message-ID redirector. {} will be
replaced by the Message-ID.
+ commit_url_format:
+ title: Web SCM URL format for a particular commit
+ type: string
+ readOnly: true
SeriesEmbedded:
type: object
properties:
model = models.Project
fields = ('id', 'url', 'name', 'link_name', 'list_id',
'list_email', 'web_url', 'scm_url', 'webscm_url',
- 'list_archive_url', 'list_archive_url_format')
+ 'list_archive_url', 'list_archive_url_format',
+ 'commit_url_format')
read_only_fields = fields
extra_kwargs = {
'url': {'view_name': 'api-project-detail'},
}
versioned_fields = {
- '1.2': ('list_archive_url', 'list_archive_url_format'),
+ '1.2': ('list_archive_url', 'list_archive_url_format',
+ 'commit_url_format'),
}
fields = ('id', 'url', 'name', 'link_name', 'list_id', 'list_email',
'web_url', 'scm_url', 'webscm_url', 'maintainers',
'subject_match', 'list_archive_url',
- 'list_archive_url_format')
+ 'list_archive_url_format', 'commit_url_format')
read_only_fields = ('name', 'link_name', 'list_id', 'list_email',
'maintainers', 'subject_match')
versioned_fields = {
'1.1': ('subject_match', ),
- '1.2': ('list_archive_url', 'list_archive_url_format'),
+ '1.2': ('list_archive_url', 'list_archive_url_format',
+ 'commit_url_format'),
}
extra_kwargs = {
'url': {'view_name': 'api-project-detail'},
search_fields = ('link_name', 'list_id', 'list_email', 'web_url',
'scm_url', 'webscm_url', 'list_archive_url',
- 'list_archive_url_format')
+ 'list_archive_url_format', 'commit_url_format')
ordering_fields = ('id', 'name', 'link_name', 'list_id')
ordering = 'id'
<field type="CharField" name="listemail">patchwork@lists.ozlabs.org</field>
<field type="CharField" name="list_archive_url">https://lists.ozlabs.org/pipermail/patchwork/</field>
<field type="CharField" name="list_archive_url_format">http://mid.mail-archive.com/{}</field>
+ <field type="CharField" name="commit_url_format">https://github.com/torvalds/linux/commit/{}</field>
</object>
</django-objects>
--- /dev/null
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.22 on 2019-08-23 17:16
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('patchwork', '0035_project_list_archive_url_format'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='project',
+ name='commit_url_format',
+ field=models.CharField(blank=True, help_text=b'URL format for a particular commit. {} will be replaced by the commit SHA.', max_length=2000),
+ ),
+ ]
max_length=2000, blank=True,
help_text="URL format for the list archive's Message-ID redirector. "
"{} will be replaced by the Message-ID.")
+ commit_url_format = models.CharField(
+ max_length=2000,
+ blank=True,
+ help_text='URL format for a particular commit. '
+ '{} will be replaced by the commit SHA.')
# configuration options
{% if submission.commit_ref %}
<tr>
<th>Commit</th>
- <td>{{ submission.commit_ref }}</td>
+ <td>{{ submission|patch_commit_display }}</td>
</tr>
{% endif %}
{% if submission.delegate %}
@stringfilter
def msgid(value):
return escape(value.strip('<>'))
+
+
+@register.filter(name='patch_commit_display')
+def patch_commit_display(patch):
+ commit = patch.commit_ref
+ fmt = patch.project.commit_url_format
+
+ if not fmt:
+ return escape(commit)
+
+ return mark_safe('<a href="%s">%s</a>' % (escape(fmt.format(commit)),
+ escape(commit)))