Andrew Reedick wrote on Mon, Dec 02, 2013 at 16:07:52 -0600:
> #!/bin/bash
> 
> set -o pipefail
> 
> REPOS_PATH=$1
> REV=$2  # or is it the other way around?

It's this way around.

> RECIPIENT_LIST=$(svnlook propget ... my:email_list_prop)

Need to set PATH first for this to work.

> svnlook changed ... > $CHANGED_LIST || exit 1
> cat $CHANGED_LIST | sed 's/^....//g' | perl -ne 'print "$1$2\n" if 
> /^(trunk)\/|^(branches\/[^\/]*)\//' | sort -u | xargs -n 1 -i svnlook propget 
> $REPOS_PATH my:filelist_prop "{}" > $FILES_TO_REPORT_ON  || exit 1
> 
> cat $CHANGED_LIST | while read i

'read' splits on whitespace, so filenames that contain spaces won't DTRT.

> do
>       grep -q "$i" "$FILES_TO_REPORT_ON"

Same for filenames that contain regex metacharacters.

>       if [[ $? -eq 0 ]]
>       then
>               sendmail -s " $i was touched in an impure manner" 
> $RECIPIENT_LIST < svnlook diff -r ...

There's an obvious semantic error here, you meant to use a pipe.

But I would suggest using mailer.py here.  If nothing else, you can use
it in its "print the mail to stdout" mode and then pipe that to
sendmail.  That'll take care of formatting the diff, log message, etc.

> Also, do NOT have any blank links in the "my:filelist_prop". Or does
> that only apply when using 'grep -v'?

Your perl invocation will DTRT on blank lines (that is: skip them
without printing them).

Reply via email to