You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2013/01/28 20:20:53 UTC

svn commit: r1439592 - in /subversion/trunk/tools/hook-scripts/mailer: mailer.conf.example mailer.py

Author: danielsh
Date: Mon Jan 28 19:20:53 2013
New Revision: 1439592

URL: http://svn.apache.org/viewvc?rev=1439592&view=rev
Log:
mailer.py: provide a "repos_dir basename" substitution variable.

Patch by: Janos Gyerik <ja...@gmail.com>
(log message by me)
Review by: breser, cmpilato, danielsh

* tools/hook-scripts/mailer/mailer.py
  (main): Define 'repos_basename' for substitution.

* tools/hook-scripts/mailer/mailer.conf.example
  (SUBSTITUTIONS): Document "%(repos_basename)s".

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

Modified: subversion/trunk/tools/hook-scripts/mailer/mailer.conf.example
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/hook-scripts/mailer/mailer.conf.example?rev=1439592&r1=1439591&r2=1439592&view=diff
==============================================================================
--- subversion/trunk/tools/hook-scripts/mailer/mailer.conf.example (original)
+++ subversion/trunk/tools/hook-scripts/mailer/mailer.conf.example Mon Jan 28 19:20:53 2013
@@ -146,6 +146,15 @@
 #
 #   from_addr = %(author)s@example.com
 #
+# The substitution variable "repos_basename" is provided, and is set to
+# the directory name of the repository. This can be useful to set
+# a custom subject that can be re-used in multiple repositories:
+#
+#   commit_subject_prefix = [svn-%(repos_basename)s]
+#
+# For example if the repository is at /path/to/repo/project-x then
+# the subject of commit emails will be prefixed with [svn-project-x]
+#
 #
 # SUMMARY
 #

Modified: subversion/trunk/tools/hook-scripts/mailer/mailer.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/hook-scripts/mailer/mailer.py?rev=1439592&r1=1439591&r2=1439592&view=diff
==============================================================================
--- subversion/trunk/tools/hook-scripts/mailer/mailer.py (original)
+++ subversion/trunk/tools/hook-scripts/mailer/mailer.py Mon Jan 28 19:20:53 2013
@@ -98,7 +98,10 @@ def main(pool, cmd, config_fname, repos_
   if cmd == 'commit':
     revision = int(cmd_args[0])
     repos = Repository(repos_dir, revision, pool)
-    cfg = Config(config_fname, repos, { 'author' : repos.author })
+    cfg = Config(config_fname, repos,
+                 {'author': author,
+                  'repos_basename': os.path.basename(repos.repos_dir)
+                 })
     messenger = Commit(pool, cfg, repos)
   elif cmd == 'propchange' or cmd == 'propchange2':
     revision = int(cmd_args[0])
@@ -108,14 +111,20 @@ def main(pool, cmd, config_fname, repos_
     repos = Repository(repos_dir, revision, pool)
     # Override the repos revision author with the author of the propchange
     repos.author = author
-    cfg = Config(config_fname, repos, { 'author' : author })
+    cfg = Config(config_fname, repos,
+                 {'author': author,
+                  'repos_basename': os.path.basename(repos.repos_dir)
+                 })
     messenger = PropChange(pool, cfg, repos, author, propname, action)
   elif cmd == 'lock' or cmd == 'unlock':
     author = cmd_args[0]
     repos = Repository(repos_dir, 0, pool) ### any old revision will do
     # Override the repos revision author with the author of the lock/unlock
     repos.author = author
-    cfg = Config(config_fname, repos, { 'author' : author })
+    cfg = Config(config_fname, repos,
+                 {'author': author,
+                  'repos_basename': os.path.basename(repos.repos_dir)
+                 })
     messenger = Lock(pool, cfg, repos, author, cmd == 'lock')
   else:
     raise UnknownSubcommand(cmd)