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

Re: Interactive Hooks

From: Jose Garcia Juanino <jjuanino_at_gmail.com>
Date: Tue, 16 Jun 2009 13:02:29 +0200

El martes 16 de junio a las 12:38:29 CEST, Tom Browder escribió:
> On Tue, Jun 16, 2009 at 01:13, Chintana Wilamuna<chintanaw_at_gmail.com> wrote:
> > On Tue, Jun 16, 2009 at 5:00 AM, Tom Browder<tom.browder_at_gmail.com> wrote:
> >
> >> I'm looking at protecting some of us from our own careless actions.
> >> For instance, adding a binary file inadvertently, when binary files
> >> are not prevented but not wanted in all cases.
> >
> > If this what you intended, you can write a script to do svn commits.
> > Before doing an actual svn commit, you can check with svn status
> > whether there are any binary files going to be committed. If so you
> > can ask for confirmation before coming to the svn commit command.
> >
> > Obvious downside with this is now you have to tell all your users to
> > commit with this script.
>
> Thanks, Chintana, good idea.

Give a try to this shell script (the values of environment variables are
obvious). It will not allow to commit binary files outside of doc/
directory, apart from images.

${SVNLOOK} changed -t "$TXN" "$REPOS" | \
egrep -v '^D' | \
${AWK} '!/trunk\/doc\// {print $2}' | \
while read file
do
    if mimeType=`${SVNLOOK} propget --transaction "$TXN"
        "$REPOS" svn:mime-type $file 2>/dev/null`
    then
        if ! echo "$mimeType" | egrep '^text/|^image/' >/dev/null
        then
            echo "" >&2
            echo "Binary files are not allowed: only images and ascii text" >&2
            echo $FAILURE
        fi
    fi
done

Regards

  • application/pgp-signature attachment: stored
Received on 2009-06-16 13:03:45 CEST

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

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