patman: Cache the CC list from MakeCcFile() for use in ShowActions()
PATCH 1/2 patman: Cache the CC list from MakeCcFile() for use in ShowActions()
Currently we go through and generate the CC list for patches twice. This gets slow when (in a future CL) we add a call to get_maintainer.pl on Linux. Instead of doing things twice, just cache the CC list when it is first generated.
--- tools/patman/patman.py | 6 ++++-- tools/patman/series.py | 13 +++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-)
tools/patman/patman.py +4 -2
@@ -140,14 +140,16 @@ else: options.count + options.start): ok = False + cc_file = series.MakeCcFile(options.process_tags) + # Email the patches out (giving the user time to check / cancel) cmd = '' if ok or options.ignore_errors: - cc_file = series.MakeCcFile(options.process_tags) cmd = gitutil.EmailPatches(series, cover_fname, args, options.dry_run, cc_file) - os.remove(cc_file) # For a dry run, just show our actions as a sanity check if options.dry_run: series.ShowActions(args, cmd, options.process_tags) + + os.remove(cc_file)
tools/patman/series.py +9 -4
@@ -46,6 +46,11 @@ class Series(dict): self.notes = [] self.changes = {} + # Written in MakeCcFile() + # key: name of patch file + # value: list of email addresses + self._generated_cc = {} + # These make us more like a dictionary def __setattr__(self, name, value): self[name] = value
@@ -109,10 +114,7 @@ class Series(dict): for upto in range(len(args)): commit = self.commits[upto] print col.Color(col.GREEN, ' %s' % args[upto]) - cc_list = [] - if process_tags: - cc_list += gitutil.BuildEmailList(commit.tags) - cc_list += gitutil.BuildEmailList(commit.cc_list) + cc_list = list(self._generated_cc[commit.patch]) # Skip items in To list if 'to' in self:
@@ -202,6 +204,8 @@ class Series(dict): def MakeCcFile(self, process_tags): """Make a cc file for us to use for per-commit Cc automation + Also stores in self._generated_cc to make ShowActions() faster. + Args: process_tags: Process tags as if they were aliases Return:
@@ -216,6 +220,7 @@ class Series(dict): list += gitutil.BuildEmailList(commit.tags) list += gitutil.BuildEmailList(commit.cc_list) print >>fd, commit.patch, ', '.join(list) + self._generated_cc[commit.patch] = list fd.close() return fname
Signature · 1 line
1.7.7.3
PATCH 2/2 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.
--- tools/patman/patman.py | 2 +- tools/patman/series.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-)
tools/patman/patman.py +1 -1
@@ -140,7 +140,7 @@ else: options.count + options.start): ok = False - cc_file = series.MakeCcFile(options.process_tags) + cc_file = series.MakeCcFile(options.process_tags, cover_fname) # Email the patches out (giving the user time to check / cancel) cmd = ''
tools/patman/series.py +11 -1
@@ -19,6 +19,7 @@ # MA 02111-1307 USA # +import itertools import os import gitutil
@@ -138,6 +139,9 @@ 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()) + for email in set(all_ccs): + print ' Cc: ',email if cmd: print 'Git command: %s' % cmd
@@ -201,27 +205,33 @@ class Series(dict): str = 'Change log exists, but no version is set' print col.Color(col.RED, str) - def MakeCcFile(self, process_tags): + def MakeCcFile(self, process_tags, cover_fname): """Make a cc file for us to use for per-commit Cc automation Also stores in self._generated_cc to make ShowActions() faster. Args: process_tags: Process tags as if they were aliases + cover_fname: If non-None the name of the cover letter. Return: Filename of temp file created """ # Look for commit tags (of the form 'xxx:' at the start of the subject) fname = '/tmp/patman.%d' % os.getpid() fd = open(fname, 'w') + all_ccs = [] for commit in self.commits: list = [] if process_tags: list += gitutil.BuildEmailList(commit.tags) list += gitutil.BuildEmailList(commit.cc_list) + 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)) + fd.close() return fname
Signature · 1 line
1.7.7.3
PATCH 2/2 patman: Add all CC addresses to the cover letter
Quoted 4 lines · Doug Anderson
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 <[email protected]>
Looks good, but can you please add a note to the README under the 'Where Patches Are Sent' header which mentions where the cover letter is sent?
Quoted 76 lines
--- tools/patman/patman.py | 2 +- tools/patman/series.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-)tools/patman/patman.py +1
-1@@ -140,7 +140,7 @@ else: options.count + options.start): ok = False - cc_file = series.MakeCcFile(options.process_tags) + cc_file = series.MakeCcFile(options.process_tags, cover_fname) # Email the patches out (giving the user time to check / cancel) cmd = ''tools/patman/series.py +11
-2@@ -19,6 +19,7 @@ # MA 02111-1307 USA # +import itertools import os import gitutil@@ -138,6 +139,9 @@ 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()) + for email in set(all_ccs): + print ' Cc: ',email if cmd: print 'Git command: %s' % cmd@@ -201,27 +205,33 @@ class Series(dict): str = 'Change log exists, but no version is set' print col.Color(col.RED, str) - def MakeCcFile(self, process_tags): + def MakeCcFile(self, process_tags, cover_fname): """Make a cc file for us to use for per-commit Cc automation Also stores in self._generated_cc to make ShowActions() faster. Args: process_tags: Process tags as if they were aliases + cover_fname: If non-None the name of the cover letter. Return: Filename of temp file created """ # Look for commit tags (of the form 'xxx:' at the start of the subject) fname = '/tmp/patman.%d' % os.getpid() fd = open(fname, 'w') + all_ccs = [] for commit in self.commits: list = [] if process_tags: list += gitutil.BuildEmailList(commit.tags) list += gitutil.BuildEmailList(commit.cc_list) + 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)) + fd.close() return fname --
Quoted 2 lines
1.7.7.3
Regards,
Simon
PATCH 2/2 patman: Add all CC addresses to the cover letter
Simon,
Thanks for the review!
Quoted 9 lines · Simon Glass
Quoted 4 lines · Doug Anderson
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 <[email protected]>Looks good, but can you please add a note to the README under the 'Where Patches Are Sent' header which mentions where the cover letter is sent?
Good suggestion. Done.
Quoted 81 lines
Quoted 76 lines
--- tools/patman/patman.py | 2 +- tools/patman/series.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-)tools/patman/patman.py +1
-1@@ -140,7 +140,7 @@ else: options.count + options.start): ok = False - cc_file = series.MakeCcFile(options.process_tags) + cc_file = series.MakeCcFile(options.process_tags, cover_fname) # Email the patches out (giving the user time to check / cancel) cmd = ''tools/patman/series.py +11
-2@@ -19,6 +19,7 @@ # MA 02111-1307 USA # +import itertools import os import gitutil@@ -138,6 +139,9 @@ 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()) + for email in set(all_ccs): + print ' Cc: ',email if cmd: print 'Git command: %s' % cmd@@ -201,27 +205,33 @@ class Series(dict): str = 'Change log exists, but no version is set' print col.Color(col.RED, str) - def MakeCcFile(self, process_tags): + def MakeCcFile(self, process_tags, cover_fname): """Make a cc file for us to use for per-commit Cc automation Also stores in self._generated_cc to make ShowActions() faster. Args: process_tags: Process tags as if they were aliases + cover_fname: If non-None the name of the cover letter. Return: Filename of temp file created """ # Look for commit tags (of the form 'xxx:' at the start of the subject) fname = '/tmp/patman.%d' % os.getpid() fd = open(fname, 'w') + all_ccs = [] for commit in self.commits: list = [] if process_tags: list += gitutil.BuildEmailList(commit.tags) list += gitutil.BuildEmailList(commit.cc_list) + 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)) + fd.close() return fname --Quoted 2 lines
1.7.7.3
Regards,
Simon
PATCH 1/2 patman: Cache the CC list from MakeCcFile() for use in ShowActions()
In reply to Doug AndersonQuoted 6 lines · Doug Anderson
Currently we go through and generate the CC list for patches twice. This gets slow when (in a future CL) we add a call to get_maintainer.pl on Linux. Instead of doing things twice, just cache the CC list when it is first generated.
Signed-off-by Doug Anderson <[email protected]>\
PATCH v2 1/2 patman: Cache the CC list from MakeCcFile() for use in ShowActions()
In reply to Doug AndersonCurrently we go through and generate the CC list for patches twice. This gets slow when (in a future CL) we add a call to get_maintainer.pl on Linux. Instead of doing things twice, just cache the CC list when it is first generated.
---
Changes in v2: None
tools/patman/patman.py | 6 ++++-- tools/patman/series.py | 13 +++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-)
tools/patman/patman.py +4 -2
@@ -140,14 +140,16 @@ else: options.count + options.start): ok = False + cc_file = series.MakeCcFile(options.process_tags) + # Email the patches out (giving the user time to check / cancel) cmd = '' if ok or options.ignore_errors: - cc_file = series.MakeCcFile(options.process_tags) cmd = gitutil.EmailPatches(series, cover_fname, args, options.dry_run, cc_file) - os.remove(cc_file) # For a dry run, just show our actions as a sanity check if options.dry_run: series.ShowActions(args, cmd, options.process_tags) + + os.remove(cc_file)
tools/patman/series.py +9 -4
@@ -46,6 +46,11 @@ class Series(dict): self.notes = [] self.changes = {} + # Written in MakeCcFile() + # key: name of patch file + # value: list of email addresses + self._generated_cc = {} + # These make us more like a dictionary def __setattr__(self, name, value): self[name] = value
@@ -109,10 +114,7 @@ class Series(dict): for upto in range(len(args)): commit = self.commits[upto] print col.Color(col.GREEN, ' %s' % args[upto]) - cc_list = [] - if process_tags: - cc_list += gitutil.BuildEmailList(commit.tags) - cc_list += gitutil.BuildEmailList(commit.cc_list) + cc_list = list(self._generated_cc[commit.patch]) # Skip items in To list if 'to' in self:
@@ -202,6 +204,8 @@ class Series(dict): def MakeCcFile(self, process_tags): """Make a cc file for us to use for per-commit Cc automation + Also stores in self._generated_cc to make ShowActions() faster. + Args: process_tags: Process tags as if they were aliases Return:
@@ -216,6 +220,7 @@ class Series(dict): list += gitutil.BuildEmailList(commit.tags) list += gitutil.BuildEmailList(commit.cc_list) print >>fd, commit.patch, ', '.join(list) + self._generated_cc[commit.patch] = list fd.close() return fname
Signature · 1 line
1.7.7.3
PATCH v2 2/2 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.
---
Changes in v2:
- Added requested comment in the README to document this.
tools/patman/README | 3 +++ tools/patman/patman.py | 2 +- tools/patman/series.py | 12 +++++++++++- 3 files changed, 15 insertions(+), 2 deletions(-)
tools/patman/README +3 -0
@@ -226,6 +226,9 @@ Date: Mon Nov 7 23:18:44 2011 -0500 will create a patch which is copied to x86, arm, sandbox, mikef, ag and afleming. +If you have a cover letter it will get sent to the union of the CC lists of +all of the other patches. + Example Work Flow =================
tools/patman/patman.py +1 -1
@@ -140,7 +140,7 @@ else: options.count + options.start): ok = False - cc_file = series.MakeCcFile(options.process_tags) + cc_file = series.MakeCcFile(options.process_tags, cover_fname) # Email the patches out (giving the user time to check / cancel) cmd = ''
tools/patman/series.py +11 -1
@@ -19,6 +19,7 @@ # MA 02111-1307 USA # +import itertools import os import gitutil
@@ -138,6 +139,9 @@ 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()) + for email in set(all_ccs): + print ' Cc: ',email if cmd: print 'Git command: %s' % cmd
@@ -201,27 +205,33 @@ class Series(dict): str = 'Change log exists, but no version is set' print col.Color(col.RED, str) - def MakeCcFile(self, process_tags): + def MakeCcFile(self, process_tags, cover_fname): """Make a cc file for us to use for per-commit Cc automation Also stores in self._generated_cc to make ShowActions() faster. Args: process_tags: Process tags as if they were aliases + cover_fname: If non-None the name of the cover letter. Return: Filename of temp file created """ # Look for commit tags (of the form 'xxx:' at the start of the subject) fname = '/tmp/patman.%d' % os.getpid() fd = open(fname, 'w') + all_ccs = [] for commit in self.commits: list = [] if process_tags: list += gitutil.BuildEmailList(commit.tags) list += gitutil.BuildEmailList(commit.cc_list) + 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)) + fd.close() return fname
Signature · 1 line
1.7.7.3
PATCH v2 2/2 patman: Add all CC addresses to the cover letter
Quoted 4 lines · Doug Anderson
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 <[email protected]>
PATCH v2 2/2 patman: Add all CC addresses to the cover letter
Quoted 7 lines · Simon Glass
Quoted 4 lines · Doug Anderson
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 <[email protected]>Acked-by Simon Glass <[email protected]>
Applied to u-boot-x86, thanks.
PATCH v2 1/2 patman: Cache the CC list from MakeCcFile() for use in ShowActions()
In reply to Doug AndersonQuoted 8 lines · Doug Anderson
Currently we go through and generate the CC list for patches twice. This gets slow when (in a future CL) we add a call to get_maintainer.pl on Linux. Instead of doing things twice, just cache the CC list when it is first generated.
Signed-off-by Doug Anderson <[email protected]>---
Changes in v2: None
Applied to u-boot-x86, thanks.
Quoted 76 lines
tools/patman/patman.py | 6 ++++-- tools/patman/series.py | 13 +++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-)tools/patman/patman.py +4
-2@@ -140,14 +140,16 @@ else: options.count + options.start): ok = False + cc_file = series.MakeCcFile(options.process_tags) + # Email the patches out (giving the user time to check / cancel) cmd = '' if ok or options.ignore_errors: - cc_file = series.MakeCcFile(options.process_tags) cmd = gitutil.EmailPatches(series, cover_fname, args, options.dry_run, cc_file) - os.remove(cc_file) # For a dry run, just show our actions as a sanity check if options.dry_run: series.ShowActions(args, cmd, options.process_tags) + + os.remove(cc_file)tools/patman/series.py +9
-5@@ -46,6 +46,11 @@ class Series(dict): self.notes = [] self.changes = {} + # Written in MakeCcFile() + # key: name of patch file + # value: list of email addresses + self._generated_cc = {} + # These make us more like a dictionary def __setattr__(self, name, value): self[name] = value@@ -109,10 +114,7 @@ class Series(dict): for upto in range(len(args)): commit = self.commits[upto] print col.Color(col.GREEN, ' %s' % args[upto]) - cc_list = [] - if process_tags: - cc_list += gitutil.BuildEmailList(commit.tags) - cc_list += gitutil.BuildEmailList(commit.cc_list) + cc_list = list(self._generated_cc[commit.patch]) # Skip items in To list if 'to' in self:@@ -202,6 +204,8 @@ class Series(dict): def MakeCcFile(self, process_tags): """Make a cc file for us to use for per-commit Cc automation + Also stores in self._generated_cc to make ShowActions() faster. + Args: process_tags: Process tags as if they were aliases Return:@@ -216,6 +220,7 @@ class Series(dict): list += gitutil.BuildEmailList(commit.tags) list += gitutil.BuildEmailList(commit.cc_list) print >>fd, commit.patch, ', '.join(list) + self._generated_cc[commit.patch] = list fd.close() return fname --1.7.7.3