Skip to content
Snippets Groups Projects
Commit d94566a1 authored by Doug Anderson's avatar Doug Anderson Committed by Simon Glass
Browse files

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.

Signed-off-by: default avatarDoug Anderson <dianders@chromium.org>
Acked-by: default avatarSimon Glass <sjg@chromium.org>
parent d96ef37d
No related branches found
No related tags found
No related merge requests found
...@@ -140,14 +140,16 @@ else: ...@@ -140,14 +140,16 @@ else:
options.count + options.start): options.count + options.start):
ok = False ok = False
cc_file = series.MakeCcFile(options.process_tags)
# Email the patches out (giving the user time to check / cancel) # Email the patches out (giving the user time to check / cancel)
cmd = '' cmd = ''
if ok or options.ignore_errors: if ok or options.ignore_errors:
cc_file = series.MakeCcFile(options.process_tags)
cmd = gitutil.EmailPatches(series, cover_fname, args, cmd = gitutil.EmailPatches(series, cover_fname, args,
options.dry_run, cc_file) options.dry_run, cc_file)
os.remove(cc_file)
# For a dry run, just show our actions as a sanity check # For a dry run, just show our actions as a sanity check
if options.dry_run: if options.dry_run:
series.ShowActions(args, cmd, options.process_tags) series.ShowActions(args, cmd, options.process_tags)
os.remove(cc_file)
...@@ -46,6 +46,11 @@ class Series(dict): ...@@ -46,6 +46,11 @@ class Series(dict):
self.notes = [] self.notes = []
self.changes = {} 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 # These make us more like a dictionary
def __setattr__(self, name, value): def __setattr__(self, name, value):
self[name] = value self[name] = value
...@@ -109,10 +114,7 @@ class Series(dict): ...@@ -109,10 +114,7 @@ class Series(dict):
for upto in range(len(args)): for upto in range(len(args)):
commit = self.commits[upto] commit = self.commits[upto]
print col.Color(col.GREEN, ' %s' % args[upto]) print col.Color(col.GREEN, ' %s' % args[upto])
cc_list = [] cc_list = list(self._generated_cc[commit.patch])
if process_tags:
cc_list += gitutil.BuildEmailList(commit.tags)
cc_list += gitutil.BuildEmailList(commit.cc_list)
# Skip items in To list # Skip items in To list
if 'to' in self: if 'to' in self:
...@@ -202,6 +204,8 @@ class Series(dict): ...@@ -202,6 +204,8 @@ class Series(dict):
def MakeCcFile(self, process_tags): def MakeCcFile(self, process_tags):
"""Make a cc file for us to use for per-commit Cc automation """Make a cc file for us to use for per-commit Cc automation
Also stores in self._generated_cc to make ShowActions() faster.
Args: Args:
process_tags: Process tags as if they were aliases process_tags: Process tags as if they were aliases
Return: Return:
...@@ -216,6 +220,7 @@ class Series(dict): ...@@ -216,6 +220,7 @@ class Series(dict):
list += gitutil.BuildEmailList(commit.tags) list += gitutil.BuildEmailList(commit.tags)
list += gitutil.BuildEmailList(commit.cc_list) list += gitutil.BuildEmailList(commit.cc_list)
print >>fd, commit.patch, ', '.join(list) print >>fd, commit.patch, ', '.join(list)
self._generated_cc[commit.patch] = list
fd.close() fd.close()
return fname return fname
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment