Commit 311872551570a6439f62ab476c6fd4836a7a9aa7

Authored by Doug Anderson
Committed by Simon Glass
1 parent d94566a111

patman: Add all CC addresses to the cover letter

If we're sending a cover letter make sure to CC everyone that we're
CCing on each of the individual patches.

Signed-off-by: Doug Anderson <dianders@chromium.org>

Showing 3 changed files with 15 additions and 2 deletions Side-by-side Diff

... ... @@ -226,6 +226,9 @@
226 226 will create a patch which is copied to x86, arm, sandbox, mikef, ag and
227 227 afleming.
228 228  
  229 +If you have a cover letter it will get sent to the union of the CC lists of
  230 +all of the other patches.
  231 +
229 232  
230 233 Example Work Flow
231 234 =================
tools/patman/patman.py
... ... @@ -140,7 +140,7 @@
140 140 options.count + options.start):
141 141 ok = False
142 142  
143   - cc_file = series.MakeCcFile(options.process_tags)
  143 + cc_file = series.MakeCcFile(options.process_tags, cover_fname)
144 144  
145 145 # Email the patches out (giving the user time to check / cancel)
146 146 cmd = ''
tools/patman/series.py
... ... @@ -19,6 +19,7 @@
19 19 # MA 02111-1307 USA
20 20 #
21 21  
  22 +import itertools
22 23 import os
23 24  
24 25 import gitutil
... ... @@ -138,6 +139,9 @@
138 139 print 'Prefix:\t ', self.get('prefix')
139 140 if self.cover:
140 141 print 'Cover: %d lines' % len(self.cover)
  142 + all_ccs = itertools.chain(*self._generated_cc.values())
  143 + for email in set(all_ccs):
  144 + print ' Cc: ',email
141 145 if cmd:
142 146 print 'Git command: %s' % cmd
143 147  
144 148  
145 149  
146 150  
147 151  
... ... @@ -201,26 +205,32 @@
201 205 str = 'Change log exists, but no version is set'
202 206 print col.Color(col.RED, str)
203 207  
204   - def MakeCcFile(self, process_tags):
  208 + def MakeCcFile(self, process_tags, cover_fname):
205 209 """Make a cc file for us to use for per-commit Cc automation
206 210  
207 211 Also stores in self._generated_cc to make ShowActions() faster.
208 212  
209 213 Args:
210 214 process_tags: Process tags as if they were aliases
  215 + cover_fname: If non-None the name of the cover letter.
211 216 Return:
212 217 Filename of temp file created
213 218 """
214 219 # Look for commit tags (of the form 'xxx:' at the start of the subject)
215 220 fname = '/tmp/patman.%d' % os.getpid()
216 221 fd = open(fname, 'w')
  222 + all_ccs = []
217 223 for commit in self.commits:
218 224 list = []
219 225 if process_tags:
220 226 list += gitutil.BuildEmailList(commit.tags)
221 227 list += gitutil.BuildEmailList(commit.cc_list)
  228 + all_ccs += list
222 229 print >>fd, commit.patch, ', '.join(list)
223 230 self._generated_cc[commit.patch] = list
  231 +
  232 + if cover_fname:
  233 + print >>fd, cover_fname, ', '.join(set(all_ccs))
224 234  
225 235 fd.close()
226 236 return fname