Move some utility class instantiations into the DiffGenerator.
* tools/hook-scripts/mailer/mailer.py:
(generate_content): do not bother with creating DiffSelections or
DiffURLSelections instances, nor pass such. The DiffGenerator will
take care of it now, internally.
(DiffGenerator.__init__): remove the diffsels and diffurls args. We
can easily create this objects ourself. Do so.
Non-sequitur: remove .diff and .diff_url instance variables. These
are unused; a conflation with diff chunks from our generator.
git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1914656 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/tools/hook-scripts/mailer/mailer.py b/tools/hook-scripts/mailer/mailer.py
index e329774..4cdba01 100755
--- a/tools/hook-scripts/mailer/mailer.py
+++ b/tools/hook-scripts/mailer/mailer.py
@@ -786,9 +786,6 @@
### pick a different date format?
date = time.ctime(svn.core.secs_from_timestr(svndate, pool))
- diffsels = DiffSelections(cfg, group, params)
- diffurls = DiffURLSelections(cfg, group, params)
-
show_nonmatching_paths = cfg.get('show_nonmatching_paths', group, params) \
or 'yes'
@@ -804,7 +801,7 @@
if len(paths) != len(changelist) and show_nonmatching_paths == 'yes':
other_diffs = DiffGenerator(changelist, paths, False, cfg, repos, date,
- group, params, diffsels, diffurls, pool)
+ group, params, pool)
else:
other_diffs = None
@@ -820,7 +817,7 @@
show_nonmatching_paths=show_nonmatching_paths,
other_summary=other_summary,
diffs=DiffGenerator(changelist, paths, True, cfg, repos, date, group,
- params, diffsels, diffurls, pool),
+ params, pool),
other_diffs=other_diffs,
)
### clean this up in future rev. Just use wb
@@ -864,7 +861,7 @@
"This is a generator-like object returning DiffContent objects."
def __init__(self, changelist, paths, in_paths, cfg, repos, date, group,
- params, diffsels, diffurls, pool):
+ params, pool):
self.changelist = changelist
self.paths = paths
self.in_paths = in_paths
@@ -873,14 +870,13 @@
self.date = date
self.group = group
self.params = params
- self.diffsels = diffsels
- self.diffurls = diffurls
self.pool = pool
- self.diff = self.diff_url = None
-
self.idx = 0
+ self.diffsels = DiffSelections(cfg, group, params)
+ self.diffurls = DiffURLSelections(cfg, group, params)
+
def __nonzero__(self):
# we always have some items
return True