Commit 44d81889 authored by Arkadiusz Hiler's avatar Arkadiusz Hiler

revision: Store raw cover letter

We are now storing unprocessed cover letter and it's headers and
exposing it through the API.
Signed-off-by: Arkadiusz Hiler's avatarArkadiusz Hiler <arkadiusz.hiler@intel.com>
parent 72632e20
......@@ -196,7 +196,7 @@ def mail_date(mail):
def mail_headers(mail):
return reduce(operator.__concat__,
['%s: %s\n' % (k, Header(v, header_name=k,
continuation_ws='\t').encode())
continuation_ws=' ').encode())
for (k, v) in list(mail.items())])
......@@ -435,6 +435,8 @@ def find_content(project, mail, force_comment=False):
ret.series.submitted = date
if is_cover_letter:
ret.revision.raw_cover_letter_headers = mail_headers(mail)
ret.revision.raw_cover_letter = commentbuf
ret.revision.cover_letter = clean_content(commentbuf)
return ret
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-12-21 22:09
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('patchwork', '0029_seriesrevision_is_rerun'),
]
operations = [
migrations.AddField(
model_name='seriesrevision',
name='raw_cover_letter',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='seriesrevision',
name='raw_cover_letter_headers',
field=models.TextField(blank=True, null=True),
),
]
......@@ -604,6 +604,8 @@ class SeriesRevision(models.Model):
version = models.IntegerField(default=1)
root_msgid = models.CharField(max_length=255)
cover_letter = models.TextField(null=True, blank=True)
raw_cover_letter = models.TextField(null=True, blank=True)
raw_cover_letter_headers = models.TextField(null=True, blank=True)
n_patches = models.IntegerField(default=0)
patches = models.ManyToManyField(Patch, through='SeriesRevisionPatch')
state = models.SmallIntegerField(choices=RevisionState.CHOICES,
......
......@@ -191,7 +191,7 @@ class RevisionSerializer(PatchworkModelSerializer):
class Meta:
model = SeriesRevision
fields = ('version', 'cover_letter', 'patches')
fields = ('version', 'cover_letter', 'raw_cover_letter', 'patches')
read_only_fields = ('version', 'cover_letter')
expand_serializers = {
'patches': PatchSerializer,
......
......@@ -21,6 +21,8 @@ import os
from django.test import TestCase
from email.parser import HeaderParser
from patchwork.models import (Patch, Series, SeriesRevision, Project,
SERIES_DEFAULT_NAME, EventLog, User, Person,
State, RevisionState)
......@@ -270,6 +272,54 @@ Damien Lespiau (4):
6 files changed, 47 insertions(+), 54 deletions(-)""" # noqa
class RawCoverLetter(Series0010):
raw_cover_letter = \
"""With Daniel's help to figure out an arcane corner of coccinelle, here is v2 of
a series introducing macros to iterate through the CRTCs instead of using
list_for_each_entry() and mode_config.crtc_list, a tiny bit more readable and
easier to recall.
Damien Lespiau (4):
drm/i915: Introduce a for_each_intel_crtc() macro
drm/i915: Use for_each_intel_crtc() when iterating through intel_crtcs
drm/i915: Introduce a for_each_crtc() macro
drm/i915: Use for_each_crtc() when iterating through the CRTCs
drivers/gpu/drm/i915/i915_debugfs.c | 4 +-
drivers/gpu/drm/i915/i915_drv.c | 2 +-
drivers/gpu/drm/i915/i915_drv.h | 6 +++
drivers/gpu/drm/i915/intel_display.c | 71 +++++++++++++++---------------------
drivers/gpu/drm/i915/intel_fbdev.c | 6 +--
drivers/gpu/drm/i915/intel_pm.c | 12 +++---
6 files changed, 47 insertions(+), 54 deletions(-)
--
1.8.3.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
""" # noqa
def testRawCoverLetterShouldBeStored(self):
self.maxDiff = None
self.commonInsertionChecks()
sr = SeriesRevision.objects.get() # we have just one
stored_headers = HeaderParser().parsestr(sr.raw_cover_letter_headers)
self.assertEquals(sr.raw_cover_letter, self.raw_cover_letter)
self.assertEquals(stored_headers['From'],
'Damien Lespiau <damien.lespiau@intel.com>')
self.assertEquals(stored_headers['To'],
'<intel-gfx@lists.freedesktop.org>')
self.assertEquals(stored_headers['Date'],
'Tue, 13 May 2014 23:32:20 +0100')
self.assertEquals(stored_headers['Subject'],
'[Intel-gfx] [PATCH 0/4] for_each_{intel_,}crtc v2')
class MultipleMailCoverLetterSeries(Series0010):
def testInsertion(self):
......
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