[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] mailer.py

From: Mathias Weinert <mathias.weinert_at_gfa-net.de>
Date: 2006-01-19 11:24:25 CET

As already mentioned earlier I want to provide some new features
to mailer.py. In preparation of this I will step by step send
some smaller patches first (thank you maxb for applying the
latter ones!).

Mathias

[[[
* tools/hook-scripts/mailer/mailer.py
  - typo corrected
  - mailer.conf now has a format number to be able to change existing configuration options (not used yet)

* tools/hook-scripts/mailer/mailer.conf.example
  - new option 'conf_format' to determine the version of the config file
  - some textual corrections
  - deprectaed option 'suppress_deletes' set to comment as default
  - second example for maps added
]]]

--- tools/hook-scripts/mailer/mailer.py.orig 2006-01-19 09:36:38.000000000 +0100
+++ tools/hook-scripts/mailer/mailer.py 2006-01-19 11:04:55.018624100 +0100
@@ -244,7 +244,7 @@
 
 
 class PipeOutput(MailedOutput):
- "Deliver a mail message to an MDA via a pipe."
+ "Deliver a mail message to an MTA via a pipe."
 
   def __init__(self, cfg, repos, prefix_param):
     MailedOutput.__init__(self, cfg, repos, prefix_param)
@@ -541,6 +541,10 @@
     self.modify = False
 
     gen_diffs = cfg.get('generate_diffs', group, params)
+ if cfg.is_set('general.conf_format'):
+ conf_format = cfg.general.conf_format
+ else:
+ conf_format = 1
 
     ### Do a little dance for deprecated options. Note that even if you
     ### don't have an option anywhere in your configuration file, it
@@ -572,6 +576,11 @@
 
 class DiffURLSelections:
   def __init__(self, cfg, group):
+ if cfg.is_set('general.conf_format'):
+ conf_format = cfg.general.conf_format
+ else:
+ conf_format = 1
+
     self.add = cfg.get('diff_add_url', group, None)
     self.copy = cfg.get('diff_copy_url', group, None)
     self.delete = cfg.get('diff_delete_url', group, None)
--- tools/hook-scripts/mailer/mailer.conf.example.orig 2005-04-15 16:37:19.000000000 +0200
+++ tools/hook-scripts/mailer/mailer.conf.example 2006-01-19 11:05:50.096749100 +0100
@@ -8,6 +8,11 @@
 # The [general].diff option is now DEPRECATED.
 # Instead use [defaults].diff .
 
+# This option is used to determine which version of this conf file
+# is being to used in order to be backward compatible.
+# The formerly used format is used if this option is set to 1 or nothing.
+conf_format = 2
+
 #
 # One delivery method must be chosen. mailer.py will prefer using the
 # "mail_command" option. If that option is empty or commented out,
@@ -20,10 +25,10 @@
 # line, and the message piped into it.
 #mail_command = /usr/sbin/sendmail
 
-# This option specifies the hostname for delivery via SMTP
+# This option specifies the hostname for delivery via SMTP.
 #smtp_hostname = localhost
 
-# Username and password for SMTP servers requiring authorisation
+# Username and password for SMTP servers requiring authorisation.
 #smtp_username = example
 #smtp_password = example
 
@@ -139,19 +144,19 @@
 
 # This is not passed to the shell, so do not use shell metacharacters.
 # The command is split around whitespace, so if you want to include
-# whitespace in the command, then ### something ###
+# whitespace in the command, then ### something ###.
 diff = /usr/bin/diff -u -L %(label_from)s -L %(label_to)s %(from)s %(to)s
 
-# The default prefix for the Subject: header for commits
+# The default prefix for the Subject: header for commits.
 commit_subject_prefix =
 
-# The default prefix for the Subject: header for propchanges
+# The default prefix for the Subject: header for propchanges.
 propchange_subject_prefix =
 
-# The default prefix for the Subject: header for locks
+# The default prefix for the Subject: header for locks.
 lock_subject_prefix =
 
-# The default prefix for the Subject: header for unlocks
+# The default prefix for the Subject: header for unlocks.
 unlock_subject_prefix =
 
 
@@ -169,14 +174,14 @@
 # separated by whitespace (no commas):
 to_addr = invalid@example.com
 
-# If this is set, then a Reply-To: will be inserted into the message
+# If this is set, then a Reply-To: will be inserted into the message.
 reply_to =
 
 # When set to one or more of the valid options, the mailer will create
 # diffs for the corresponding types of changes in the repository. If
-# no options are given, or if any invalid options are given, no diffs
-# will be created. Note that the operation is always mentioned in the
-# message header, regardless of this option's value.
+# no options are given, no diffs will be created. Note that the
+# operation is always mentioned in the message header, regardless of
+# this option's value.
 #
 # Valid options: add copy modify delete
 generate_diffs = add copy modify
@@ -198,7 +203,7 @@
 # deletion is always mentioned in the message header, regardless of this
 # option's value.
 ### DEPRECATED (if generate_diffs is not empty, this option is ignored)
-suppress_deletes = yes
+#suppress_deletes = yes
 
 # When set to "yes", the mailer will suppress the creation of a diff which
 # adds all the lines in the file. If this is set to anything else, or
@@ -257,7 +262,7 @@
 #
 
 #
-# EXAMPLE:
+# EXAMPLE 1:
 #
 # We have two projects using two repositories. The name of the repos
 # does not easily map to their commit mailing lists, so we will use
@@ -283,6 +288,32 @@
 # tx = hotness-commits@example.com
 #
 
+#
+# EXAMPLE 2:
+#
+# We want to map the complete repository path to a name which shall
+# be used for the commit subject prefix. This may be used e. g. if
+# one config file is used for some different repositories.
+# In order to be able to also use this for windows paths we do a
+# 'little trick' to elimante the colon ':' from the path.
+# Please note the missing colon in the second repository path.
+# The third one may be the resulting repository path under cygwin
+# (again with the colon eliminated).
+#
+#[defaults]
+#for_repos = (?P<repospath_1>[^:]*):?(?P<repospath_2>[^:]*)
+#commit_subject_prefix = %(repospath_1)s%(repospath_2)s
+#
+#[maps]
+#commit_subject_prefix = [repositories]
+#
+#[repositories]
+#/usr/svn/repos = Linux repository:
+#d/Subversion/repos = Windows repository:
+#/d/Subversion/d/Subversion/repos = Windows repository:
+#
+
+
 # --------------------------------------------------------------------------
 
 #

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Jan 19 12:25:23 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.