Collect all Signed-off-by tags in a commit and make sure that there are no duplicates.
Signed-off-by: Simon Glass <s...@chromium.org> --- tools/patman/README | 1 + tools/patman/commit.py | 13 +++++++++++++ tools/patman/patchstream.py | 10 ++++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/tools/patman/README b/tools/patman/README index 59f1776..119c554 100644 --- a/tools/patman/README +++ b/tools/patman/README @@ -192,6 +192,7 @@ END A sign-off is added automatically to your patches (this is probably a bug). If you put this tag in your patches, it will override the default signoff that patman automatically adds. + Multiple duplicate signoffs will be removed. Tested-by: Their Name <email> Reviewed-by: Their Name <email> diff --git a/tools/patman/commit.py b/tools/patman/commit.py index 89cce7f..6cc5a41 100644 --- a/tools/patman/commit.py +++ b/tools/patman/commit.py @@ -29,6 +29,7 @@ class Commit: self.tags = [] self.changes = {} self.cc_list = [] + self.signoff_set = set() self.notes = [] def AddChange(self, version, info): @@ -72,3 +73,15 @@ class Commit: cc_list: List of aliases or email addresses """ self.cc_list += cc_list + + def AddSignoff(self, signoff): + """Add a list of signoffs when we send this patch. + + Args: + signoff: Signoff line + """ + self.signoff_set.add(signoff) + + def FormatSignoffs(self): + """Return a formatted list of signoffs for this commit.""" + return ['Signed-off-by: ' + s for s in self.signoff_set] diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py index 684204c..32ebc35 100644 --- a/tools/patman/patchstream.py +++ b/tools/patman/patchstream.py @@ -21,7 +21,7 @@ re_remove = re.compile('^BUG=|^TEST=|^BRANCH=|^Change-Id:|^Review URL:' re_allowed_after_test = re.compile('^Signed-off-by:') # Signoffs -re_signoff = re.compile('^Signed-off-by:') +re_signoff = re.compile('^Signed-off-by: *(.*)') # The start of the cover letter re_cover = re.compile('^Cover-letter:') @@ -159,6 +159,7 @@ class PatchStream: commit_tag_match = re_commit_tag.match(line) commit_match = re_commit.match(line) if self.is_log else None cover_cc_match = re_cover_cc.match(line) + signoff_match = re_signoff.match(line) tag_match = None if self.state == STATE_PATCH_HEADER: tag_match = re_tag.match(line) @@ -223,7 +224,7 @@ class PatchStream: if is_blank: # Blank line ends this change list self.in_change = 0 - elif line == '---' or re_signoff.match(line): + elif line == '---': self.in_change = 0 out = self.ProcessLine(line) else: @@ -272,6 +273,10 @@ class PatchStream: else: self.tags.append(line); + # Collect signoffs to add later + elif signoff_match: + self.commit.AddSignoff(signoff_match.group(1)) + # Well that means this is an ordinary line else: pos = 1 @@ -305,6 +310,7 @@ class PatchStream: out = [] log = self.series.MakeChangeLog(self.commit) out += self.FormatTags(self.tags) + out += self.commit.FormatSignoffs() out += [line] + self.commit.notes + [''] + log elif self.found_test: if not re_allowed_after_test.match(line): -- 1.9.1.423.g4596e3a _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot