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

[PATCH] commit-email.pl 'stop processing' flag

From: Archie Cobbs <archie_at_dellroad.org>
Date: 2004-08-03 22:54:23 CEST

Hi,

Below is a patch to commit-email.pl that allows a project to be given
the '-S' flag which means 'stop processing'. Not the prettiest patch
in the world (I'm a perl-avoider) but it seems to get the job done.

For what it's worth...

The problem
-----------

Some subtrees of our project contain sensitive files. We don't
want commit emails containing diffs of these sensitive files going
to the normal commit email address. Instead, they should be omitted
from the email, or go to a different address that directs them to the
appropriate audience.

There's no way to do this today because the matching algorithm of
commit-email.pl's command line is only "additive".

The ideal solution
------------------

Ideally, it would be nice if you could give commit-email.pl regular
expressions to select out sensitive files whose diffs you don't
want to show in the commit email.

The present solution
--------------------

If a '-m' project is given the '-S' flag, then if it matches processing
stops and subsequent project will not match.

So now if you are not a special person then instead of getting emails
with the sensitive diffs removed (ideal solution), you just don't get
the emails at all (workable solution).

Thanks,
-Archie

P.S. please include my email in replies; I'm not subscribed

__________________________________________________________________________
Archie Cobbs * CTO, Awarix * http://www.awarix.com

Index: tools/hook-scripts/commit-email.pl.in
===================================================================
--- tools/hook-scripts/commit-email.pl.in (revision 10475)
+++ tools/hook-scripts/commit-email.pl.in (working copy)
@@ -103,7 +103,8 @@
                        '-l' => 'log_file',
                        '-m' => '',
                        '-r' => 'reply_to',
- '-s' => 'subject_prefix');
+ '-s' => 'subject_prefix',
+ '-S' => 'stop_processing');
 
 while (@ARGV)
   {
@@ -116,6 +117,13 @@
             die "$0: command line option `$arg' is not recognized.\n";
           }
 
+ # Handle -S
+ if ($arg eq '-S')
+ {
+ $current_project->{$hash_key} = "true";
+ next;
+ }
+
         unless (@ARGV)
           {
             die "$0: command line option `$arg' is missing a value.\n";
@@ -386,6 +394,7 @@
     my $log_file = $project->{log_file};
     my $reply_to = $project->{reply_to};
     my $subject_prefix = $project->{subject_prefix};
+ my $stop_processing = $project->{stop_processing};
     my $subject;
 
     if ($commondir ne '')
@@ -477,6 +486,12 @@
             warn "$0: cannot open `$log_file' for appending: $!\n";
           }
       }
+
+ # Stop processing if requested
+ if ($stop_processing eq 'true')
+ {
+ last;
+ }
   }
 
 exit 0;
@@ -492,6 +507,7 @@
       " -m regex Regular expression to match committed path\n",
       " -r email_address Email address for 'Reply-To:'\n",
       " -s subject_prefix Subject line prefix\n",
+ " -S Stop processing if this project matches\n",
       "\n",
       "This script supports a single repository with multiple projects,\n",
       "where each project receives email only for commits that modify that\n",
@@ -501,7 +517,8 @@
       "Any of the following -h, -l, -r and -s command line options and\n",
       "following email addresses are associated with this project. The\n",
       "next -m resets the -h, -l, -r and -s command line options and the\n",
- "list of email addresses.\n",
+ "list of email addresses. If a project has the -S flag set then if\n",
+ "it matches, processing stops so no subsequent projects will match.\n",
       "\n",
       "To support a single project conveniently, the script initializes\n",
       "itself with an implicit -m . rule that matches any modifications\n",
@@ -523,7 +540,8 @@
           log_file => '',
           match_regex => '.',
           reply_to => '',
- subject_prefix => ''};
+ subject_prefix => '',
+ stop_processing => ''};
 }
 
 # Start a child process safely without using /bin/sh.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Aug 3 23:03:57 2004

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.