patchutils.py: Add support for parsing Signed-off-by headers.

This commit is contained in:
Sebastian Lackner 2015-09-21 21:58:02 +02:00
parent ff889f6cdc
commit 6efa37655c

View File

@ -54,6 +54,7 @@ class PatchObject(object):
self.patch_email = header['email']
self.patch_subject = header['subject']
self.patch_revision = header['revision'] if header.has_key('revision') else 1
self.signed_off_by = header['signedoffby'] if header.has_key('signedoffby') else []
self.filename = filename
self.offset_begin = None
@ -329,6 +330,12 @@ def read_patch(filename):
if not subject.endswith("."): subject += "."
header['subject'], header['revision'] = subject, revision
elif line.startswith("Signed-off-by: "):
if not header.has_key('signedoffby'):
header['signedoffby'] = []
header['signedoffby'].append(_parse_author(line[15:]))
assert fp.read() == line
elif line.startswith("diff --git "):
tmp = line.strip().split(" ")
if len(tmp) != 4: raise PatchParserError("Unable to parse git diff header line '%s'." % line)