X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=tools%2Fpatman%2Fseries.py;h=88c0d877d400bc77035e010dab85b00c78eda6c0;hb=e752edcb6b22b2c42c8064d66a93f0910cac6fef;hp=44ad931cf8758eb1b758d1e0e5b44f3d212da81e;hpb=fe2f8d9e2f1bc00f143a22191a1d7076667ff436;p=oweals%2Fu-boot.git diff --git a/tools/patman/series.py b/tools/patman/series.py index 44ad931cf8..88c0d877d4 100644 --- a/tools/patman/series.py +++ b/tools/patman/series.py @@ -1,22 +1,6 @@ # Copyright (c) 2011 The Chromium OS Authors. # -# See file CREDITS for list of people who contributed to this -# project. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, -# MA 02111-1307 USA +# SPDX-License-Identifier: GPL-2.0+ # import itertools @@ -28,7 +12,7 @@ import terminal # Series-xxx tags that we understand valid_series = ['to', 'cc', 'version', 'changes', 'prefix', 'notes', 'name', - 'cover-cc'] + 'cover-cc', 'process_log'] class Series(dict): """Holds information about a patch series, including all tags. @@ -40,6 +24,7 @@ class Series(dict): notes: List of lines in the notes changes: (dict) List of changes for each version, The key is the integer version number + allow_overwrite: Allow tags to overwrite an existing tag """ def __init__(self): self.cc = [] @@ -49,6 +34,7 @@ class Series(dict): self.cover = None self.notes = [] self.changes = {} + self.allow_overwrite = False # Written in MakeCcFile() # key: name of patch file @@ -72,7 +58,7 @@ class Series(dict): """ # If we already have it, then add to our list name = name.replace('-', '_') - if name in self: + if name in self and not self.allow_overwrite: values = value.split(',') values = [str.strip() for str in values] if type(self[name]) != type([]): @@ -167,15 +153,20 @@ class Series(dict): etc. """ final = [] + process_it = self.get('process_log', '').split(',') + process_it = [item.strip() for item in process_it] need_blank = False for change in sorted(self.changes, reverse=True): out = [] for this_commit, text in self.changes[change]: if commit and this_commit != commit: continue - out.append(text) + if 'uniq' not in process_it or text not in out: + out.append(text) line = 'Changes in v%d:' % change have_changes = len(out) > 0 + if 'sort' in process_it: + out = sorted(out) if have_changes: out.insert(0, line) else: @@ -210,7 +201,7 @@ class Series(dict): str = 'Change log exists, but no version is set' print col.Color(col.RED, str) - def MakeCcFile(self, process_tags, cover_fname): + def MakeCcFile(self, process_tags, cover_fname, raise_on_error): """Make a cc file for us to use for per-commit Cc automation Also stores in self._generated_cc to make ShowActions() faster. @@ -218,6 +209,8 @@ class Series(dict): Args: process_tags: Process tags as if they were aliases cover_fname: If non-None the name of the cover letter. + raise_on_error: True to raise an error when an alias fails to match, + False to just print a message. Return: Filename of temp file created """ @@ -228,8 +221,10 @@ class Series(dict): for commit in self.commits: list = [] if process_tags: - list += gitutil.BuildEmailList(commit.tags) - list += gitutil.BuildEmailList(commit.cc_list) + list += gitutil.BuildEmailList(commit.tags, + raise_on_error=raise_on_error) + list += gitutil.BuildEmailList(commit.cc_list, + raise_on_error=raise_on_error) list += get_maintainer.GetMaintainer(commit.patch) all_ccs += list print >>fd, commit.patch, ', '.join(list)