Browse Source

patman: Add Cover-letter-cc tag to Cc cover letter to people

The cover letter is sent to everyone who is on the Cc list for any of
the patches in the series. Sometimes it is useful to send just the cover
letter to additional people, so that they are aware of the series, but
don't need to wade through all the individual patches.

Add a new Cover-letter-cc tag for this purpose.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Simon Glass 12 years ago
parent
commit
fe2f8d9e2f
3 changed files with 27 additions and 4 deletions
  1. 11 1
      tools/patman/README
  2. 8 0
      tools/patman/patchstream.py
  3. 8 3
      tools/patman/series.py

+ 11 - 1
tools/patman/README

@@ -182,6 +182,10 @@ END
 	Sets the cover letter contents for the series. The first line
 	Sets the cover letter contents for the series. The first line
 	will become the subject of the cover letter
 	will become the subject of the cover letter
 
 
+Cover-letter-cc: email / alias
+	Additional email addresses / aliases to send cover letter to (you
+	can add this multiple times)
+
 Series-notes:
 Series-notes:
 blah blah
 blah blah
 blah blah
 blah blah
@@ -263,7 +267,13 @@ will create a patch which is copied to x86, arm, sandbox, mikef, ag and
 afleming.
 afleming.
 
 
 If you have a cover letter it will get sent to the union of the CC lists of
 If you have a cover letter it will get sent to the union of the CC lists of
-all of the other patches.
+all of the other patches. If you want to sent it to additional people you
+can add a tag:
+
+Cover-letter-cc: <list of addresses>
+
+These people will get the cover letter even if they are not on the To/Cc
+list for any of the patches.
 
 
 
 
 Example Work Flow
 Example Work Flow

+ 8 - 0
tools/patman/patchstream.py

@@ -42,6 +42,9 @@ re_signoff = re.compile('^Signed-off-by:')
 # The start of the cover letter
 # The start of the cover letter
 re_cover = re.compile('^Cover-letter:')
 re_cover = re.compile('^Cover-letter:')
 
 
+# A cover letter Cc
+re_cover_cc = re.compile('^Cover-letter-cc: *(.*)')
+
 # Patch series tag
 # Patch series tag
 re_series = re.compile('^Series-(\w*): *(.*)')
 re_series = re.compile('^Series-(\w*): *(.*)')
 
 
@@ -153,6 +156,7 @@ class PatchStream:
         # Handle state transition and skipping blank lines
         # Handle state transition and skipping blank lines
         series_match = re_series.match(line)
         series_match = re_series.match(line)
         commit_match = re_commit.match(line) if self.is_log else None
         commit_match = re_commit.match(line) if self.is_log else None
+        cover_cc_match = re_cover_cc.match(line)
         tag_match = None
         tag_match = None
         if self.state == STATE_PATCH_HEADER:
         if self.state == STATE_PATCH_HEADER:
             tag_match = re_tag.match(line)
             tag_match = re_tag.match(line)
@@ -205,6 +209,10 @@ class PatchStream:
             self.in_section = 'cover'
             self.in_section = 'cover'
             self.skip_blank = False
             self.skip_blank = False
 
 
+        elif cover_cc_match:
+            value = cover_cc_match.group(1)
+            self.AddToSeries(line, 'cover-cc', value)
+
         # If we are in a change list, key collected lines until a blank one
         # If we are in a change list, key collected lines until a blank one
         elif self.in_change:
         elif self.in_change:
             if is_blank:
             if is_blank:

+ 8 - 3
tools/patman/series.py

@@ -27,7 +27,8 @@ import gitutil
 import terminal
 import terminal
 
 
 # Series-xxx tags that we understand
 # 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']
 
 
 class Series(dict):
 class Series(dict):
     """Holds information about a patch series, including all tags.
     """Holds information about a patch series, including all tags.
@@ -43,6 +44,7 @@ class Series(dict):
     def __init__(self):
     def __init__(self):
         self.cc = []
         self.cc = []
         self.to = []
         self.to = []
+        self.cover_cc = []
         self.commits = []
         self.commits = []
         self.cover = None
         self.cover = None
         self.notes = []
         self.notes = []
@@ -69,6 +71,7 @@ class Series(dict):
             value: Tag value (part after 'Series-xxx: ')
             value: Tag value (part after 'Series-xxx: ')
         """
         """
         # If we already have it, then add to our list
         # If we already have it, then add to our list
+        name = name.replace('-', '_')
         if name in self:
         if name in self:
             values = value.split(',')
             values = value.split(',')
             values = [str.strip() for str in values]
             values = [str.strip() for str in values]
@@ -140,7 +143,8 @@ class Series(dict):
         print 'Prefix:\t ', self.get('prefix')
         print 'Prefix:\t ', self.get('prefix')
         if self.cover:
         if self.cover:
             print 'Cover: %d lines' % len(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):
             for email in set(all_ccs):
                     print '      Cc: ',email
                     print '      Cc: ',email
         if cmd:
         if cmd:
@@ -232,7 +236,8 @@ class Series(dict):
             self._generated_cc[commit.patch] = list
             self._generated_cc[commit.patch] = list
 
 
         if cover_fname:
         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()
         fd.close()
         return fname
         return fname