summaryrefslogtreecommitdiff
path: root/tools/patman/series.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/patman/series.py')
-rw-r--r--tools/patman/series.py28
1 files changed, 21 insertions, 7 deletions
diff --git a/tools/patman/series.py b/tools/patman/series.py
index 6c5c570..783b3dd 100644
--- a/tools/patman/series.py
+++ b/tools/patman/series.py
@@ -27,7 +27,8 @@ import gitutil
import terminal
# Series-xxx tags that we understand
-valid_series = ['to', 'cc', 'version', 'changes', 'prefix', 'notes', 'name'];
+valid_series = ['to', 'cc', 'version', 'changes', 'prefix', 'notes', 'name',
+ 'cover-cc', 'process_log']
class Series(dict):
"""Holds information about a patch series, including all tags.
@@ -43,6 +44,7 @@ class Series(dict):
def __init__(self):
self.cc = []
self.to = []
+ self.cover_cc = []
self.commits = []
self.cover = None
self.notes = []
@@ -69,6 +71,7 @@ class Series(dict):
value: Tag value (part after 'Series-xxx: ')
"""
# If we already have it, then add to our list
+ name = name.replace('-', '_')
if name in self:
values = value.split(',')
values = [str.strip() for str in values]
@@ -140,7 +143,8 @@ class Series(dict):
print 'Prefix:\t ', self.get('prefix')
if self.cover:
print 'Cover: %d lines' % len(self.cover)
- all_ccs = itertools.chain(*self._generated_cc.values())
+ cover_cc = gitutil.BuildEmailList(self.get('cover_cc', ''))
+ all_ccs = itertools.chain(cover_cc, *self._generated_cc.values())
for email in set(all_ccs):
print ' Cc: ',email
if cmd:
@@ -163,15 +167,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:
@@ -206,7 +215,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.
@@ -214,6 +223,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
"""
@@ -224,15 +235,18 @@ 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)
self._generated_cc[commit.patch] = list
if cover_fname:
- print >>fd, cover_fname, ', '.join(set(all_ccs))
+ cover_cc = gitutil.BuildEmailList(self.get('cover_cc', ''))
+ print >>fd, cover_fname, ', '.join(set(cover_cc + all_ccs))
fd.close()
return fname