Hello,
I found some bugs in tools/hook-scripts/mailer/mailer.py.  A patch with 
the fixes is included below.  It is based on revision 14358 in the
1.2.x branch.
The docs in mailer.conf.example talks about "truncate_subject" (with
underline) but mailer.py looks for "truncate-subject" (with dash).
Since all other option values use an underline, I fixed this in
mailer.py for consistency.
generate_content() forgot to set "show_nonmatching_paths" in the "data"
it passes to the render() method of the TextCommitRenderer.  I added it.
When the [maps] section specifies the same mapping specification to be
used by more than one option (e.g. reply_to = [mail-addresses] and
to_addr = [mail-addresses]), the script fails.  I postponed the removal
of a map section name from the self._groups list in Config._prep_maps()
until all map specifications have been processed.
Mappings are only applied when the option value is a single word, e.g.
"to_addr = sally".  When adding another recipient as in
"to_addr = sally harry", mappings are not applied.  This is because
Config.get() passes the whole string "sally harry" to the mapper
function.  I changed this to apply mappings wordwise.
The "exclude_paths" option is very helpful but not documented in
mailer.conf.example.  I made only changes to mailer.py itself, so please
update the documentation.
- Servatius
Index: mailer.py
===================================================================
--- mailer.py	(revision 20)
+++ mailer.py	(working copy)
@@ -132,7 +132,7 @@
 
     try:
       truncate_subject = int(
-          self.cfg.get('truncate-subject', group, params))
+          self.cfg.get('truncate_subject', group, params))
     except ValueError:
       truncate_subject = 0
 
@@ -594,6 +594,7 @@
     added_data=generate_list('A', changelist, paths, True),
     removed_data=generate_list('R', changelist, paths, True),
     modified_data=generate_list('M', changelist, paths, True),
+    show_nonmatching_paths=show_nonmatching_paths,
     other_added_data=other_added_data,
     other_removed_data=other_removed_data,
     other_modified_data=other_modified_data,
@@ -997,7 +998,7 @@
     # apply any mapper
     mapper = getattr(self.maps, option, None)
     if mapper is not None:
-      value = mapper(value)
+      value = " ".join(map(mapper, value.split()))
 
     return value
 
@@ -1014,6 +1015,8 @@
   def _prep_maps(self):
     "Rewrite the [maps] options into callables that look up values."
 
+    mapsections = []
+
     for optname, mapvalue in vars(self.maps).items():
       if mapvalue[:1] == '[':
         # a section is acting as a mapping
@@ -1027,8 +1030,9 @@
                 lambda value,
                        sect=getattr(self, sectname): getattr(sect,
value,
                                                              value))
-        # remove the mapping section from consideration as a group
-        self._groups.remove(sectname)
+        # mark for removal when all optnames are done
+        if sectname not in mapsections:
+          mapsections.append(sectname)
 
       # elif test for other mapper types. possible examples:
       #   dbm:filename.db
@@ -1039,6 +1043,11 @@
       else:
         raise UnknownMappingSpec(mapvalue)
 
+    # remove each mapping section from consideration as a group
+    for sectname in mapsections:
+      self._groups.remove(sectname)
+
+
   def _prep_groups(self, repos):
     self._group_re = [ ]
 
------------------------------------------------------------------------
Servatius Brandt             Phone: +49 89 636-41504
Fujitsu Siemens Computers    Fax:   +49 89 636-48716
EP SW AD C++                 Email: Servatius.Brandt@fujitsu-siemens.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Jun 24 18:27:37 2005