Author: gstein
Date: Thu Dec 14 11:36:51 2023
New Revision: 1914656

URL: http://svn.apache.org/viewvc?rev=1914656&view=rev
Log:
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.

Modified:
    subversion/trunk/tools/hook-scripts/mailer/mailer.py

Modified: subversion/trunk/tools/hook-scripts/mailer/mailer.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/tools/hook-scripts/mailer/mailer.py?rev=1914656&r1=1914655&r2=1914656&view=diff
==============================================================================
--- subversion/trunk/tools/hook-scripts/mailer/mailer.py (original)
+++ subversion/trunk/tools/hook-scripts/mailer/mailer.py Thu Dec 14 11:36:51 
2023
@@ -786,9 +786,6 @@ def generate_content(writer, cfg, repos,
   ### 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 @@ def generate_content(writer, cfg, repos,
 
   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 @@ def generate_content(writer, cfg, repos,
     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 @@ class DiffGenerator:
   "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 @@ class DiffGenerator:
     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


Reply via email to