Unix ( Solaris server )
Thanks I'll play around with the script we have a sandbox to play in only
difference is it has SVN 1.6.5 and Production is still running 1.4.3 ( soon
to be upgraded t0 1.6.5 )
On Thu, Sep 24, 2009 at 4:26 PM, David Weintraub <qazwart_at_gmail.com> wrote:
> Ah! I thought this was some sort of VB script since I didn't recognize the
> syntax.
> Are you on a Unix/Linux system? I can give you something fairly rough for
> shell scripting. This is not tested and my syntax willnot be 100% correct,
> but it gives you an idea what a pre-commit hook would look like:
>
> REPOS=$1TX=$2
> typeset -a
> # I use the svnlook changed to get a list of all the files changed
> /usr/bin/svnlook changed -t$TX $REPOS | while read type file
> do
> # I skill all the files unless they end in .mdb
> [ ${file##*.} != "mdb" ] && continue #Skip unless a .mdb suffix
> # I cat out the file and then count the characters.
> # If it is greater than 1mb, I put it in my error array.
> # Is there a better way to get the size of a file w/ svnlook?
> if [ $(/usr/bin/svnlook cat -t$TX $REPOS $file| wc -c) -ge "1000000" ]
> then
> $error["$file"]=""$file: We can't commit Access databases larger
> than 1mb"
> fi
> done
>
> # I'm done with the loop. Now see if I have any errors
> if [ ${#error[*]} -gt 0 ]
> then
> # If I have an error, I print to STDERR a comment
> # And then list all the files and why they were rejected
> echo "ERRORS in commit!" 1>&2
> foreach error in $error[*]
> do
> echo "$error" 1>&2
> done
> # Now I've finished my error message, exit with a
> # non-zero value. That lets Subversion know this
> # pre-commit hook failed
> exit 2
> fi
> # No errors. Exit with an exit value of zero, so Subversion
> # will commit this transaction.
> exit 0
>
>
> On Thu, Sep 24, 2009 at 3:55 PM, Phil Pinkerton <pcpinkerton_at_gmail.com>wrote:
>
>> Sorry for the lame explanation. I need a pre-commit script for a
>> subversion repository that follows the logic of the syntax.
>>
>> The question should have been:
>>
>> Is it possible to write a pre-commit script that accomplishes the example
>> syntax.
>>
>> On Thu, Sep 24, 2009 at 3:49 PM, Andy Levy <andy.levy_at_gmail.com> wrote:
>>
>>> On Thu, Sep 24, 2009 at 15:46, David Weintraub <qazwart_at_gmail.com>
>>> wrote:
>>> > I take it this is written in VisualBasic? Not familiar with the syntax,
>>> but
>>> > that's pretty much how you'd do it. One comment is to print out
>>> something to
>>> > STDERR to explain why the commit failed. This should include the name
>>> of the
>>> > file rejected and the reason.
>>>
>>> I think it was meant as pseudocode for a solution to a question
>>> someone asked. Not sure what the exact question was though.
>>>
>>
>>
>>
>> --
>> " The fundamental principle here is that the justification for a physical
>> concept lies exclusively in its clear and unambiguous relation to the facts
>> that it can be experienced" AE
>>
>> Please Feed and Educate the Children... it's the least any of us can do.
>>
>>
>
>
> --
> David Weintraub
> qazwart_at_gmail.com
>
--
" The fundamental principle here is that the justification for a physical
concept lies exclusively in its clear and unambiguous relation to the facts
that it can be experienced" AE
Please Feed and Educate the Children... it's the least any of us can do.
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2400223
To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-09-25 15:22:13 CEST