]> git.sur5r.net Git - u-boot/commitdiff
patman: add option for limiting the Cc list
authorChris Packham <judge.packham@gmail.com>
Thu, 7 Jun 2018 08:45:06 +0000 (20:45 +1200)
committerSimon Glass <sjg@chromium.org>
Sat, 23 Jun 2018 14:03:43 +0000 (08:03 -0600)
Many mailing-lists consider a long Cc list a sign of spam and will
either drop the message or mark it for moderation. Because patman
automatically invokes get_maintainer.pl the Cc list can expand
unexpectedly. Allow the user to specify a limit for the Cc list.

This limit is applied after removing any known bouncing addresses. By
default no limit is applied.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
tools/patman/func_test.py
tools/patman/patman.py
tools/patman/series.py

index 85372f3c0ade0d333b4e4039ee1c8d2189123502..3f7e03214470e23d0a5adb54a209d5b572903083 100644 (file)
@@ -149,7 +149,8 @@ class TestFunctional(unittest.TestCase):
                 patchstream.InsertCoverLetter(cover_fname, series, count)
             series.DoChecks()
             cc_file = series.MakeCcFile(process_tags, cover_fname,
-                                        not ignore_bad_tags, add_maintainers)
+                                        not ignore_bad_tags, add_maintainers,
+                                        None)
             cmd = gitutil.EmailPatches(series, cover_fname, args,
                     dry_run, not ignore_bad_tags, cc_file,
                     in_reply_to=in_reply_to, thread=None)
index 8d2c78235a7e48af422b066c38b644adde900f39..e01510df9c0fda314bf03dfdaca32803928e2313 100755 (executable)
@@ -38,6 +38,8 @@ parser.add_option('-i', '--ignore-errors', action='store_true',
 parser.add_option('-m', '--no-maintainers', action='store_false',
        dest='add_maintainers', default=True,
        help="Don't cc the file maintainers automatically")
+parser.add_option('-l', '--limit-cc', dest='limit', type='int',
+       default=None, help='Limit the cc list to LIMIT entries [default: %default]')
 parser.add_option('-n', '--dry-run', action='store_true', dest='dry_run',
        default=False, help="Do a dry run (create but don't email patches)")
 parser.add_option('-p', '--project', default=project.DetectProject(),
@@ -157,7 +159,7 @@ else:
 
     cc_file = series.MakeCcFile(options.process_tags, cover_fname,
                                 not options.ignore_bad_tags,
-                                options.add_maintainers)
+                                options.add_maintainers, options.limit)
 
     # Email the patches out (giving the user time to check / cancel)
     cmd = ''
index d526d4ee91d3a6b5a7ee119e3a89c22cf81be6a0..2735afaf88feab0eb3e4546dac7912f088fe37bc 100644 (file)
@@ -202,7 +202,7 @@ class Series(dict):
             print(col.Color(col.RED, str))
 
     def MakeCcFile(self, process_tags, cover_fname, raise_on_error,
-                   add_maintainers):
+                   add_maintainers, limit):
         """Make a cc file for us to use for per-commit Cc automation
 
         Also stores in self._generated_cc to make ShowActions() faster.
@@ -215,6 +215,7 @@ class Series(dict):
             add_maintainers: Either:
                 True/False to call the get_maintainers to CC maintainers
                 List of maintainers to include (for testing)
+            limit: Limit the length of the Cc list
         Return:
             Filename of temp file created
         """
@@ -238,6 +239,8 @@ class Series(dict):
                 print(col.Color(col.YELLOW, 'Skipping "%s"' % x))
             cc = set(cc) - set(settings.bounces)
             cc = [m.encode('utf-8') if type(m) != str else m for m in cc]
+            if limit is not None:
+                cc = cc[:limit]
             all_ccs += cc
             print(commit.patch, ', '.join(set(cc)), file=fd)
             self._generated_cc[commit.patch] = cc