[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Modified commit-email.pl (was: Re: TeX task force)



On Tue, Feb 14, 2006 at 10:18:41AM +0100, Norbert Preining wrote:
> > The pkg-tetex's commit-email.pl (in /svn/pkg-tetex/hooks on
> > svn.debian.org) is a patched version of the subversion distribution's
> > version; see bug#217133.
> 
> Do you have an idea how to do the following: in pkg-texlive I use the 
> 	-m regexp -s .... dest1 dest2 \
> 	-m regext -s .... dest3 dest4
> quite a lot. Every project (4) adds its name to the subject so one can
> easily filter.
> 
> Now I want a test wether up to now there was no match. The problem is
> that if I do
> 	-m . -s ... dest5
> then dest5 gets *all* emails even if it was already sent to one of the
> first destinations. 
> 
> Questions:
> - Can one create a regexp that doesn't match the first projects, or
> - can one patch the commit-email.pl script to exit with a different
>   exit code if no email was sent, i.e. no regexp has matched.

The version of commit-email.pl in svn.debian.org:/svn/pkg-tetex/hooks
now does this.  The usage message now reads:

  usage: commit-email.pl REPOS REVNUM [[-m regex | -M] [options] [email_addr ...]] ...
  options are
    --from email_address  Email address for 'From:' (overrides -h)
    -h hostname           Hostname to append to author for 'From:'
    -l logfile            Append mail contents to this log file
    -m regex              Regular expression to match committed path
    -r email_address      Email address for 'Reply-To:'
    -s subject_prefix     Subject line prefix
    --diff [y|n]          Shows the diff of the commit (defaults to y)
    -M                    Default options for messages not matched by
                          other -m regex options
  
  This script supports a single repository with multiple projects,
  where each project receives email only for commits that modify that
  project.  A project is identified by using the -m command line
  with a regular expression argument.  If a commit has a path that
  matches the regular expression, then the entire commit matches.
  Any of the following -h, -l, -r, -s and --diff command line options and
  following email addresses are associated with this project.  The
  next -m resets the -h, -l, -r, -s and --diff command line options and
  the list of email addresses.  Finally, if a -M option is given, any
  commit messages not matching any of the -m regex's will be sent
  according to the following -h, -l, -r, -s and --diff options.
  For clarity, it is good to place this option last.
  
  To support a single project conveniently, the script initializes
  itself with an implicit -m . rule that matches any modifications
  to the repository.  Therefore, to use the script for a single
  project repository, just use the other comand line options and
  a list of email addresses on the command line.  If you do not want
  a project that matches the entire repository, then use a -m with a
  regular expression before any other command line options or email
  addresses.

The current invocation of commit-email.pl in post-commit essentially
now reads:

/svn/pkg-tetex/hooks/commit-email.pl "$REPOS" "$REV" \
  -m . -s "SVN tetex commit:" --diff n debian-tetex-maint@lists.d.o \
  -m . -s "SVN tetex commit + diffs:" pkg-tetex-commits@lists.alioth.d.o &

meaning that all messages get sent to both lists, one with the diffs,
the other without.

If we wanted to put in subject line headers, we would do something
like (with emails obviously abbreviated here):

/svn/pkg-tetex/hooks/commit-email.pl "$REPOS" "$REV" \
  -m ^tex-common/ -s "[SVN tex-common] commit:" --diff n d-t-m@l.d.o \
  -m ^tex-common/ -s "[SVN tex-common] commit + diffs:" p-t-c@l.a.d.o \
  -m ^tetex-base/ -s "[SVN tetex-base] commit:" --diff n d-t-m@l.d.o \
  -m ^tetex-base/ -s "[SVN tetex-base] commit + diffs:" p-t-c@l.a.d.o \
  ...
  -M -s "[SVN tetex fallback] commit:" --diff n d-t-m@lists.d.o \
  -M -s "[SVN tetex fallback] commit + diffs:" p-t-c@lists.alioth.d.o &

Unfortunately, that doesn't quite work either: a commit which affects
two packages will send two emails to the same address :(

But it's pretty close - this is a rare event and we can probably cope
with it.

Anyone need me to do more work on this?  Remember that we can already
filter subject lines on patterns like " tetex-base/".

   Julian



Reply to: