aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2018-08-12 00:42:11 +0100
committerGuido G√ľnther <agx@sigxcpu.org>2018-08-24 08:44:01 +0200
commit0304fd3b56d549a74f913799d71e437e9c2c24d5 (patch)
tree6632ab8b320e9150ef01095bbcc1917d20c0c393
parent771114b4f6089b507b91b1ad8faa762394159e2f (diff)
pq import: Look for DEP-3 header fields even if git mailimport succeeds
Closes: #905934
-rw-r--r--gbp/patch_series.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/gbp/patch_series.py b/gbp/patch_series.py
index 47f5135..c66ee9d 100644
--- a/gbp/patch_series.py
+++ b/gbp/patch_series.py
@@ -169,8 +169,7 @@ class Patch(object):
class Dep3Patch(Patch):
def _read_info(self):
super(Dep3Patch, self)._read_info()
- if not self.info:
- self._check_dep3()
+ self._check_dep3()
def _dep3_get_value(self, lines):
value = []
@@ -191,6 +190,8 @@ class Dep3Patch(Patch):
"""
def add_author(lines):
+ if 'email' in self.info and 'author' in self.info:
+ return 0
value = self._dep3_get_value(lines).strip()
m = re.match('(.*)<([^<>]+)>', value)
if m:
@@ -200,6 +201,8 @@ class Dep3Patch(Patch):
return 1
def add_subject(lines, long_desc, changes):
+ if 'subject' in self.info:
+ return long_desc, 0
value = self._dep3_get_value(lines).lstrip()
if '\n' in value:
value, description = value.split('\n', 1)
@@ -208,6 +211,12 @@ class Dep3Patch(Patch):
self.info['subject'] = value
return long_desc, changes + 1
+ def add_date(lines):
+ if 'date' in self.info:
+ return 0
+ self.info['date'] = self._dep3_get_value(lines).strip()
+ return 1
+
changes = 0
long_desc = self._dep3_get_value(headers.get('long_desc', list()))
@@ -216,6 +225,8 @@ class Dep3Patch(Patch):
changes += add_author(v)
elif k in ('subject', 'description'):
long_desc, changes = add_subject(v, long_desc, changes)
+ elif k in ['date']:
+ changes += add_date(v)
elif k == 'long_desc':
pass
else: